Commit edf4e618 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Better res protocol URL parsing.

parent fa12cffa
......@@ -631,23 +631,20 @@ 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;
}
*res_type++ = 0;
if ((url_file = strchrW(res_type, '/'))) {
*url_file++ = 0;
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());
}else {
url_file = res_type;
res_type = MAKEINTRESOURCEW(RT_HTML);
}
*res_type++ = 0;
hdll = LoadLibraryExW(url_dll, NULL, LOAD_LIBRARY_AS_DATAFILE);
if(!hdll) {
......@@ -656,7 +653,6 @@ static HRESULT WINAPI ResProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
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");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment