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

This commit is contained in:
Jacek Caban 2011-03-29 12:50:52 +02:00 committed by Alexandre Julliard
parent 5fea02e8c2
commit 643c66ba75
2 changed files with 20 additions and 2 deletions

View File

@ -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;

View File

@ -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,