[URLMON]
authorAmine Khaldi <amine.khaldi@reactos.org>
Thu, 25 Sep 2014 15:39:47 +0000 (15:39 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Thu, 25 Sep 2014 15:39:47 +0000 (15:39 +0000)
* Sync with Wine 1.7.27.
CORE-8540

svn path=/trunk/; revision=64278

reactos/dll/win32/urlmon/bindprot.c
reactos/dll/win32/urlmon/mimefilter.c
reactos/dll/win32/urlmon/sec_mgr.c
reactos/dll/win32/urlmon/uri.c
reactos/dll/win32/urlmon/urlmon_main.c
reactos/dll/win32/urlmon/urlmon_main.h
reactos/media/doc/README.WINE

index 77a20bc..53bf509 100644 (file)
@@ -80,14 +80,49 @@ static LRESULT WINAPI notif_wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
     return DefWindowProcW(hwnd, msg, wParam, lParam);
 }
 
+#ifndef __REACTOS__
+
+static const WCHAR wszURLMonikerNotificationWindow[] =
+    {'U','R','L',' ','M','o','n','i','k','e','r',' ',
+     'N','o','t','i','f','i','c','a','t','i','o','n',' ','W','i','n','d','o','w',0};
+
+static ATOM notif_wnd_class;
+
+static BOOL WINAPI register_notif_wnd_class(INIT_ONCE *once, void *param, void **context)
+{
+    static WNDCLASSEXW wndclass = {
+        sizeof(wndclass), 0, notif_wnd_proc, 0, 0,
+        NULL, NULL, NULL, NULL, NULL,
+        wszURLMonikerNotificationWindow, NULL
+    };
+
+    wndclass.hInstance = hProxyDll;
+    notif_wnd_class = RegisterClassExW(&wndclass);
+    return TRUE;
+}
+
+void unregister_notif_wnd_class(void)
+{
+    if(notif_wnd_class)
+        UnregisterClassW(MAKEINTRESOURCEW(notif_wnd_class), hProxyDll);
+}
+
+#endif /* !__REACTOS__ */
+
 HWND get_notif_hwnd(void)
 {
+#ifdef __REACTOS__
     static ATOM wnd_class = 0;
+#endif
     tls_data_t *tls_data;
 
+#ifdef __REACTOS__
     static const WCHAR wszURLMonikerNotificationWindow[] =
         {'U','R','L',' ','M','o','n','i','k','e','r',' ',
          'N','o','t','i','f','i','c','a','t','i','o','n',' ','W','i','n','d','o','w',0};
+#else
+    static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT;
+#endif
 
     tls_data = get_tls_data();
     if(!tls_data)
@@ -98,6 +133,11 @@ HWND get_notif_hwnd(void)
         return tls_data->notif_hwnd;
     }
 
+#ifndef __REACTOS__
+    InitOnceExecuteOnce(&init_once, register_notif_wnd_class, NULL, NULL);
+    if(!notif_wnd_class)
+        return NULL;
+#else
     if(!wnd_class) {
         static WNDCLASSEXW wndclass = {
             sizeof(wndclass), 0,
@@ -113,8 +153,13 @@ HWND get_notif_hwnd(void)
         if (!wnd_class && GetLastError() == ERROR_CLASS_ALREADY_EXISTS)
             wnd_class = 1;
     }
+#endif
 
+#ifndef __REACTOS__
+    tls_data->notif_hwnd = CreateWindowExW(0, MAKEINTRESOURCEW(notif_wnd_class),
+#else
     tls_data->notif_hwnd = CreateWindowExW(0, wszURLMonikerNotificationWindow,
+#endif
             wszURLMonikerNotificationWindow, 0, 0, 0, 0, 0, HWND_MESSAGE,
             NULL, hProxyDll, NULL);
     if(tls_data->notif_hwnd)
@@ -685,6 +730,9 @@ static HRESULT WINAPI ProtocolHandler_Terminate(IInternetProtocol *iface, DWORD
     if(!This->reported_result)
         return E_FAIL;
 
+    /* This may get released in Terminate call. */
+    IInternetProtocolEx_AddRef(&This->IInternetProtocolEx_iface);
+
     IInternetProtocol_Terminate(This->protocol, 0);
 
     set_binding_sink(This, NULL, NULL);
@@ -694,6 +742,7 @@ static HRESULT WINAPI ProtocolHandler_Terminate(IInternetProtocol *iface, DWORD
         This->bind_info = NULL;
     }
 
+    IInternetProtocolEx_Release(&This->IInternetProtocolEx_iface);
     return S_OK;
 }
 
index 7788006..3d529b5 100644 (file)
@@ -277,7 +277,12 @@ static BOOL text_html_filter(const BYTE *b, DWORD size)
                 && (b[1] == 'h' || b[1] == 'H')
                 && (b[2] == 'e' || b[2] == 'E')
                 && (b[3] == 'a' || b[3] == 'A')
-                && (b[4] == 'd' || b[4] == 'D'))) return TRUE;
+                && (b[4] == 'd' || b[4] == 'D'))
+            || (b[0] == '<'
+                && (b[1] == 'b' || b[1] == 'B')
+                && (b[2] == 'o' || b[2] == 'O')
+                && (b[3] == 'd' || b[3] == 'D')
+                && (b[4] == 'y' || b[4] == 'Y'))) return TRUE;
 
     return FALSE;
 }
index ba4980d..c597837 100644 (file)
@@ -230,11 +230,9 @@ static BOOL matches_domain_pattern(LPCWSTR pattern, LPCWSTR str, BOOL implicit_w
              *
              * Doesn't match the pattern.
              */
-            if(str_len > pattern_len) {
-                if(str[str_len-pattern_len-1] == '.' && !strcmpiW(str+(str_len-pattern_len), pattern)) {
-                    matches = TRUE;
-                    *matched = str+(str_len-pattern_len);
-                }
+            if(str[str_len-pattern_len-1] == '.' && !strcmpiW(str+(str_len-pattern_len), pattern)) {
+                matches = TRUE;
+                *matched = str+(str_len-pattern_len);
             }
         } else {
             /* The pattern doesn't have an implicit wildcard, or an explicit wildcard,
@@ -2066,7 +2064,7 @@ HRESULT WINAPI CompareSecurityIds(BYTE *secid1, DWORD size1, BYTE *secid2, DWORD
 /********************************************************************
  *      IsInternetESCEnabledLocal (URLMON.108)
  *
- * Undocumented, returns if IE is running in Enhanced Security Configuration.
+ * Undocumented, returns TRUE if IE is running in Enhanced Security Configuration.
  */
 BOOL WINAPI IsInternetESCEnabledLocal(void)
 {
index 052af22..6237df1 100644 (file)
@@ -340,8 +340,8 @@ static inline BOOL is_hexdigit(WCHAR val) {
             (val >= '0' && val <= '9'));
 }
 
-static inline BOOL is_path_delim(WCHAR val) {
-    return (!val || val == '#' || val == '?');
+static inline BOOL is_path_delim(URL_SCHEME scheme, WCHAR val) {
+    return (!val || (val == '#' && scheme != URL_SCHEME_FILE) || val == '?');
 }
 
 static inline BOOL is_slash(WCHAR c)
@@ -1834,7 +1834,7 @@ static BOOL parse_path_hierarchical(const WCHAR **ptr, parse_data *data, DWORD f
     static const WCHAR slash[] = {'/',0};
     const BOOL is_file = data->scheme_type == URL_SCHEME_FILE;
 
-    if(is_path_delim(**ptr)) {
+    if(is_path_delim(data->scheme_type, **ptr)) {
         if(data->scheme_type == URL_SCHEME_WILDCARD && !data->must_have_path) {
             data->path = NULL;
             data->path_len = 0;
@@ -1844,7 +1844,7 @@ static BOOL parse_path_hierarchical(const WCHAR **ptr, parse_data *data, DWORD f
             data->path_len = 1;
         }
     } else {
-        while(!is_path_delim(**ptr)) {
+        while(!is_path_delim(data->scheme_type, **ptr)) {
             if(**ptr == '%' && data->scheme_type != URL_SCHEME_UNKNOWN && !is_file) {
                 if(!check_pct_encoded(ptr)) {
                     *ptr = start;
@@ -1919,7 +1919,7 @@ static BOOL parse_path_opaque(const WCHAR **ptr, parse_data *data, DWORD flags)
     else
         data->path = *ptr;
 
-    while(!is_path_delim(**ptr)) {
+    while(!is_path_delim(data->scheme_type, **ptr)) {
         if(**ptr == '%' && known_scheme) {
             if(!check_pct_encoded(ptr)) {
                 *ptr = data->path;
@@ -2830,7 +2830,7 @@ static BOOL canonicalize_authority(const parse_data *data, Uri *uri, DWORD flags
  *      file:///c:/test%test    -> file:///c:/test%25test
  */
 static DWORD canonicalize_path_hierarchical(const WCHAR *path, DWORD path_len, URL_SCHEME scheme_type, BOOL has_host, DWORD flags,
-        WCHAR *ret_path) {
+        BOOL is_implicit_scheme, WCHAR *ret_path) {
     const BOOL known_scheme = scheme_type != URL_SCHEME_UNKNOWN;
     const BOOL is_file = scheme_type == URL_SCHEME_FILE;
     const BOOL is_res = scheme_type == URL_SCHEME_RES;
@@ -2896,7 +2896,7 @@ static DWORD canonicalize_path_hierarchical(const WCHAR *path, DWORD path_len, U
                 len += 3;
                 do_default_action = FALSE;
             } else if((is_unreserved(val) && known_scheme) ||
-                      (is_file && (is_unreserved(val) || is_reserved(val) ||
+                      (is_file && !is_implicit_scheme && (is_unreserved(val) || is_reserved(val) ||
                       (val && flags&Uri_CREATE_FILE_USE_DOS_PATH && !is_forbidden_dos_path_char(val))))) {
                 if(ret_path)
                     ret_path[len] = val;
@@ -2921,7 +2921,7 @@ static DWORD canonicalize_path_hierarchical(const WCHAR *path, DWORD path_len, U
             }
         } else if(known_scheme && !is_res && !is_unreserved(*ptr) && !is_reserved(*ptr) &&
                   (!(flags & Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS) || is_file)) {
-            if(!(is_file && (flags & Uri_CREATE_FILE_USE_DOS_PATH))) {
+            if(!is_file || !(flags & Uri_CREATE_FILE_USE_DOS_PATH)) {
                 /* Escape the forbidden character. */
                 if(ret_path)
                     pct_encode_val(*ptr, ret_path+len);
@@ -3114,7 +3114,7 @@ static BOOL canonicalize_hierpart(const parse_data *data, Uri *uri, DWORD flags,
             if(!computeOnly)
                 uri->path_start = uri->canon_len;
             uri->path_len = canonicalize_path_hierarchical(data->path, data->path_len, data->scheme_type, data->host_len != 0,
-                    flags, computeOnly ? NULL : uri->canon_uri+uri->canon_len);
+                    flags, data->has_implicit_scheme, computeOnly ? NULL : uri->canon_uri+uri->canon_len);
             uri->canon_len += uri->path_len;
             if(!computeOnly && !uri->path_len)
                 uri->path_start = -1;
@@ -3881,8 +3881,8 @@ static HRESULT compare_file_paths(const Uri *a, const Uri *b, BOOL *ret)
         return S_OK;
     }
 
-    len_a = canonicalize_path_hierarchical(a->canon_uri+a->path_start, a->path_len, a->scheme_type, FALSE, 0, NULL);
-    len_b = canonicalize_path_hierarchical(b->canon_uri+b->path_start, b->path_len, b->scheme_type, FALSE, 0, NULL);
+    len_a = canonicalize_path_hierarchical(a->canon_uri+a->path_start, a->path_len, a->scheme_type, FALSE, 0, FALSE, NULL);
+    len_b = canonicalize_path_hierarchical(b->canon_uri+b->path_start, b->path_len, b->scheme_type, FALSE, 0, FALSE, NULL);
 
     canon_path_a = heap_alloc(len_a*sizeof(WCHAR));
     if(!canon_path_a)
@@ -3893,8 +3893,8 @@ static HRESULT compare_file_paths(const Uri *a, const Uri *b, BOOL *ret)
         return E_OUTOFMEMORY;
     }
 
-    len_a = canonicalize_path_hierarchical(a->canon_uri+a->path_start, a->path_len, a->scheme_type, FALSE, 0, canon_path_a);
-    len_b = canonicalize_path_hierarchical(b->canon_uri+b->path_start, b->path_len, b->scheme_type, FALSE, 0, canon_path_b);
+    len_a = canonicalize_path_hierarchical(a->canon_uri+a->path_start, a->path_len, a->scheme_type, FALSE, 0, FALSE, canon_path_a);
+    len_b = canonicalize_path_hierarchical(b->canon_uri+b->path_start, b->path_len, b->scheme_type, FALSE, 0, FALSE, canon_path_b);
 
     *ret = len_a == len_b && !memicmpW(canon_path_a, canon_path_b, len_a);
 
index 5016718..74cf5d2 100644 (file)
@@ -127,6 +127,9 @@ static void process_detach(void)
 
     free_session();
     free_tls_list();
+#ifndef __REACTOS__
+    unregister_notif_wnd_class();
+#endif
 }
 
 /***********************************************************************
index e93c80b..da18ecd 100644 (file)
@@ -236,6 +236,9 @@ typedef struct {
 
 tls_data_t *get_tls_data(void) DECLSPEC_HIDDEN;
 
+#ifndef __REACTOS__
+void unregister_notif_wnd_class(void) DECLSPEC_HIDDEN;
+#endif
 HWND get_notif_hwnd(void) DECLSPEC_HIDDEN;
 void release_notif_hwnd(HWND) DECLSPEC_HIDDEN;
 
index 0f73c5f..9233643 100644 (file)
@@ -198,7 +198,7 @@ reactos/dll/win32/twain_32            # Synced to Wine-1.7.17
 reactos/dll/win32/unicows             # Synced to Wine-1.3.32 (Win9x only, why do we need this?!)
 reactos/dll/win32/updspapi            # Synced to Wine-1.7.17
 reactos/dll/win32/url                 # Synced to Wine-1.7.17
-reactos/dll/win32/urlmon              # Synced to Wine-1.7.17
+reactos/dll/win32/urlmon              # Synced to Wine-1.7.27
 reactos/dll/win32/usp10               # Synced to Wine-1.7.17
 reactos/dll/win32/uxtheme             # Forked
 reactos/dll/win32/vbscript            # Synced to Wine-1.7.17