Commit 422b625c authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

urlmon: Add support for PARSE_UNESCAPE to CoInternetParseUrl.

parent b1f9cd57
......@@ -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:
......
......@@ -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);
......@@ -383,6 +384,13 @@ static void test_CoInternetParseUrl(void)
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);
ok(hres == parse_tests[i].path_hres, "[%d] path failed: %08x, expected %08x\n",
......@@ -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);
......
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