From 73452e90a4e0c4f2a02df925672a2a1f7833f229 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Sat, 10 Feb 2007 16:30:42 +0100 Subject: [PATCH] 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 deletion(-) diff --git a/dlls/itss/protocol.c b/dlls/itss/protocol.c index 2d7cd98dc25..fe7e3c893fa 100644 --- a/dlls/itss/protocol.c +++ b/dlls/itss/protocol.c @@ -180,13 +180,20 @@ static HRESULT WINAPI ITSProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl, 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 70f22b9d26f..f04f162318a 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);