Jacek Caban : itss: Fix handling URLs without '/' in object name.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Feb 12 09:23:46 CST 2007


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Sat Feb 10 16:30:42 2007 +0100

itss: Fix handling URLs without '/' in object name.

---

 dlls/itss/protocol.c       |    9 ++++++++-
 dlls/itss/tests/protocol.c |    3 +++
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/dlls/itss/protocol.c b/dlls/itss/protocol.c
index 2d7cd98..fe7e3c8 100644
--- a/dlls/itss/protocol.c
+++ b/dlls/itss/protocol.c
@@ -180,13 +180,20 @@ static HRESULT WINAPI ITSProtocol_Start(
     object_name += 2;
     memset(&chm_object, 0, sizeof(chm_object));
     res = chm_resolve_object(chm_file, object_name, &chm_object);
+    if(res != CHM_RESOLVE_SUCCESS && object_name[0] != '/') {
+        WCHAR tmp_obj_name[MAX_PATH];
+        tmp_obj_name[0] = '/';
+        strcpyW(tmp_obj_name+1, object_name);
+        res = chm_resolve_object(chm_file, tmp_obj_name, &chm_object);
+    }
     if(res != CHM_RESOLVE_SUCCESS) {
         WARN("Could not resolve chm object\n");
         chm_close(chm_file);
         return report_result(pOIProtSink, STG_E_FILENOTFOUND);
     }
 
-    IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_SENDINGREQUEST, object_name+1);
+    IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_SENDINGREQUEST,
+                                         object_name[0] == '/' ? object_name+1 : object_name);
 
     /* FIXME: Native doesn't use FindMimeFromData */
     hres = FindMimeFromData(NULL, szUrl, NULL, 0, NULL, 0, &mime, 0);
diff --git a/dlls/itss/tests/protocol.c b/dlls/itss/tests/protocol.c
index 70f22b9..f04f162 100644
--- a/dlls/itss/tests/protocol.c
+++ b/dlls/itss/tests/protocol.c
@@ -402,6 +402,8 @@ static void test_its_protocol(void)
          't','e','s','t','.','c','h','m',':',':','/','b','l','a','n','k','.','h','t','m','l',0};
     static const WCHAR blank_url3[] = {'m','k',':','@','M','S','I','T','S','t','o','r','e',':',
          't','e','s','t','.','c','h','m',':',':','/','b','l','a','n','k','.','h','t','m','l',0};
+    static const WCHAR blank_url4[] = {'i','t','s',':',
+        't','e','s','t','.','c','h','m',':',':','b','l','a','n','k','.','h','t','m','l',0};
     static const WCHAR wrong_url1[] =
         {'i','t','s',':','t','e','s','t','.','c','h','m',':',':','/','b','l','a','n','.','h','t','m','l',0};
     static const WCHAR wrong_url2[] =
@@ -446,6 +448,7 @@ static void test_its_protocol(void)
             test_protocol_url(factory, blank_url1);
             test_protocol_url(factory, blank_url2);
             test_protocol_url(factory, blank_url3);
+            test_protocol_url(factory, blank_url4);
         }
 
         IClassFactory_Release(factory);




More information about the wine-cvs mailing list