Jacek Caban : mshtml: Better res protocol URL parsing.

Alexandre Julliard julliard at winehq.org
Mon Jul 22 14:22:45 CDT 2013


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Jul 19 17:59:30 2013 +0200

mshtml: Better res protocol URL parsing.

---

 dlls/mshtml/protocol.c |   32 ++++++++++++++------------------
 1 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/dlls/mshtml/protocol.c b/dlls/mshtml/protocol.c
index 021ce55..c8f8d08 100644
--- a/dlls/mshtml/protocol.c
+++ b/dlls/mshtml/protocol.c
@@ -631,31 +631,27 @@ static HRESULT WINAPI ResProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
     }
 
     url_dll = url + sizeof(wszRes)/sizeof(wszRes[0]);
-    if(!(url_file = strrchrW(url_dll, '/'))) {
+    if(!(res_type = strchrW(url_dll, '/'))) {
         WARN("wrong url: %s\n", debugstr_w(url));
         IInternetProtocolSink_ReportResult(pOIProtSink, MK_E_SYNTAX, 0, NULL);
         heap_free(url);
         return MK_E_SYNTAX;
     }
 
-    *url_file++ = 0;
+    *res_type++ = 0;
+    if ((url_file = strchrW(res_type, '/'))) {
+        *url_file++ = 0;
+    }else {
+        url_file = res_type;
+        res_type = MAKEINTRESOURCEW(RT_HTML);
+    }
+
     hdll = LoadLibraryExW(url_dll, NULL, LOAD_LIBRARY_AS_DATAFILE);
     if(!hdll) {
-        if (!(res_type = strrchrW(url_dll, '/'))) {
-            WARN("Could not open dll: %s\n", debugstr_w(url_dll));
-            IInternetProtocolSink_ReportResult(pOIProtSink, HRESULT_FROM_WIN32(GetLastError()), 0, NULL);
-            heap_free(url);
-            return HRESULT_FROM_WIN32(GetLastError());
-        }
-        *res_type++ = 0;
-
-        hdll = LoadLibraryExW(url_dll, NULL, LOAD_LIBRARY_AS_DATAFILE);
-        if(!hdll) {
-            WARN("Could not open dll: %s\n", debugstr_w(url_dll));
-            IInternetProtocolSink_ReportResult(pOIProtSink, HRESULT_FROM_WIN32(GetLastError()), 0, NULL);
-            heap_free(url);
-            return HRESULT_FROM_WIN32(GetLastError());
-        }
+        WARN("Could not open dll: %s\n", debugstr_w(url_dll));
+        IInternetProtocolSink_ReportResult(pOIProtSink, HRESULT_FROM_WIN32(GetLastError()), 0, NULL);
+        heap_free(url);
+        return HRESULT_FROM_WIN32(GetLastError());
     }
 
     TRACE("trying to find resource type %s, name %s\n", debugstr_w(res_type), debugstr_w(url_file));
@@ -665,7 +661,7 @@ static HRESULT WINAPI ResProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
         LPWSTR endpoint = NULL;
         DWORD file_id = strtolW(url_file, &endpoint, 10);
         if(endpoint == url_file+strlenW(url_file))
-            src = FindResourceW(hdll, MAKEINTRESOURCEW(file_id), MAKEINTRESOURCEW(RT_HTML));
+            src = FindResourceW(hdll, MAKEINTRESOURCEW(file_id), res_type);
 
         if(!src) {
             WARN("Could not find resource\n");




More information about the wine-cvs mailing list