[URLMON] Sync with Wine Staging 4.18. CORE-16441
authorAmine Khaldi <amine.khaldi@reactos.org>
Sun, 1 Dec 2019 18:39:31 +0000 (19:39 +0100)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sun, 1 Dec 2019 18:39:31 +0000 (19:39 +0100)
18 files changed:
dll/win32/urlmon/axinstall.c
dll/win32/urlmon/bindctx.c
dll/win32/urlmon/binding.c
dll/win32/urlmon/bindprot.c
dll/win32/urlmon/file.c
dll/win32/urlmon/ftp.c
dll/win32/urlmon/http.c
dll/win32/urlmon/internet.c
dll/win32/urlmon/mimefilter.c
dll/win32/urlmon/mk.c
dll/win32/urlmon/protocol.c
dll/win32/urlmon/sec_mgr.c
dll/win32/urlmon/session.c
dll/win32/urlmon/umon.c
dll/win32/urlmon/uri.c
dll/win32/urlmon/urlmon_main.c
dll/win32/urlmon/urlmon_main.h
media/doc/README.WINE

index 86beb09..5632550 100644 (file)
@@ -213,8 +213,8 @@ static HRESULT extract_cab_file(install_ctx_t *ctx)
         return hres;
     }
 
-    path_len = strlenW(ctx->tmp_dir);
-    file_len = strlenW(ctx->file_name);
+    path_len = lstrlenW(ctx->tmp_dir);
+    file_len = lstrlenW(ctx->file_name);
     ctx->install_file = heap_alloc((path_len+file_len+2)*sizeof(WCHAR));
     if(!ctx->install_file)
         return E_OUTOFMEMORY;
@@ -278,13 +278,13 @@ static void expand_command(install_ctx_t *ctx, const WCHAR *cmd, WCHAR *buf, siz
 
     static const WCHAR expand_dirW[] = {'%','E','X','T','R','A','C','T','_','D','I','R','%'};
 
-    while((ptr = strchrW(ptr, '%'))) {
+    while((ptr = wcschr(ptr, '%'))) {
         if(buf)
             memcpy(buf+len, prev_ptr, ptr-prev_ptr);
         len += ptr-prev_ptr;
 
-        if(!strncmpiW(ptr, expand_dirW, ARRAY_SIZE(expand_dirW))) {
-            len2 = strlenW(ctx->tmp_dir);
+        if(!_wcsnicmp(ptr, expand_dirW, ARRAY_SIZE(expand_dirW))) {
+            len2 = lstrlenW(ctx->tmp_dir);
             if(buf)
                 memcpy(buf+len, ctx->tmp_dir, len2*sizeof(WCHAR));
             len += len2;
@@ -301,8 +301,8 @@ static void expand_command(install_ctx_t *ctx, const WCHAR *cmd, WCHAR *buf, siz
     }
 
     if(buf)
-        strcpyW(buf+len, prev_ptr);
-    *size = len + strlenW(prev_ptr) + 1;
+        lstrcpyW(buf+len, prev_ptr);
+    *size = len + lstrlenW(prev_ptr) + 1;
 }
 
 static HRESULT process_hook_section(install_ctx_t *ctx, const WCHAR *sect_name)
@@ -318,8 +318,8 @@ static HRESULT process_hook_section(install_ctx_t *ctx, const WCHAR *sect_name)
     if(!len)
         return S_OK;
 
-    for(key = buf; *key; key += strlenW(key)+1) {
-        if(!strcmpiW(key, runW)) {
+    for(key = buf; *key; key += lstrlenW(key)+1) {
+        if(!wcsicmp(key, runW)) {
             WCHAR *cmd;
             size_t size;
 
@@ -362,7 +362,7 @@ static HRESULT install_inf_file(install_ctx_t *ctx)
     if(len) {
         default_install = FALSE;
 
-        for(key = buf; *key; key += strlenW(key)+1) {
+        for(key = buf; *key; key += lstrlenW(key)+1) {
             TRACE("[Setup Hooks] key: %s\n", debugstr_w(key));
 
             len = GetPrivateProfileStringW(setup_hooksW, key, NULL, sect_name, ARRAY_SIZE(sect_name),
@@ -382,7 +382,7 @@ static HRESULT install_inf_file(install_ctx_t *ctx)
     if(len) {
         default_install = FALSE;
 
-        for(key = buf; *key; key += strlenW(key)+1) {
+        for(key = buf; *key; key += lstrlenW(key)+1) {
             TRACE("[Add.Code] key: %s\n", debugstr_w(key));
 
             len = GetPrivateProfileStringW(add_codeW, key, NULL, sect_name, ARRAY_SIZE(sect_name),
@@ -472,7 +472,7 @@ static void update_counter(install_ctx_t *ctx, HWND hwnd)
     }else {
         WCHAR buf[100];
         LoadStringW(urlmon_instance, IDS_AXINSTALL_INSTALLN, buf, ARRAY_SIZE(buf));
-        sprintfW(text, buf, ctx->counter);
+        swprintf(text, buf, ctx->counter);
     }
 
     SetDlgItemTextW(hwnd, ID_AXINSTALL_INSTALL_BTN, text);
@@ -574,22 +574,22 @@ static HRESULT install_file(install_ctx_t *ctx, const WCHAR *cache_file)
     if(SUCCEEDED(hres)) {
         const WCHAR *ptr, *ptr2, *ext;
 
-        ptr = strrchrW(path, '/');
+        ptr = wcsrchr(path, '/');
         if(!ptr)
             ptr = path;
         else
             ptr++;
 
-        ptr2 = strrchrW(ptr, '\\');
+        ptr2 = wcsrchr(ptr, '\\');
         if(ptr2)
             ptr = ptr2+1;
 
         ctx->file_name = ptr;
-        ext = strrchrW(ptr, '.');
+        ext = wcsrchr(ptr, '.');
         if(!ext)
             ext = ptr;
 
-        if(!strcmpiW(ext, cab_extW)) {
+        if(!wcsicmp(ext, cab_extW)) {
             hres = install_cab_file(ctx);
         }else {
             FIXME("Unsupported extension %s\n", debugstr_w(ext));
@@ -606,7 +606,7 @@ static void failure_msgbox(install_ctx_t *ctx, HRESULT hres)
     WCHAR buf[1024], fmt[1024];
 
     LoadStringW(urlmon_instance, IDS_AXINSTALL_FAILURE, fmt, ARRAY_SIZE(fmt));
-    sprintfW(buf, fmt, hres);
+    swprintf(buf, fmt, hres);
     MessageBoxW(ctx->hwnd, buf, NULL, MB_OK);
 }
 
index 2759f3d..6191751 100644 (file)
@@ -45,7 +45,7 @@ static void *get_callback_iface(BindStatusCallback *This, REFIID riid)
     void *ret;
     HRESULT hres;
 
-    hres = IBindStatusCallback_QueryInterface(This->callback, riid, (void**)&ret);
+    hres = IBindStatusCallback_QueryInterface(This->callback, riid, &ret);
     if(FAILED(hres) && This->serv_prov)
         hres = IServiceProvider_QueryService(This->serv_prov, riid, riid, &ret);
 
index fdabdfc..e90d4da 100644 (file)
@@ -199,10 +199,10 @@ static LPWSTR get_mime_clsid(LPCWSTR mime, CLSID *clsid)
          'C','o','n','t','e','n','t',' ','T','y','p','e','\\'};
     static const WCHAR clsidW[] = {'C','L','S','I','D',0};
 
-    len = strlenW(mime)+1;
+    len = lstrlenW(mime)+1;
     key_name = heap_alloc(sizeof(mime_keyW) + len*sizeof(WCHAR));
     memcpy(key_name, mime_keyW, sizeof(mime_keyW));
-    strcpyW(key_name + ARRAY_SIZE(mime_keyW), mime);
+    lstrcpyW(key_name + ARRAY_SIZE(mime_keyW), mime);
 
     res = RegOpenKeyW(HKEY_CLASSES_ROOT, key_name, &hkey);
     heap_free(key_name);
index 42d3d21..e9c97e8 100644 (file)
@@ -509,15 +509,19 @@ static HRESULT WINAPI BindProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr
 
         hres = IClassFactory_CreateInstance(cf, (IUnknown*)&This->IInternetBindInfo_iface,
                 &IID_IUnknown, (void**)&protocol_unk);
+        if(SUCCEEDED(hres)) {
+            hres = IUnknown_QueryInterface(protocol_unk, &IID_IInternetProtocol, (void**)&protocol);
+            if(SUCCEEDED(hres))
+                This->protocol_unk = protocol_unk;
+            else
+                IUnknown_Release(protocol_unk);
+        }
+        else if(hres == CLASS_E_NOAGGREGATION)
+            hres = IClassFactory_CreateInstance(cf, NULL, &IID_IInternetProtocol, (void**)&protocol);
+
         IClassFactory_Release(cf);
         if(FAILED(hres))
             return hres;
-
-        hres = IUnknown_QueryInterface(protocol_unk, &IID_IInternetProtocol, (void**)&protocol);
-        if(FAILED(hres)) {
-            IUnknown_Release(protocol_unk);
-            return hres;
-        }
     }
 
     StringFromCLSID(&clsid, &clsid_str);
@@ -703,8 +707,11 @@ static HRESULT WINAPI ProtocolHandler_Terminate(IInternetProtocol *iface, DWORD
 
     if(This->protocol) {
         IInternetProtocol_Terminate(This->protocol, 0);
-        IInternetProtocol_Release(This->protocol);
-        This->protocol = NULL;
+
+        if (This->protocol_unk) {
+            IInternetProtocol_Release(This->protocol);
+            This->protocol = NULL;
+        }
     }
 
     set_binding_sink(This, NULL, NULL);
index 11e6ece..d634085 100644 (file)
@@ -25,7 +25,7 @@
 WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
 
 typedef struct {
-    IUnknown            IUnknown_outer;
+    IUnknown            IUnknown_inner;
     IInternetProtocolEx IInternetProtocolEx_iface;
     IInternetPriority   IInternetPriority_iface;
 
@@ -40,7 +40,7 @@ typedef struct {
 
 static inline FileProtocol *impl_from_IUnknown(IUnknown *iface)
 {
-    return CONTAINING_RECORD(iface, FileProtocol, IUnknown_outer);
+    return CONTAINING_RECORD(iface, FileProtocol, IUnknown_inner);
 }
 
 static inline FileProtocol *impl_from_IInternetProtocolEx(IInternetProtocolEx *iface)
@@ -60,7 +60,7 @@ static HRESULT WINAPI FileProtocolUnk_QueryInterface(IUnknown *iface, REFIID rii
     *ppv = NULL;
     if(IsEqualGUID(&IID_IUnknown, riid)) {
         TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
-        *ppv = &This->IUnknown_outer;
+        *ppv = &This->IUnknown_inner;
     }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) {
         TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This, ppv);
         *ppv = &This->IInternetProtocolEx_iface;
@@ -312,7 +312,7 @@ static HRESULT WINAPI FileProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr
 
     file_handle = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ, NULL,
             OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
-    if(file_handle == INVALID_HANDLE_VALUE && (ptr = strrchrW(path, '#'))) {
+    if(file_handle == INVALID_HANDLE_VALUE && (ptr = wcsrchr(path, '#'))) {
         /* If path contains fragment part, try without it. */
         *ptr = 0;
         file_handle = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ, NULL,
@@ -333,7 +333,7 @@ static HRESULT WINAPI FileProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr
     hres = IUri_GetExtension(pUri, &ext);
     if(SUCCEEDED(hres)) {
         if(hres == S_OK && *ext) {
-            if((ptr = strchrW(ext, '#')))
+            if((ptr = wcschr(ext, '#')))
                 *ptr = 0;
             hres = find_mime_from_ext(ext, &mime);
             if(SUCCEEDED(hres)) {
@@ -428,14 +428,14 @@ HRESULT FileProtocol_Construct(IUnknown *outer, LPVOID *ppobj)
 
     ret = heap_alloc(sizeof(FileProtocol));
 
-    ret->IUnknown_outer.lpVtbl = &FileProtocolUnkVtbl;
+    ret->IUnknown_inner.lpVtbl = &FileProtocolUnkVtbl;
     ret->IInternetProtocolEx_iface.lpVtbl = &FileProtocolExVtbl;
     ret->IInternetPriority_iface.lpVtbl = &FilePriorityVtbl;
     ret->file = INVALID_HANDLE_VALUE;
     ret->priority = 0;
     ret->ref = 1;
-    ret->outer = outer ? outer : (IUnknown*)&ret->IUnknown_outer;
+    ret->outer = outer ? outer : &ret->IUnknown_inner;
 
-    *ppobj = &ret->IUnknown_outer;
+    *ppobj = &ret->IUnknown_inner;
     return S_OK;
 }
index aef4a6c..8e6ec4e 100644 (file)
@@ -28,7 +28,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
 typedef struct {
     Protocol base;
 
-    IUnknown            IUnknown_outer;
+    IUnknown            IUnknown_inner;
     IInternetProtocolEx IInternetProtocolEx_iface;
     IInternetPriority   IInternetPriority_iface;
     IWinInetHttpInfo    IWinInetHttpInfo_iface;
@@ -39,7 +39,7 @@ typedef struct {
 
 static inline FtpProtocol *impl_from_IUnknown(IUnknown *iface)
 {
-    return CONTAINING_RECORD(iface, FtpProtocol, IUnknown_outer);
+    return CONTAINING_RECORD(iface, FtpProtocol, IUnknown_inner);
 }
 
 static inline FtpProtocol *impl_from_IInternetProtocolEx(IInternetProtocolEx *iface)
@@ -66,6 +66,7 @@ static HRESULT FtpProtocol_open_request(Protocol *prot, IUri *uri, DWORD request
         HINTERNET internet_session, IInternetBindInfo *bind_info)
 {
     FtpProtocol *This = impl_from_Protocol(prot);
+    DWORD path_size = 0;
     BSTR url;
     HRESULT hres;
 
@@ -73,16 +74,18 @@ static HRESULT FtpProtocol_open_request(Protocol *prot, IUri *uri, DWORD request
     if(FAILED(hres))
         return hres;
 
-    This->base.request = InternetOpenUrlW(internet_session, url, NULL, 0,
-            request_flags|INTERNET_FLAG_EXISTING_CONNECT|INTERNET_FLAG_PASSIVE,
-            (DWORD_PTR)&This->base);
-    SysFreeString(url);
-    if (!This->base.request && GetLastError() != ERROR_IO_PENDING) {
-        WARN("InternetOpenUrl failed: %d\n", GetLastError());
-        return INET_E_RESOURCE_NOT_FOUND;
+    hres = UrlUnescapeW(url, NULL, &path_size, URL_UNESCAPE_INPLACE);
+    if(SUCCEEDED(hres)) {
+        This->base.request = InternetOpenUrlW(internet_session, url, NULL, 0,
+                request_flags|INTERNET_FLAG_EXISTING_CONNECT|INTERNET_FLAG_PASSIVE,
+                (DWORD_PTR)&This->base);
+        if (!This->base.request && GetLastError() != ERROR_IO_PENDING) {
+            WARN("InternetOpenUrl failed: %d\n", GetLastError());
+            hres = INET_E_RESOURCE_NOT_FOUND;
+        }
     }
-
-    return S_OK;
+    SysFreeString(url);
+    return hres;
 }
 
 static HRESULT FtpProtocol_end_request(Protocol *prot)
@@ -128,7 +131,7 @@ static HRESULT WINAPI FtpProtocolUnk_QueryInterface(IUnknown *iface, REFIID riid
 
     if(IsEqualGUID(&IID_IUnknown, riid)) {
         TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
-        *ppv = &This->IUnknown_outer;
+        *ppv = &This->IUnknown_inner;
     }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) {
         TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This, ppv);
         *ppv = &This->IInternetProtocolEx_iface;
@@ -459,13 +462,13 @@ HRESULT FtpProtocol_Construct(IUnknown *outer, void **ppv)
     ret = heap_alloc_zero(sizeof(FtpProtocol));
 
     ret->base.vtbl = &AsyncProtocolVtbl;
-    ret->IUnknown_outer.lpVtbl            = &FtpProtocolUnkVtbl;
+    ret->IUnknown_inner.lpVtbl            = &FtpProtocolUnkVtbl;
     ret->IInternetProtocolEx_iface.lpVtbl = &FtpProtocolVtbl;
     ret->IInternetPriority_iface.lpVtbl   = &FtpPriorityVtbl;
     ret->IWinInetHttpInfo_iface.lpVtbl    = &WinInetHttpInfoVtbl;
     ret->ref = 1;
-    ret->outer = outer ? outer : &ret->IUnknown_outer;
+    ret->outer = outer ? outer : &ret->IUnknown_inner;
 
-    *ppv = &ret->IUnknown_outer;
+    *ppv = &ret->IUnknown_inner;
     return S_OK;
 }
index 1762787..3663443 100644 (file)
@@ -32,7 +32,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
 typedef struct {
     Protocol base;
 
-    IUnknown            IUnknown_outer;
+    IUnknown            IUnknown_inner;
     IInternetProtocolEx IInternetProtocolEx_iface;
     IInternetPriority   IInternetPriority_iface;
     IWinInetHttpInfo    IWinInetHttpInfo_iface;
@@ -47,7 +47,7 @@ typedef struct {
 
 static inline HttpProtocol *impl_from_IUnknown(IUnknown *iface)
 {
-    return CONTAINING_RECORD(iface, HttpProtocol, IUnknown_outer);
+    return CONTAINING_RECORD(iface, HttpProtocol, IUnknown_inner);
 }
 
 static inline HttpProtocol *impl_from_IInternetProtocolEx(IInternetProtocolEx *iface)
@@ -246,7 +246,7 @@ static ULONG send_http_request(HttpProtocol *This)
     BOOL res;
 
     send_buffer.lpcszHeader = This->full_header;
-    send_buffer.dwHeadersLength = send_buffer.dwHeadersTotal = strlenW(This->full_header);
+    send_buffer.dwHeadersLength = send_buffer.dwHeadersTotal = lstrlenW(This->full_header);
 
     if(This->base.bind_info.dwBindVerb != BINDVERB_GET) {
         switch(This->base.bind_info.stgmedData.tymed) {
@@ -408,7 +408,7 @@ static HRESULT HttpProtocol_open_request(Protocol *prot, IUri *uri, DWORD reques
         return hres;
     }
 
-    len = addl_header ? strlenW(addl_header) : 0;
+    len = addl_header ? lstrlenW(addl_header) : 0;
 
     This->full_header = heap_alloc(len*sizeof(WCHAR)+sizeof(default_headersW));
     if(!This->full_header) {
@@ -561,7 +561,7 @@ static HRESULT HttpProtocol_start_downloading(Protocol *prot)
     content_type = query_http_info(This, HTTP_QUERY_CONTENT_TYPE);
     if(content_type) {
         /* remove the charset, if present */
-        LPWSTR p = strchrW(content_type, ';');
+        LPWSTR p = wcschr(content_type, ';');
         if (p) *p = '\0';
 
         IInternetProtocolSink_ReportProgress(This->base.protocol_sink,
@@ -579,7 +579,7 @@ static HRESULT HttpProtocol_start_downloading(Protocol *prot)
 
     content_length = query_http_info(This, HTTP_QUERY_CONTENT_LENGTH);
     if(content_length) {
-        This->base.content_length = atoiW(content_length);
+        This->base.content_length = wcstol(content_length, NULL, 10);
         heap_free(content_length);
     }
 
@@ -637,7 +637,7 @@ static HRESULT WINAPI HttpProtocolUnk_QueryInterface(IUnknown *iface, REFIID rii
 
     if(IsEqualGUID(&IID_IUnknown, riid)) {
         TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
-        *ppv = &This->IUnknown_outer;
+        *ppv = &This->IUnknown_inner;
     }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) {
         TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This, ppv);
         *ppv = &This->IInternetProtocolEx_iface;
@@ -967,16 +967,16 @@ static HRESULT create_http_protocol(BOOL https, IUnknown *outer, void **ppobj)
         return E_OUTOFMEMORY;
 
     ret->base.vtbl = &AsyncProtocolVtbl;
-    ret->IUnknown_outer.lpVtbl            = &HttpProtocolUnkVtbl;
+    ret->IUnknown_inner.lpVtbl            = &HttpProtocolUnkVtbl;
     ret->IInternetProtocolEx_iface.lpVtbl = &HttpProtocolVtbl;
     ret->IInternetPriority_iface.lpVtbl   = &HttpPriorityVtbl;
     ret->IWinInetHttpInfo_iface.lpVtbl    = &WinInetHttpInfoVtbl;
 
     ret->https = https;
     ret->ref = 1;
-    ret->outer = outer ? outer : &ret->IUnknown_outer;
+    ret->outer = outer ? outer : &ret->IUnknown_inner;
 
-    *ppobj = &ret->IUnknown_outer;
+    *ppobj = &ret->IUnknown_inner;
 
     URLMON_LockModule();
     return S_OK;
index 7c997a0..7356fc8 100644 (file)
@@ -156,7 +156,7 @@ static HRESULT parse_schema(LPCWSTR url, DWORD flags, LPWSTR result, DWORD size,
     if(flags)
         ERR("wrong flags\n");
     
-    ptr = strchrW(url, ':');
+    ptr = wcschr(url, ':');
     if(ptr)
         len = ptr-url;
 
@@ -218,7 +218,7 @@ static HRESULT parse_security_url(LPCWSTR url, DWORD flags, LPWSTR result, DWORD
     return E_FAIL;
 }
 
-static HRESULT parse_encode(LPCWSTR url, DWORD flags, LPWSTR result, DWORD size, DWORD *rsize)
+static HRESULT parse_encode(LPCWSTR url, PARSEACTION action, DWORD flags, LPWSTR result, DWORD size, DWORD *rsize)
 {
     IInternetProtocolInfo *protocol_info;
     DWORD prsize;
@@ -229,7 +229,7 @@ static HRESULT parse_encode(LPCWSTR url, DWORD flags, LPWSTR result, DWORD size,
     protocol_info = get_protocol_info(url);
 
     if(protocol_info) {
-        hres = IInternetProtocolInfo_ParseUrl(protocol_info, url, PARSE_ENCODE,
+        hres = IInternetProtocolInfo_ParseUrl(protocol_info, url, action,
                 flags, result, size, rsize, 0);
         IInternetProtocolInfo_Release(protocol_info);
         if(SUCCEEDED(hres))
@@ -401,7 +401,8 @@ HRESULT WINAPI CoInternetParseUrl(LPCWSTR pwzUrl, PARSEACTION ParseAction, DWORD
     case PARSE_SECURITY_URL:
         return parse_security_url(pwzUrl, dwFlags, pszResult, cchResult, pcchResult);
     case PARSE_ENCODE:
-        return parse_encode(pwzUrl, dwFlags, pszResult, cchResult, pcchResult);
+    case PARSE_UNESCAPE:
+        return parse_encode(pwzUrl, ParseAction, dwFlags, pszResult, cchResult, pcchResult);
     case PARSE_PATH_FROM_URL:
         return parse_path_from_url(pwzUrl, dwFlags, pszResult, cchResult, pcchResult);
     case PARSE_SCHEMA:
@@ -593,7 +594,7 @@ static HRESULT load_process_feature(INTERNETFEATURELIST feature)
         return E_UNEXPECTED;
     }
 
-    process_name = strrchrW(module_name, '\\');
+    process_name = wcsrchr(module_name, '\\');
     if(!process_name) {
         ERR("Invalid module file name: %s\n", debugstr_w(module_name));
         return E_UNEXPECTED;
index 7904bf9..ebaed6b 100644 (file)
@@ -548,12 +548,12 @@ static BOOL is_known_mime_type(const WCHAR *mime)
     unsigned i;
 
     for(i=0; i < ARRAY_SIZE(mime_filters_any_pos); i++) {
-        if(!strcmpW(mime, mime_filters_any_pos[i].mime))
+        if(!wcscmp(mime, mime_filters_any_pos[i].mime))
             return TRUE;
     }
 
     for(i=0; i < ARRAY_SIZE(mime_filters); i++) {
-        if(!strcmpW(mime, mime_filters[i].mime))
+        if(!wcscmp(mime, mime_filters[i].mime))
             return TRUE;
     }
 
@@ -569,7 +569,7 @@ static HRESULT find_mime_from_buffer(const BYTE *buf, DWORD size, const WCHAR *p
         if(!proposed_mime)
             return E_FAIL;
 
-        len = strlenW(proposed_mime)+1;
+        len = lstrlenW(proposed_mime)+1;
         *ret_mime = CoTaskMemAlloc(len*sizeof(WCHAR));
         if(!*ret_mime)
             return E_OUTOFMEMORY;
@@ -578,15 +578,15 @@ static HRESULT find_mime_from_buffer(const BYTE *buf, DWORD size, const WCHAR *p
         return S_OK;
     }
 
-    if(proposed_mime && (!strcmpW(proposed_mime, app_octetstreamW)
-                || !strcmpW(proposed_mime, text_plainW)))
+    if(proposed_mime && (!wcscmp(proposed_mime, app_octetstreamW)
+                || !wcscmp(proposed_mime, text_plainW)))
         proposed_mime = NULL;
 
     if(proposed_mime) {
         ret = proposed_mime;
 
         for(i=0; i < ARRAY_SIZE(mime_filters_any_pos); i++) {
-            if(!strcmpW(proposed_mime, mime_filters_any_pos[i].mime)) {
+            if(!wcscmp(proposed_mime, mime_filters_any_pos[i].mime)) {
                 any_pos_mime = i;
                 for(len=size; len>0; len--) {
                     if(mime_filters_any_pos[i].filter(buf+size-len, len))
@@ -600,7 +600,7 @@ static HRESULT find_mime_from_buffer(const BYTE *buf, DWORD size, const WCHAR *p
 
         if(i == ARRAY_SIZE(mime_filters_any_pos)) {
             for(i=0; i < ARRAY_SIZE(mime_filters); i++) {
-                if(!strcmpW(proposed_mime, mime_filters[i].mime)) {
+                if(!wcscmp(proposed_mime, mime_filters[i].mime)) {
                     if(!mime_filters[i].filter(buf, size))
                         ret = NULL;
                     break;
@@ -663,7 +663,7 @@ static HRESULT find_mime_from_buffer(const BYTE *buf, DWORD size, const WCHAR *p
 
     TRACE("found %s for %s\n", debugstr_w(ret), debugstr_an((const char*)buf, min(32, size)));
 
-    len = strlenW(ret)+1;
+    len = lstrlenW(ret)+1;
     *ret_mime = CoTaskMemAlloc(len*sizeof(WCHAR));
     if(!*ret_mime)
         return E_OUTOFMEMORY;
index d73a00c..697b5f2 100644 (file)
@@ -25,7 +25,7 @@
 WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
 
 typedef struct {
-    IUnknown            IUnknown_outer;
+    IUnknown            IUnknown_inner;
     IInternetProtocolEx IInternetProtocolEx_iface;
 
     LONG ref;
@@ -36,7 +36,7 @@ typedef struct {
 
 static inline MkProtocol *impl_from_IUnknown(IUnknown *iface)
 {
-    return CONTAINING_RECORD(iface, MkProtocol, IUnknown_outer);
+    return CONTAINING_RECORD(iface, MkProtocol, IUnknown_inner);
 }
 
 static inline MkProtocol *impl_from_IInternetProtocolEx(IInternetProtocolEx *iface)
@@ -50,7 +50,7 @@ static HRESULT WINAPI MkProtocolUnk_QueryInterface(IUnknown *iface, REFIID riid,
 
     if(IsEqualGUID(&IID_IUnknown, riid)) {
         TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
-        *ppv = &This->IUnknown_outer;
+        *ppv = &This->IUnknown_inner;
     }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) {
         TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This, ppv);
         *ppv = &This->IInternetProtocolEx_iface;
@@ -286,13 +286,13 @@ static HRESULT WINAPI MkProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUri,
     }
 
     progid = path+1; /* skip '@' symbol */
-    colon_ptr = strchrW(path, ':');
+    colon_ptr = wcschr(path, ':');
     if(!colon_ptr) {
         SysFreeString(path);
         return report_result(pOIProtSink, INET_E_RESOURCE_NOT_FOUND, ERROR_INVALID_PARAMETER);
     }
 
-    len = strlenW(path);
+    len = lstrlenW(path);
     display_name = heap_alloc((len+1)*sizeof(WCHAR));
     memcpy(display_name, path, (len+1)*sizeof(WCHAR));
 
@@ -372,15 +372,15 @@ HRESULT MkProtocol_Construct(IUnknown *outer, void **ppv)
 
     ret = heap_alloc(sizeof(MkProtocol));
 
-    ret->IUnknown_outer.lpVtbl = &MkProtocolUnkVtbl;
+    ret->IUnknown_inner.lpVtbl = &MkProtocolUnkVtbl;
     ret->IInternetProtocolEx_iface.lpVtbl = &MkProtocolVtbl;
     ret->ref = 1;
-    ret->outer = outer ? outer : &ret->IUnknown_outer;
+    ret->outer = outer ? outer : &ret->IUnknown_inner;
     ret->stream = NULL;
 
     /* NOTE:
      * Native returns NULL ppobj and S_OK in CreateInstance if called with IID_IUnknown riid and no outer.
      */
-    *ppv = &ret->IUnknown_outer;
+    *ppv = &ret->IUnknown_inner;
     return S_OK;
 }
index a6ccf83..e6ffd36 100644 (file)
@@ -307,7 +307,7 @@ HINTERNET get_internet_session(IInternetBindInfo *bind_info)
 void update_user_agent(WCHAR *user_agent)
 {
     if(internet_session)
-        InternetSetOptionW(internet_session, INTERNET_OPTION_USER_AGENT, user_agent, strlenW(user_agent));
+        InternetSetOptionW(internet_session, INTERNET_OPTION_USER_AGENT, user_agent, lstrlenW(user_agent));
 }
 
 HRESULT protocol_start(Protocol *protocol, IInternetProtocol *prot, IUri *uri,
index 5f62068..af6cf21 100644 (file)
@@ -65,7 +65,7 @@ static const WCHAR wszZoneMapDomainsKey[] = {'S','o','f','t','w','a','r','e','\\
 
 static inline BOOL is_drive_path(const WCHAR *path)
 {
-    return isalphaW(*path) && *(path+1) == ':';
+    return iswalpha(*path) && *(path+1) == ':';
 }
 
 /* List of schemes types Windows seems to expect to be hierarchical. */
@@ -184,8 +184,8 @@ static HRESULT get_zone_from_reg(LPCWSTR schema, DWORD *zone)
 static BOOL matches_domain_pattern(LPCWSTR pattern, LPCWSTR str, BOOL implicit_wildcard, LPCWSTR *matched)
 {
     BOOL matches = FALSE;
-    DWORD pattern_len = strlenW(pattern);
-    DWORD str_len = strlenW(str);
+    DWORD pattern_len = lstrlenW(pattern);
+    DWORD str_len = lstrlenW(str);
 
     TRACE("(%d) Checking if %s matches %s\n", implicit_wildcard, debugstr_w(str), debugstr_w(pattern));
 
@@ -201,7 +201,7 @@ static BOOL matches_domain_pattern(LPCWSTR pattern, LPCWSTR str, BOOL implicit_w
              * So in this case 'str' would have to end with ".google.com" in order
              * to map to this pattern.
              */
-            if(str_len >= pattern_len+1 && !strcmpiW(str+(str_len-pattern_len+1), pattern+1)) {
+            if(str_len >= pattern_len+1 && !wcsicmp(str+(str_len-pattern_len+1), pattern+1)) {
                 /* Check if there's another '.' inside of the "unmatched" portion
                  * of 'str'.
                  *
@@ -215,14 +215,10 @@ static BOOL matches_domain_pattern(LPCWSTR pattern, LPCWSTR str, BOOL implicit_w
                  * a match.
                  */
                 const WCHAR *ptr;
-                if(str_len > pattern_len+1 && (ptr = memrchrW(str, '.', str_len-pattern_len-2))) {
-                    if(implicit_wildcard) {
-                        matches = TRUE;
-                        *matched = ptr+1;
-                    }
-                } else {
+                for (ptr = str + str_len - pattern_len; ptr > str; ptr--) if (ptr[-1] == '.') break;
+                if (ptr == str || implicit_wildcard) {
                     matches = TRUE;
-                    *matched = str;
+                    *matched = ptr;
                 }
             }
         } else if(implicit_wildcard && str_len > pattern_len) {
@@ -241,7 +237,7 @@ static BOOL matches_domain_pattern(LPCWSTR pattern, LPCWSTR str, BOOL implicit_w
              *
              * Doesn't match the pattern.
              */
-            if(str[str_len-pattern_len-1] == '.' && !strcmpiW(str+(str_len-pattern_len), pattern)) {
+            if(str[str_len-pattern_len-1] == '.' && !wcsicmp(str+(str_len-pattern_len), pattern)) {
                 matches = TRUE;
                 *matched = str+(str_len-pattern_len);
             }
@@ -249,7 +245,7 @@ static BOOL matches_domain_pattern(LPCWSTR pattern, LPCWSTR str, BOOL implicit_w
             /* The pattern doesn't have an implicit wildcard, or an explicit wildcard,
              * so 'str' has to be an exact match to the 'pattern'.
              */
-            if(!strcmpiW(str, pattern)) {
+            if(!wcsicmp(str, pattern)) {
                 matches = TRUE;
                 *matched = str;
             }
@@ -409,7 +405,7 @@ static HRESULT search_domain_for_zone(HKEY domains, LPCWSTR domain, DWORD domain
              *  The mapping would only happen if the "org" key had an explicit subkey
              *  called "www".
              */
-            if(check_domain && !domain_offset && !strchrW(host, matched-host-1))
+            if(check_domain && !domain_offset && !wcschr(host, matched-host-1))
                 found = get_zone_for_scheme(domain_key, schema, zone);
         }
         RegCloseKey(domain_key);
@@ -532,7 +528,7 @@ static HRESULT map_security_uri_to_zone(IUri *uri, DWORD *zone)
     if(FAILED(hres))
         return hres;
 
-    if(!strcmpiW(scheme, fileW)) {
+    if(!wcsicmp(scheme, fileW)) {
         BSTR path;
         WCHAR *ptr, *path_start, root[20];
 
@@ -547,7 +543,7 @@ static HRESULT map_security_uri_to_zone(IUri *uri, DWORD *zone)
         else
             path_start = path;
 
-        if((ptr = strchrW(path_start, ':')) && ptr-path_start+1 < ARRAY_SIZE(root)) {
+        if((ptr = wcschr(path_start, ':')) && ptr-path_start+1 < ARRAY_SIZE(root)) {
             UINT type;
 
             memcpy(root, path_start, (ptr-path_start+1)*sizeof(WCHAR));
@@ -597,7 +593,7 @@ static HRESULT map_url_to_zone(LPCWSTR url, DWORD *zone, LPWSTR *ret_url)
 
     hres = CoInternetGetSecurityUrl(url, &secur_url, PSU_SECURITY_URL_ONLY, 0);
     if(hres != S_OK) {
-        DWORD size = strlenW(url)*sizeof(WCHAR);
+        DWORD size = lstrlenW(url)*sizeof(WCHAR);
 
         secur_url = CoTaskMemAlloc(size);
         if(!secur_url)
@@ -1322,7 +1318,7 @@ static LPDWORD build_zonemap_from_reg(void)
 
                 data = new_data;
             }
-            data[used] = atoiW(name);
+            data[used] = wcstol(name, NULL, 10);
         }
     }
     if (used) {
@@ -1875,7 +1871,7 @@ static HRESULT parse_security_url(const WCHAR *url, PSUACTION action, WCHAR **re
         if(!protocol_info)
             break;
 
-        size = strlenW(url)+1;
+        size = lstrlenW(url)+1;
         new_url = CoTaskMemAlloc(size*sizeof(WCHAR));
         if(!new_url) {
             hres = E_OUTOFMEMORY;
@@ -1904,7 +1900,7 @@ static HRESULT parse_security_url(const WCHAR *url, PSUACTION action, WCHAR **re
             }
         }
 
-        if(parse_hres != S_OK || !strcmpW(url, new_url))
+        if(parse_hres != S_OK || !wcscmp(url, new_url))
             break;
 
         CoTaskMemFree(alloc_url);
@@ -1921,7 +1917,7 @@ static HRESULT parse_security_url(const WCHAR *url, PSUACTION action, WCHAR **re
     }
 
     if(action == PSU_DEFAULT && (protocol_info = get_protocol_info(url))) {
-        size = strlenW(url)+1;
+        size = lstrlenW(url)+1;
         new_url = CoTaskMemAlloc(size * sizeof(WCHAR));
         if(new_url) {
             new_size = 0;
@@ -1964,7 +1960,7 @@ static HRESULT parse_security_url(const WCHAR *url, PSUACTION action, WCHAR **re
     }
 
     if(!alloc_url) {
-        size = strlenW(url)+1;
+        size = lstrlenW(url)+1;
         alloc_url = CoTaskMemAlloc(size * sizeof(WCHAR));
         if(!alloc_url)
             return E_OUTOFMEMORY;
@@ -2001,7 +1997,7 @@ HRESULT WINAPI CoInternetGetSecurityUrl(LPCWSTR pwzUrl, LPWSTR *ppwzSecUrl, PSUA
             case URL_SCHEME_FTP:
             case URL_SCHEME_HTTP:
             case URL_SCHEME_HTTPS:
-                size = strlenW(secure_url)+1;
+                size = lstrlenW(secure_url)+1;
                 new_url = CoTaskMemAlloc(size * sizeof(WCHAR));
                 if(new_url)
                     hres = UrlGetPartW(secure_url, new_url, &size, URL_PART_HOSTNAME, URL_PARTFLAG_KEEPSCHEME);
index 34ff544..edde1ec 100644 (file)
@@ -64,7 +64,7 @@ static name_space *find_name_space(LPCWSTR protocol)
     name_space *iter;
 
     LIST_FOR_EACH_ENTRY(iter, &name_space_list, name_space, entry) {
-        if(!strcmpiW(iter->protocol, protocol))
+        if(!wcsicmp(iter->protocol, protocol))
             return iter;
     }
 
@@ -148,7 +148,7 @@ static HRESULT unregister_namespace(IClassFactory *cf, LPCWSTR protocol)
     EnterCriticalSection(&session_cs);
 
     LIST_FOR_EACH_ENTRY(iter, &name_space_list, name_space, entry) {
-        if(iter->cf == cf && !strcmpiW(iter->protocol, protocol)) {
+        if(iter->cf == cf && !wcsicmp(iter->protocol, protocol)) {
             list_remove(&iter->entry);
 
             LeaveCriticalSection(&session_cs);
@@ -265,7 +265,7 @@ IInternetProtocol *get_mime_filter(LPCWSTR mime)
     EnterCriticalSection(&session_cs);
 
     LIST_FOR_EACH_ENTRY(iter, &mime_filter_list, mime_filter, entry) {
-        if(!strcmpW(iter->mime, mime)) {
+        if(!wcscmp(iter->mime, mime)) {
             cf = iter->cf;
             break;
         }
@@ -408,7 +408,7 @@ static HRESULT WINAPI InternetSession_UnregisterMimeFilter(IInternetSession *ifa
     EnterCriticalSection(&session_cs);
 
     LIST_FOR_EACH_ENTRY(iter, &mime_filter_list, mime_filter, entry) {
-        if(iter->cf == pCF && !strcmpW(iter->mime, pwzType)) {
+        if(iter->cf == pCF && !wcscmp(iter->mime, pwzType)) {
             list_remove(&iter->entry);
 
             LeaveCriticalSection(&session_cs);
@@ -561,8 +561,8 @@ static void ensure_useragent(void)
     else
         os_type = emptyW;
 
-    sprintfW(buf, formatW, is_nt, info.dwMajorVersion, info.dwMinorVersion, os_type);
-    len = strlenW(buf);
+    swprintf(buf, formatW, is_nt, info.dwMajorVersion, info.dwMinorVersion, os_type);
+    len = lstrlenW(buf);
 
     size = len+40;
     ret = heap_alloc(size * sizeof(WCHAR));
index 116f593..14273ef 100644 (file)
@@ -804,7 +804,7 @@ HRESULT WINAPI MkParseDisplayNameEx(IBindCtx *pbc, LPCWSTR szDisplayName, ULONG
 
         hres = CreateURLMoniker(NULL, szDisplayName, ppmk);
         if(SUCCEEDED(hres)) {
-            *pchEaten = strlenW(szDisplayName);
+            *pchEaten = lstrlenW(szDisplayName);
             return hres;
         }
     }
@@ -887,7 +887,7 @@ HRESULT WINAPI URLDownloadToCacheFileW(LPUNKNOWN lpUnkCaller, LPCWSTR szURL, LPW
                               header, sizeof(header), NULL, NULL))
         return E_FAIL;
 
-    if (strlenW(cache_path) > dwBufLength)
+    if (lstrlenW(cache_path) > dwBufLength)
         return E_OUTOFMEMORY;
 
     lstrcpyW(szFileName, cache_path);
index 92978dc..733671c 100644 (file)
@@ -18,6 +18,7 @@
  */
 
 #include <limits.h>
+#include <wchar.h>
 
 #include "urlmon_main.h"
 #include "wine/debug.h"
@@ -518,7 +519,7 @@ static inline void pct_encode_val(WCHAR val, WCHAR *dest) {
  */
 void find_domain_name(const WCHAR *host, DWORD host_len,
                              INT *domain_start) {
-    const WCHAR *last_tld, *sec_last_tld, *end;
+    const WCHAR *last_tld, *sec_last_tld, *end, *p;
 
     end = host+host_len-1;
 
@@ -530,12 +531,18 @@ void find_domain_name(const WCHAR *host, DWORD host_len,
     if(host_len < 4)
         return;
 
-    last_tld = memrchrW(host, '.', host_len);
+    for (last_tld = sec_last_tld = NULL, p = host; p <= end; p++)
+    {
+        if (*p == '.')
+        {
+            sec_last_tld = last_tld;
+            last_tld = p;
+        }
+    }
     if(!last_tld)
         /* http://hostname -> has no domain name. */
         return;
 
-    sec_last_tld = memrchrW(host, '.', last_tld-host);
     if(!sec_last_tld) {
         /* If the '.' is at the beginning of the host there
          * has to be at least 3 characters in the TLD for it
@@ -586,12 +593,8 @@ void find_domain_name(const WCHAR *host, DWORD host_len,
         if(last_tld - (sec_last_tld+1) == 3) {
             for(i = 0; i < ARRAY_SIZE(recognized_tlds); ++i) {
                 if(!StrCmpNIW(sec_last_tld+1, recognized_tlds[i].tld_name, 3)) {
-                    const WCHAR *domain = memrchrW(host, '.', sec_last_tld-host);
-
-                    if(!domain)
-                        *domain_start = 0;
-                    else
-                        *domain_start = (domain+1) - host;
+                    for (p = sec_last_tld; p > host; p--) if (p[-1] == '.') break;
+                    *domain_start = p - host;
                     TRACE("Found domain name %s\n", debugstr_wn(host+*domain_start,
                                                         (host+host_len)-(host+*domain_start)));
                     return;
@@ -604,12 +607,8 @@ void find_domain_name(const WCHAR *host, DWORD host_len,
              * part of the TLD.
              *  Ex: www.google.fo.uk -> google.fo.uk as the domain name.
              */
-            const WCHAR *domain = memrchrW(host, '.', sec_last_tld-host);
-
-            if(!domain)
-                *domain_start = 0;
-            else
-                *domain_start = (domain+1) - host;
+            for (p = sec_last_tld; p > host; p--) if (p[-1] == '.') break;
+            *domain_start = p - host;
         }
     } else {
         /* The second to last TLD has more than 3 characters making it
@@ -773,18 +772,18 @@ static BSTR pre_process_uri(LPCWSTR uri) {
 
     start = uri;
     /* Skip leading controls and whitespace. */
-    while(*start && (iscntrlW(*start) || isspaceW(*start))) ++start;
+    while(*start && (iswcntrl(*start) || iswspace(*start))) ++start;
 
     /* URI consisted only of control/whitespace. */
     if(!*start)
         return SysAllocStringLen(NULL, 0);
 
-    end = start + strlenW(start);
-    while(--end > start && (iscntrlW(*end) || isspaceW(*end)));
+    end = start + lstrlenW(start);
+    while(--end > start && (iswcntrl(*end) || iswspace(*end)));
 
     len = ++end - start;
     for(ptr = start; ptr < end; ptr++) {
-        if(iscntrlW(*ptr))
+        if(iswcntrl(*ptr))
             len--;
     }
 
@@ -793,7 +792,7 @@ static BSTR pre_process_uri(LPCWSTR uri) {
         return NULL;
 
     for(ptr = start, ptr2=ret; ptr < end; ptr++) {
-        if(!iscntrlW(*ptr))
+        if(!iswcntrl(*ptr))
             *ptr2++ = *ptr;
     }
 
@@ -845,9 +844,9 @@ static DWORD ui2ipv4(WCHAR *dest, UINT address) {
 
     if(!dest) {
         WCHAR tmp[16];
-        ret = sprintfW(tmp, formatW, digits[0], digits[1], digits[2], digits[3]);
+        ret = swprintf(tmp, formatW, digits[0], digits[1], digits[2], digits[3]);
     } else
-        ret = sprintfW(dest, formatW, digits[0], digits[1], digits[2], digits[3]);
+        ret = swprintf(dest, formatW, digits[0], digits[1], digits[2], digits[3]);
 
     return ret;
 }
@@ -858,9 +857,9 @@ static DWORD ui2str(WCHAR *dest, UINT value) {
 
     if(!dest) {
         WCHAR tmp[11];
-        ret = sprintfW(tmp, formatW, value);
+        ret = swprintf(tmp, formatW, value);
     } else
-        ret = sprintfW(dest, formatW, value);
+        ret = swprintf(dest, formatW, value);
 
     return ret;
 }
@@ -1987,7 +1986,7 @@ static BOOL parse_hierpart(const WCHAR **ptr, parse_data *data, DWORD flags) {
     /* For javascript: URIs, simply set everything as a path */
     if(data->scheme_type == URL_SCHEME_JAVASCRIPT) {
         data->path = *ptr;
-        data->path_len = strlenW(*ptr);
+        data->path_len = lstrlenW(*ptr);
         data->is_opaque = TRUE;
         *ptr += data->path_len;
         return TRUE;
@@ -2339,9 +2338,9 @@ static BOOL canonicalize_reg_name(const parse_data *data, Uri *uri,
                 /* If NO_CANONICALIZE is not set, then windows lower cases the
                  * decoded value.
                  */
-                if(!(flags & Uri_CREATE_NO_CANONICALIZE) && isupperW(val)) {
+                if(!(flags & Uri_CREATE_NO_CANONICALIZE) && iswupper(val)) {
                     if(!computeOnly)
-                        uri->canon_uri[uri->canon_len] = tolowerW(val);
+                        uri->canon_uri[uri->canon_len] = towlower(val);
                 } else {
                     if(!computeOnly)
                         uri->canon_uri[uri->canon_len] = val;
@@ -2369,8 +2368,8 @@ static BOOL canonicalize_reg_name(const parse_data *data, Uri *uri,
 
                 /* The percent encoded value gets lower cased also. */
                 if(!(flags & Uri_CREATE_NO_CANONICALIZE)) {
-                    uri->canon_uri[uri->canon_len+1] = tolowerW(uri->canon_uri[uri->canon_len+1]);
-                    uri->canon_uri[uri->canon_len+2] = tolowerW(uri->canon_uri[uri->canon_len+2]);
+                    uri->canon_uri[uri->canon_len+1] = towlower(uri->canon_uri[uri->canon_len+1]);
+                    uri->canon_uri[uri->canon_len+2] = towlower(uri->canon_uri[uri->canon_len+2]);
                 }
             }
 
@@ -2378,7 +2377,7 @@ static BOOL canonicalize_reg_name(const parse_data *data, Uri *uri,
         } else {
             if(!computeOnly) {
                 if(!(flags & Uri_CREATE_NO_CANONICALIZE) && known_scheme)
-                    uri->canon_uri[uri->canon_len] = tolowerW(*ptr);
+                    uri->canon_uri[uri->canon_len] = towlower(*ptr);
                 else
                     uri->canon_uri[uri->canon_len] = *ptr;
             }
@@ -2645,11 +2644,11 @@ static BOOL canonicalize_ipv6address(const parse_data *data, Uri *uri,
                     static const WCHAR formatW[] = {'%','x',0};
 
                     if(!computeOnly)
-                        uri->canon_len += sprintfW(uri->canon_uri+uri->canon_len,
+                        uri->canon_len += swprintf(uri->canon_uri+uri->canon_len,
                                             formatW, values[i]);
                     else {
                         WCHAR tmp[5];
-                        uri->canon_len += sprintfW(tmp, formatW, values[i]);
+                        uri->canon_len += swprintf(tmp, formatW, values[i]);
                     }
                 }
             }
@@ -3307,7 +3306,7 @@ static BOOL canonicalize_scheme(const parse_data *data, Uri *uri, DWORD flags, B
 
             for(i = 0; i < data->scheme_len; ++i) {
                 /* Scheme name must be lower case after canonicalization. */
-                uri->canon_uri[i + pos] = tolowerW(data->scheme[i]);
+                uri->canon_uri[i + pos] = towlower(data->scheme[i]);
             }
 
             uri->canon_uri[i + pos] = ':';
@@ -3889,7 +3888,7 @@ static HRESULT compare_file_paths(const Uri *a, const Uri *b, BOOL *ret)
     }
 
     /* Fast path */
-    if(a->path_len == b->path_len && !memicmpW(a->canon_uri+a->path_start, b->canon_uri+b->path_start, a->path_len)) {
+    if(a->path_len == b->path_len && !_wcsnicmp(a->canon_uri+a->path_start, b->canon_uri+b->path_start, a->path_len)) {
         *ret = TRUE;
         return S_OK;
     }
@@ -3909,7 +3908,7 @@ static HRESULT compare_file_paths(const Uri *a, const Uri *b, BOOL *ret)
     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);
+    *ret = len_a == len_b && !_wcsnicmp(canon_path_a, canon_path_b, len_a);
 
     heap_free(canon_path_a);
     heap_free(canon_path_b);
@@ -6417,21 +6416,18 @@ static HRESULT merge_paths(parse_data *data, const WCHAR *base, DWORD base_len,
 
             /* If not found, try finding the end of @xxx: */
             if(end == base+base_len-1)
-                end = *base == '@' ? memchr(base, ':', base_len) : NULL;
+                end = *base == '@' ? wmemchr(base, ':', base_len) : NULL;
         }else {
             /* Find the characters that will be copied over from the base path. */
-            end = memrchrW(base, '/', base_len);
-            if(!end && data->scheme_type == URL_SCHEME_FILE)
+            for (end = base + base_len - 1; end >= base; end--) if (*end == '/') break;
+            if(end < base && data->scheme_type == URL_SCHEME_FILE)
                 /* Try looking for a '\\'. */
-                end = memrchrW(base, '\\', base_len);
+                for (end = base + base_len - 1; end >= base; end--) if (*end == '\\') break;
         }
     }
 
-    if(end) {
-        base_copy_len = (end+1)-base;
-        *result = heap_alloc((base_copy_len+relative_len+1)*sizeof(WCHAR));
-    } else
-        *result = heap_alloc((relative_len+1)*sizeof(WCHAR));
+    if (end) base_copy_len = (end+1)-base;
+    *result = heap_alloc((base_copy_len+relative_len+1)*sizeof(WCHAR));
 
     if(!(*result)) {
         *result_len = 0;
@@ -6439,10 +6435,8 @@ static HRESULT merge_paths(parse_data *data, const WCHAR *base, DWORD base_len,
     }
 
     ptr = *result;
-    if(end) {
-        memcpy(ptr, base, base_copy_len*sizeof(WCHAR));
-        ptr += base_copy_len;
-    }
+    memcpy(ptr, base, base_copy_len*sizeof(WCHAR));
+    ptr += base_copy_len;
 
     memcpy(ptr, relative, relative_len*sizeof(WCHAR));
     ptr += relative_len;
index 06f0698..0e98b9e 100644 (file)
@@ -608,7 +608,7 @@ HRESULT WINAPI CopyStgMedium(const STGMEDIUM *src, STGMEDIUM *dst)
         break;
     case TYMED_FILE:
         if(src->u.lpszFileName && !src->pUnkForRelease) {
-            DWORD size = (strlenW(src->u.lpszFileName)+1)*sizeof(WCHAR);
+            DWORD size = (lstrlenW(src->u.lpszFileName)+1)*sizeof(WCHAR);
             dst->u.lpszFileName = CoTaskMemAlloc(size);
             if(!dst->u.lpszFileName)
                 return E_OUTOFMEMORY;
@@ -674,7 +674,7 @@ HRESULT WINAPI CopyBindInfo(const BINDINFO *pcbiSrc, BINDINFO *pcbiDest)
 
     size = FIELD_OFFSET(BINDINFO, szExtraInfo)+sizeof(void*);
     if(pcbiSrc->cbSize>=size && pcbiDest->cbSize>=size && pcbiSrc->szExtraInfo) {
-        size = (strlenW(pcbiSrc->szExtraInfo)+1)*sizeof(WCHAR);
+        size = (lstrlenW(pcbiSrc->szExtraInfo)+1)*sizeof(WCHAR);
         pcbiDest->szExtraInfo = CoTaskMemAlloc(size);
         if(!pcbiDest->szExtraInfo)
             return E_OUTOFMEMORY;
@@ -692,7 +692,7 @@ HRESULT WINAPI CopyBindInfo(const BINDINFO *pcbiSrc, BINDINFO *pcbiDest)
 
     size = FIELD_OFFSET(BINDINFO, szCustomVerb)+sizeof(void*);
     if(pcbiSrc->cbSize>=size && pcbiDest->cbSize>=size && pcbiSrc->szCustomVerb) {
-        size = (strlenW(pcbiSrc->szCustomVerb)+1)*sizeof(WCHAR);
+        size = (lstrlenW(pcbiSrc->szCustomVerb)+1)*sizeof(WCHAR);
         pcbiDest->szCustomVerb = CoTaskMemAlloc(size);
         if(!pcbiDest->szCustomVerb) {
             CoTaskMemFree(pcbiDest->szExtraInfo);
@@ -810,6 +810,16 @@ int WINAPI MapBrowserEmulationModeToUserAgent(DWORD unk1, DWORD unk2)
     return 0;
 }
 
+/***********************************************************************
+ *           CoInternetGetBrowserProfile (URLMON.446)
+ *    Undocumented, added in IE8
+ */
+HRESULT WINAPI CoInternetGetBrowserProfile(DWORD unk)
+{
+    FIXME("%x: stub\n", unk);
+    return E_NOTIMPL;
+}
+
 /***********************************************************************
  *           FlushUrlmonZonesCache (URLMON.455)
  *    Undocumented, added in IE8
@@ -828,3 +838,25 @@ HRESULT WINAPI RegisterMediaTypes(UINT types, LPCSTR *szTypes, CLIPFORMAT *cfTyp
    FIXME("stub: %u %p %p\n", types, szTypes, cfTypes);
    return E_INVALIDARG;
 }
+
+/***********************************************************************
+ *            ShouldShowIntranetWarningSecband
+ *    Undocumented, added in IE7
+ */
+BOOL WINAPI ShouldShowIntranetWarningSecband(DWORD unk)
+{
+    FIXME("%x: stub\n", unk);
+    return FALSE;
+}
+
+/***********************************************************************
+ *           GetIUriPriv (urlmon.@)
+ *
+ * Not documented.
+ */
+HRESULT WINAPI GetIUriPriv(IUri *uri, void **p)
+{
+    FIXME("(%p,%p): stub\n", uri, p);
+    *p = NULL;
+    return E_NOTIMPL;
+}
index e28b351..6eca2e0 100644 (file)
 #define __WINE_URLMON_MAIN_H
 
 #include <stdarg.h>
-
-#define COBJMACROS
-
 #ifdef __REACTOS__
-#define PROXY_CLSID_IS {0x79EAC9F1,0xBAF9,0x11CE,{0x8C,0x82,0x00,0xAA,0x00,0x4B,0xA9,0x0B}}
+#include <wchar.h>
 #endif
 
+#define COBJMACROS
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
+#ifdef __REACTOS__
+#include "winnls.h"
+#endif
 #include "ole2.h"
 #include "urlmon.h"
 #include "wininet.h"
 
-#include "wine/unicode.h"
 #include "wine/heap.h"
 #include "wine/list.h"
 
@@ -248,7 +249,7 @@ static inline LPWSTR heap_strdupW(LPCWSTR str)
     if(str) {
         DWORD size;
 
-        size = (strlenW(str)+1)*sizeof(WCHAR);
+        size = (lstrlenW(str)+1)*sizeof(WCHAR);
         ret = heap_alloc(size);
         if(ret)
             memcpy(ret, str, size);
index e906511..ba7afbe 100644 (file)
@@ -189,7 +189,7 @@ dll/win32/traffic             # Synced to WineStaging-3.3
 dll/win32/twain_32            # Synced to WineStaging-4.18
 dll/win32/updspapi            # Synced to WineStaging-4.18
 dll/win32/url                 # Synced to WineStaging-3.3
-dll/win32/urlmon              # Synced to WineStaging-4.0
+dll/win32/urlmon              # Synced to WineStaging-4.18
 dll/win32/usp10               # Synced to WineStaging-4.0
 dll/win32/uxtheme             # Forked
 dll/win32/vbscript            # Synced to WineStaging-4.0