diff --git a/dlls/mshtml/protocol.c b/dlls/mshtml/protocol.c index 104b1c164a0..b99bef378b7 100644 --- a/dlls/mshtml/protocol.c +++ b/dlls/mshtml/protocol.c @@ -414,8 +414,14 @@ static HRESULT WINAPI AboutProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, L } if(ParseAction == PARSE_DOMAIN) { - /* Tests show that we don't have to do anything here */ - return S_OK; + if(!pcchResult) + return E_POINTER; + + if(pwzUrl) + *pcchResult = strlenW(pwzUrl)+1; + else + *pcchResult = 1; + return E_FAIL; } return INET_E_DEFAULT_ACTION; @@ -810,8 +816,14 @@ static HRESULT WINAPI ResProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPC } if(ParseAction == PARSE_DOMAIN) { - /* Tests show that we don't have to do anything here */ - return S_OK; + if(!pcchResult) + return E_POINTER; + + if(pwzUrl) + *pcchResult = strlenW(pwzUrl)+1; + else + *pcchResult = 1; + return E_FAIL; } return INET_E_DEFAULT_ACTION; diff --git a/dlls/mshtml/tests/protocol.c b/dlls/mshtml/tests/protocol.c index 309c860ca12..3f0120745c8 100644 --- a/dlls/mshtml/tests/protocol.c +++ b/dlls/mshtml/tests/protocol.c @@ -290,21 +290,51 @@ static void test_res_protocol(void) sizeof(buf)/sizeof(buf[0]), &size, 0); ok(hres == MK_E_SYNTAX, "ParseUrl failed: %08lx, expected MK_E_SYNTAX\n", hres); + size = 0xdeadbeef; buf[0] = '?'; hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, PARSE_DOMAIN, 0, buf, sizeof(buf)/sizeof(buf[0]), &size, 0); - ok(hres == S_OK, "ParseUrl failed: %08lx\n", hres); + ok(hres == S_OK || hres == E_FAIL, "ParseUrl failed: %08lx\n", hres); ok(buf[0] == '?', "buf changed\n"); + ok(size == sizeof(blank_url)/sizeof(WCHAR), + "size=%ld, ezpected %d\n", size, sizeof(wrong_url1)/sizeof(WCHAR)); + size = 0xdeadbeef; hres = IInternetProtocolInfo_ParseUrl(protocol_info, wrong_url1, PARSE_DOMAIN, 0, buf, sizeof(buf)/sizeof(buf[0]), &size, 0); - ok(hres == S_OK, "ParseUrl failed: %08lx, expected MK_E_SYNTAX\n", hres); + ok(hres == S_OK || hres == E_FAIL, "ParseUrl failed: %08lx\n", hres); + ok(buf[0] == '?', "buf changed\n"); + ok(size == sizeof(wrong_url1)/sizeof(WCHAR), + "size=%ld, ezpected %d\n", size, sizeof(wrong_url1)/sizeof(WCHAR)); + +#if 0 /* Crashes on win9x */ + size = 0xdeadbeef; + buf[0] = '?'; + hres = IInternetProtocolInfo_ParseUrl(protocol_info, NULL, PARSE_DOMAIN, 0, buf, + sizeof(buf)/sizeof(buf[0]), &size, 0); + ok(hres == E_FAIL, "ParseUrl failed: %08lx\n", hres); + ok(buf[0] == '?', "buf changed\n"); + ok(size == 1, "size=%ld, ezpected 1\n", size); + + buf[0] = '?'; + hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, PARSE_DOMAIN, 0, buf, + sizeof(buf)/sizeof(buf[0]), NULL, 0); + ok(hres == E_POINTER, "ParseUrl failed: %08lx\n", hres); ok(buf[0] == '?', "buf changed\n"); + buf[0] = '?'; + hres = IInternetProtocolInfo_ParseUrl(protocol_info, NULL, PARSE_DOMAIN, 0, buf, + sizeof(buf)/sizeof(buf[0]), NULL, 0); + ok(hres == E_POINTER, "ParseUrl failed: %08lx\n", hres); + ok(buf[0] == '?', "buf changed\n"); +#endif + + buf[0] = '?'; hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, PARSE_UNESCAPE+1, 0, buf, sizeof(buf)/sizeof(buf[0]), &size, 0); ok(hres == INET_E_DEFAULT_ACTION, "ParseUrl failed: %08lx, expected INET_E_DEFAULT_ACTION\n", hres); + ok(buf[0] == '?', "buf changed\n"); IInternetProtocolInfo_Release(protocol_info); } @@ -437,11 +467,36 @@ static void test_about_protocol(void) ok(hres == S_OK, "ParseUrl failed: %08lx\n", hres); ok(!lstrcmpW(test_url, buf), "buf != test_url\n"); + size = 0xdeadbeef; buf[0] = '?'; hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, PARSE_DOMAIN, 0, buf, sizeof(buf)/sizeof(buf[0]), &size, 0); - ok(hres == S_OK, "ParseUrl failed: %08lx\n", hres); + ok(hres == S_OK || hres == E_FAIL, "ParseUrl failed: %08lx\n", hres); ok(buf[0] == '?', "buf changed\n"); + ok(size == sizeof(blank_url)/sizeof(WCHAR), + "size=%ld, expected %d\n", size, sizeof(blank_url)/sizeof(WCHAR)); + +#if 0 /* Crashes on win9x */ + size = 0xdeadbeef; + buf[0] = '?'; + hres = IInternetProtocolInfo_ParseUrl(protocol_info, NULL, PARSE_DOMAIN, 0, buf, + sizeof(buf)/sizeof(buf[0]), &size, 0); + ok(hres == E_FAIL, "ParseUrl failed: %08lx\n", hres); + ok(buf[0] == '?', "buf changed\n"); + ok(size == 1, "size=%ld, ezpected 1\n", size); + + buf[0] = '?'; + hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, PARSE_DOMAIN, 0, buf, + sizeof(buf)/sizeof(buf[0]), NULL, 0); + ok(hres == E_POINTER, "ParseUrl failed: %08lx\n", hres); + ok(buf[0] == '?', "buf changed\n"); + + buf[0] = '?'; + hres = IInternetProtocolInfo_ParseUrl(protocol_info, NULL, PARSE_DOMAIN, 0, buf, + sizeof(buf)/sizeof(buf[0]), NULL, 0); + ok(hres == E_POINTER, "ParseUrl failed: %08lx\n", hres); + ok(buf[0] == '?', "buf changed\n"); +#endif hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, PARSE_UNESCAPE+1, 0, buf, sizeof(buf)/sizeof(buf[0]), &size, 0);