urlmon: Add support for PARSE_UNESCAPE to CoInternetParseUrl.

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Timoshkov 2019-05-17 15:04:16 +08:00 committed by Alexandre Julliard
parent b1f9cd57be
commit 422b625c9b
2 changed files with 27 additions and 3 deletions

View File

@ -218,7 +218,7 @@ static HRESULT parse_security_url(LPCWSTR url, DWORD flags, LPWSTR result, DWORD
return E_FAIL;
}
static HRESULT parse_encode(LPCWSTR url, DWORD flags, LPWSTR result, DWORD size, DWORD *rsize)
static HRESULT parse_encode(LPCWSTR url, PARSEACTION action, DWORD flags, LPWSTR result, DWORD size, DWORD *rsize)
{
IInternetProtocolInfo *protocol_info;
DWORD prsize;
@ -229,7 +229,7 @@ static HRESULT parse_encode(LPCWSTR url, DWORD flags, LPWSTR result, DWORD size,
protocol_info = get_protocol_info(url);
if(protocol_info) {
hres = IInternetProtocolInfo_ParseUrl(protocol_info, url, PARSE_ENCODE,
hres = IInternetProtocolInfo_ParseUrl(protocol_info, url, action,
flags, result, size, rsize, 0);
IInternetProtocolInfo_Release(protocol_info);
if(SUCCEEDED(hres))
@ -401,7 +401,8 @@ HRESULT WINAPI CoInternetParseUrl(LPCWSTR pwzUrl, PARSEACTION ParseAction, DWORD
case PARSE_SECURITY_URL:
return parse_security_url(pwzUrl, dwFlags, pszResult, cchResult, pcchResult);
case PARSE_ENCODE:
return parse_encode(pwzUrl, dwFlags, pszResult, cchResult, pcchResult);
case PARSE_UNESCAPE:
return parse_encode(pwzUrl, ParseAction, dwFlags, pszResult, cchResult, pcchResult);
case PARSE_PATH_FROM_URL:
return parse_path_from_url(pwzUrl, dwFlags, pszResult, cchResult, pcchResult);
case PARSE_SCHEMA:

View File

@ -62,6 +62,7 @@ DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xA
DEFINE_EXPECT(ParseUrl);
DEFINE_EXPECT(ParseUrl_ENCODE);
DEFINE_EXPECT(ParseUrl_UNESCAPE);
DEFINE_EXPECT(QI_IInternetProtocolInfo);
DEFINE_EXPECT(CreateInstance);
DEFINE_EXPECT(unk_Release);
@ -382,6 +383,13 @@ static void test_CoInternetParseUrl(void)
ok(size == lstrlenW(parse_tests[i].encoded_url), "[%d] wrong size\n", i);
ok(!lstrcmpW(parse_tests[i].encoded_url, buf), "[%d] wrong encoded url\n", i);
memset(buf, 0xf0, sizeof(buf));
hres = pCoInternetParseUrl(parse_tests[i].url, PARSE_UNESCAPE, 0, buf,
ARRAY_SIZE(buf), &size, 0);
ok(hres == S_OK, "[%d] encoding failed: %08x\n", i, hres);
ok(size == lstrlenW(parse_tests[i].encoded_url), "[%d] wrong size\n", i);
ok(!lstrcmpW(parse_tests[i].encoded_url, buf), "[%d] wrong encoded url\n", i);
memset(buf, 0xf0, sizeof(buf));
hres = pCoInternetParseUrl(parse_tests[i].url, PARSE_PATH_FROM_URL, 0, buf,
ARRAY_SIZE(buf), &size, 0);
@ -890,6 +898,11 @@ static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface
case PARSE_ENCODE:
CHECK_EXPECT2(ParseUrl_ENCODE);
break;
case PARSE_UNESCAPE:
CHECK_EXPECT2(ParseUrl_UNESCAPE);
break;
default:
CHECK_EXPECT2(ParseUrl);
break;
@ -1056,6 +1069,16 @@ static void test_NameSpace(void)
CHECK_CALLED(QI_IInternetProtocolInfo);
CHECK_CALLED(ParseUrl_ENCODE);
qiret = S_OK;
SET_EXPECT(QI_IInternetProtocolInfo);
SET_EXPECT(ParseUrl_UNESCAPE);
hres = pCoInternetParseUrl(url8, PARSE_UNESCAPE, 0, buf, ARRAY_SIZE(buf), &size, 0);
ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
CHECK_CALLED(QI_IInternetProtocolInfo);
CHECK_CALLED(ParseUrl_UNESCAPE);
SET_EXPECT(QI_IInternetProtocolInfo);
SET_EXPECT(ParseUrl);