Jacek Caban : mshtml: Try loading library in IInternetProtocolInfo:: ParseUrl(PARSE_INTERNET_URL) for res protocol to work around library name difference for winelib libraries .

Alexandre Julliard julliard at winehq.org
Tue Mar 29 11:43:06 CDT 2011


Module: wine
Branch: master
Commit: 643c66ba752a6274178cd9c574896395cf063f7c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=643c66ba752a6274178cd9c574896395cf063f7c

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Mar 29 12:50:52 2011 +0200

mshtml: Try loading library in IInternetProtocolInfo::ParseUrl(PARSE_INTERNET_URL) for res protocol to work around library name difference for winelib libraries.

---

 dlls/mshtml/protocol.c       |   16 ++++++++++++++--
 dlls/mshtml/tests/protocol.c |    6 ++++++
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/protocol.c b/dlls/mshtml/protocol.c
index dad93ba..456c3fd 100644
--- a/dlls/mshtml/protocol.c
+++ b/dlls/mshtml/protocol.c
@@ -865,8 +865,20 @@ static HRESULT WINAPI ResProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPC
 
         len = SearchPathW(NULL, file_part, NULL, sizeof(full_path)/sizeof(WCHAR), full_path, NULL);
         if(!len) {
-            WARN("Could not find file %s\n", debugstr_w(file_part));
-            return MK_E_SYNTAX;
+            HMODULE module;
+
+            /* SearchPath does not work well with winelib files (like our test executable),
+             * so we also try to load the library here */
+            module = LoadLibraryExW(file_part, NULL, LOAD_LIBRARY_AS_DATAFILE);
+            if(!module) {
+                WARN("Could not find file %s\n", debugstr_w(file_part));
+                return MK_E_SYNTAX;
+            }
+
+            len = GetModuleFileNameW(module, full_path, sizeof(full_path)/sizeof(WCHAR));
+            FreeLibrary(module);
+            if(!len)
+                return E_FAIL;
         }
 
         size = sizeof(wszFile)/sizeof(WCHAR) + len + 1;
diff --git a/dlls/mshtml/tests/protocol.c b/dlls/mshtml/tests/protocol.c
index 7504927..07f424f 100644
--- a/dlls/mshtml/tests/protocol.c
+++ b/dlls/mshtml/tests/protocol.c
@@ -315,6 +315,8 @@ static void test_res_protocol(void)
         {'r','e','s',':','/','/','x','x','.','d','l','l','/','b','l','a','n','k','.','h','t','m',0};
     static const WCHAR wrong_url5[] =
         {'r','e','s',':','/','/','s','h','t','m','l','.','d','l','l','/','b','l','a','n','k','.','h','t','m',0};
+    static const WCHAR wrong_url6[] =
+        {'r','e','s',':','/','/','c',':','\\','d','i','r','\\','f','i','l','e','.','d','l','l','/','b','l','a','n','k','.','h','t','m',0};
     static const WCHAR mshtml_dllW[] = {'m','s','h','t','m','l','.','d','l','l',0};
 
     hres = CoGetClassObject(&CLSID_ResProtocol, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void**)&unk);
@@ -366,6 +368,10 @@ static void test_res_protocol(void)
                 sizeof(buf)/sizeof(buf[0]), &size, 0);
         ok(hres == MK_E_SYNTAX, "ParseUrl failed: %08x, expected MK_E_SYNTAX\n", hres);
 
+        hres = IInternetProtocolInfo_ParseUrl(protocol_info, wrong_url6, PARSE_SECURITY_URL, 0, buf,
+                sizeof(buf)/sizeof(buf[0]), &size, 0);
+        ok(hres == MK_E_SYNTAX, "ParseUrl failed: %08x, expected MK_E_SYNTAX\n", hres);
+
         size = 0xdeadbeef;
         buf[0] = '?';
         hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, PARSE_DOMAIN, 0, buf,




More information about the wine-cvs mailing list