Commit 02bf65a7 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

urlmon: Better error handling in file protocol.

parent 3efe4e68
...@@ -119,6 +119,9 @@ static HRESULT WINAPI FileProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl ...@@ -119,6 +119,9 @@ static HRESULT WINAPI FileProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl
ReleaseBindInfo(&bindinfo); ReleaseBindInfo(&bindinfo);
if(!szUrl || !*szUrl)
return E_INVALIDARG;
if(lstrlenW(szUrl) < sizeof(wszFile)/sizeof(WCHAR) if(lstrlenW(szUrl) < sizeof(wszFile)/sizeof(WCHAR)
|| memcmp(szUrl, wszFile, sizeof(wszFile))) || memcmp(szUrl, wszFile, sizeof(wszFile)))
return MK_E_SYNTAX; return MK_E_SYNTAX;
......
...@@ -1384,6 +1384,16 @@ static void test_file_protocol_fail(void) ...@@ -1384,6 +1384,16 @@ static void test_file_protocol_fail(void)
CHECK_CALLED(ReportProgress_SENDINGREQUEST); CHECK_CALLED(ReportProgress_SENDINGREQUEST);
CHECK_CALLED(ReportResult); CHECK_CALLED(ReportResult);
SET_EXPECT(GetBindInfo);
hres = IInternetProtocol_Start(protocol, NULL, &protocol_sink, &bind_info, 0, 0);
ok(hres == E_INVALIDARG, "Start failed: %08x, expected E_INVALIDARG\n", hres);
CHECK_CALLED(GetBindInfo);
SET_EXPECT(GetBindInfo);
hres = IInternetProtocol_Start(protocol, emptyW, &protocol_sink, &bind_info, 0, 0);
ok(hres == E_INVALIDARG, "Start failed: %08x, expected E_INVALIDARG\n", hres);
CHECK_CALLED(GetBindInfo);
IInternetProtocol_Release(protocol); IInternetProtocol_Release(protocol);
} }
......
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