mshtml: Better res protocol URL parsing.

This commit is contained in:
Jacek Caban 2013-07-19 17:59:30 +02:00 committed by Alexandre Julliard
parent fa12cffa9d
commit edf4e61891
1 changed files with 14 additions and 18 deletions

View File

@ -631,31 +631,27 @@ static HRESULT WINAPI ResProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
} }
url_dll = url + sizeof(wszRes)/sizeof(wszRes[0]); 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)); WARN("wrong url: %s\n", debugstr_w(url));
IInternetProtocolSink_ReportResult(pOIProtSink, MK_E_SYNTAX, 0, NULL); IInternetProtocolSink_ReportResult(pOIProtSink, MK_E_SYNTAX, 0, NULL);
heap_free(url); heap_free(url);
return MK_E_SYNTAX; 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); hdll = LoadLibraryExW(url_dll, NULL, LOAD_LIBRARY_AS_DATAFILE);
if(!hdll) { if(!hdll) {
if (!(res_type = strrchrW(url_dll, '/'))) { WARN("Could not open dll: %s\n", debugstr_w(url_dll));
WARN("Could not open dll: %s\n", debugstr_w(url_dll)); IInternetProtocolSink_ReportResult(pOIProtSink, HRESULT_FROM_WIN32(GetLastError()), 0, NULL);
IInternetProtocolSink_ReportResult(pOIProtSink, HRESULT_FROM_WIN32(GetLastError()), 0, NULL); heap_free(url);
heap_free(url); return HRESULT_FROM_WIN32(GetLastError());
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());
}
} }
TRACE("trying to find resource type %s, name %s\n", debugstr_w(res_type), debugstr_w(url_file)); 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; LPWSTR endpoint = NULL;
DWORD file_id = strtolW(url_file, &endpoint, 10); DWORD file_id = strtolW(url_file, &endpoint, 10);
if(endpoint == url_file+strlenW(url_file)) 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) { if(!src) {
WARN("Could not find resource\n"); WARN("Could not find resource\n");