Commit 7ccbbd86 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

urlmon: Use CoInternetParseIUri instead of IUri::GetPath in file protocol handler implementation.

parent 8f3c3ca3
......@@ -245,12 +245,13 @@ static HRESULT WINAPI FileProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr
DWORD grfPI, HANDLE *dwReserved)
{
FileProtocol *This = impl_from_IInternetProtocolEx(iface);
WCHAR path[MAX_PATH];
BINDINFO bindinfo;
DWORD grfBINDF = 0;
DWORD scheme;
DWORD scheme, size;
LPWSTR mime = NULL;
WCHAR null_char = 0;
BSTR path, url;
BSTR url;
HRESULT hres;
TRACE("(%p)->(%p %p %p %08x %p)\n", This, pUri, pOIProtSink,
......@@ -288,14 +289,14 @@ static HRESULT WINAPI FileProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr
IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_SENDINGREQUEST, &null_char);
hres = IUri_GetPath(pUri, &path);
size = 0;
hres = CoInternetParseIUri(pUri, PARSE_PATH_FROM_URL, 0, path, sizeof(path)/sizeof(WCHAR), &size, 0);
if(FAILED(hres)) {
ERR("GetPath failed: %08x\n", hres);
WARN("CoInternetParseIUri failed: %08x\n", hres);
return report_result(pOIProtSink, hres, 0);
}
hres = open_file(This, path, pOIProtSink);
SysFreeString(path);
if(FAILED(hres))
return hres;
......
......@@ -2447,6 +2447,24 @@ static void test_file_protocol_url(LPCWSTR url)
IUri_Release(uri);
IInternetProtocolEx_Release(protocolex);
hres = pCreateUri(url, 0, 0, &uri);
ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocolEx, (void**)&protocolex);
ok(hres == S_OK, "Could not get IInternetProtocolEx: %08x\n", hres);
if(file_protocol_start(NULL, NULL, protocolex, uri, TRUE)) {
hres = IInternetProtocolEx_Read(protocolex, buf, 2, &cb);
ok(hres == S_OK, "Read failed: %08x\n", hres);
hres = IInternetProtocolEx_LockRequest(protocolex, 0);
ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
hres = IInternetProtocolEx_UnlockRequest(protocolex);
ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
}
IUri_Release(uri);
IInternetProtocolEx_Release(protocolex);
}else {
win_skip("Skipping file protocol StartEx tests\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