Commit b3084d55 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

Added PARSE_SECURITY_URL action implementation.

parent 90215e81
...@@ -108,6 +108,24 @@ static IInternetProtocolInfo *get_protocol_info(LPCWSTR url) ...@@ -108,6 +108,24 @@ static IInternetProtocolInfo *get_protocol_info(LPCWSTR url)
return ret; return ret;
} }
static HRESULT parse_security_url(LPCWSTR url, DWORD flags, LPWSTR result, DWORD size, DWORD *rsize)
{
IInternetProtocolInfo *protocol_info;
HRESULT hres;
TRACE("(%s %08lx %p %ld %p)\n", debugstr_w(url), flags, result, size, rsize);
protocol_info = get_protocol_info(url);
if(protocol_info) {
hres = IInternetProtocolInfo_ParseUrl(protocol_info, url, PARSE_SECURITY_URL,
flags, result, size, rsize, 0);
return hres;
}
return E_FAIL;
}
static HRESULT parse_encode(LPCWSTR url, DWORD flags, LPWSTR result, DWORD size, DWORD *rsize) static HRESULT parse_encode(LPCWSTR url, DWORD flags, LPWSTR result, DWORD size, DWORD *rsize)
{ {
IInternetProtocolInfo *protocol_info; IInternetProtocolInfo *protocol_info;
...@@ -166,6 +184,8 @@ HRESULT WINAPI CoInternetParseUrl(LPCWSTR pwzUrl, PARSEACTION ParseAction, DWORD ...@@ -166,6 +184,8 @@ HRESULT WINAPI CoInternetParseUrl(LPCWSTR pwzUrl, PARSEACTION ParseAction, DWORD
WARN("dwReserved = %ld\n", dwReserved); WARN("dwReserved = %ld\n", dwReserved);
switch(ParseAction) { switch(ParseAction) {
case PARSE_SECURITY_URL:
return parse_security_url(pwzUrl, dwFlags, pszResult, cchResult, pcchResult);
case PARSE_ENCODE: case PARSE_ENCODE:
return parse_encode(pwzUrl, dwFlags, pszResult, cchResult, pcchResult); return parse_encode(pwzUrl, dwFlags, pszResult, cchResult, pcchResult);
case PARSE_PATH_FROM_URL: case PARSE_PATH_FROM_URL:
......
...@@ -208,6 +208,8 @@ static const WCHAR url2[] = {'i','n','d','e','x','.','h','t','m',0}; ...@@ -208,6 +208,8 @@ static const WCHAR url2[] = {'i','n','d','e','x','.','h','t','m',0};
static const WCHAR url3[] = {'f','i','l','e',':','c',':','\\','I','n','d','e','x','.','h','t','m',0}; static const WCHAR url3[] = {'f','i','l','e',':','c',':','\\','I','n','d','e','x','.','h','t','m',0};
static const WCHAR url4[] = {'f','i','l','e',':','s','o','m','e','%','2','0','f','i','l','e', static const WCHAR url4[] = {'f','i','l','e',':','s','o','m','e','%','2','0','f','i','l','e',
'%','2','E','j','p','g',0}; '%','2','E','j','p','g',0};
static const WCHAR url5[] = {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
'.','o','r','g',0};
static const WCHAR url4e[] = {'f','i','l','e',':','s','o','m','e',' ','f','i','l','e', static const WCHAR url4e[] = {'f','i','l','e',':','s','o','m','e',' ','f','i','l','e',
'.','j','p','g',0}; '.','j','p','g',0};
...@@ -221,6 +223,7 @@ static const WCHAR wszEmpty[] = {0}; ...@@ -221,6 +223,7 @@ static const WCHAR wszEmpty[] = {0};
struct parse_test { struct parse_test {
LPCWSTR url; LPCWSTR url;
HRESULT secur_hres;
LPCWSTR encoded_url; LPCWSTR encoded_url;
HRESULT path_hres; HRESULT path_hres;
LPCWSTR path; LPCWSTR path;
...@@ -228,10 +231,10 @@ struct parse_test { ...@@ -228,10 +231,10 @@ struct parse_test {
}; };
static const struct parse_test parse_tests[] = { static const struct parse_test parse_tests[] = {
{url1, url1, E_INVALIDARG, NULL, wszRes}, {url1, S_OK, url1, E_INVALIDARG, NULL, wszRes},
{url2, url2, E_INVALIDARG, NULL, wszEmpty}, {url2, E_FAIL, url2, E_INVALIDARG, NULL, wszEmpty},
{url3, url3, S_OK, path3, wszFile}, {url3, E_FAIL, url3, S_OK, path3, wszFile},
{url4, url4e, S_OK, path4, wszFile} {url4, E_FAIL, url4e, S_OK, path4, wszFile}
}; };
static void test_CoInternetParseUrl(void) static void test_CoInternetParseUrl(void)
...@@ -249,6 +252,12 @@ static void test_CoInternetParseUrl(void) ...@@ -249,6 +252,12 @@ static void test_CoInternetParseUrl(void)
for(i=0; i < sizeof(parse_tests)/sizeof(parse_tests[0]); i++) { for(i=0; i < sizeof(parse_tests)/sizeof(parse_tests[0]); i++) {
memset(buf, 0xf0, sizeof(buf)); memset(buf, 0xf0, sizeof(buf));
hres = CoInternetParseUrl(parse_tests[i].url, PARSE_SECURITY_URL, 0, buf,
sizeof(buf)/sizeof(WCHAR), &size, 0);
ok(hres == parse_tests[i].secur_hres, "[%d] security url failed: %08lx, expected %08lx\n",
i, hres, parse_tests[i].secur_hres);
memset(buf, 0xf0, sizeof(buf));
hres = CoInternetParseUrl(parse_tests[i].url, PARSE_ENCODE, 0, buf, hres = CoInternetParseUrl(parse_tests[i].url, PARSE_ENCODE, 0, buf,
sizeof(buf)/sizeof(WCHAR), &size, 0); sizeof(buf)/sizeof(WCHAR), &size, 0);
ok(hres == S_OK, "[%d] encoding failed: %08lx\n", i, hres); ok(hres == S_OK, "[%d] encoding failed: %08lx\n", i, hres);
......
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