From b3084d55e4ea0f45fee339905693d846083742c5 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 12 Sep 2005 10:10:52 +0000 Subject: [PATCH] Added PARSE_SECURITY_URL action implementation. --- dlls/urlmon/internet.c | 20 ++++++++++++++++++++ dlls/urlmon/tests/misc.c | 17 +++++++++++++---- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/dlls/urlmon/internet.c b/dlls/urlmon/internet.c index 22ff80d0a50..c602e8a347d 100644 --- a/dlls/urlmon/internet.c +++ b/dlls/urlmon/internet.c @@ -108,6 +108,24 @@ static IInternetProtocolInfo *get_protocol_info(LPCWSTR url) 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) { IInternetProtocolInfo *protocol_info; @@ -166,6 +184,8 @@ HRESULT WINAPI CoInternetParseUrl(LPCWSTR pwzUrl, PARSEACTION ParseAction, DWORD WARN("dwReserved = %ld\n", dwReserved); switch(ParseAction) { + 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_PATH_FROM_URL: diff --git a/dlls/urlmon/tests/misc.c b/dlls/urlmon/tests/misc.c index 96a77405529..ae2b730aa77 100644 --- a/dlls/urlmon/tests/misc.c +++ b/dlls/urlmon/tests/misc.c @@ -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 url4[] = {'f','i','l','e',':','s','o','m','e','%','2','0','f','i','l','e', '%','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', '.','j','p','g',0}; @@ -221,6 +223,7 @@ static const WCHAR wszEmpty[] = {0}; struct parse_test { LPCWSTR url; + HRESULT secur_hres; LPCWSTR encoded_url; HRESULT path_hres; LPCWSTR path; @@ -228,10 +231,10 @@ struct parse_test { }; static const struct parse_test parse_tests[] = { - {url1, url1, E_INVALIDARG, NULL, wszRes}, - {url2, url2, E_INVALIDARG, NULL, wszEmpty}, - {url3, url3, S_OK, path3, wszFile}, - {url4, url4e, S_OK, path4, wszFile} + {url1, S_OK, url1, E_INVALIDARG, NULL, wszRes}, + {url2, E_FAIL, url2, E_INVALIDARG, NULL, wszEmpty}, + {url3, E_FAIL, url3, S_OK, path3, wszFile}, + {url4, E_FAIL, url4e, S_OK, path4, wszFile} }; static void test_CoInternetParseUrl(void) @@ -248,6 +251,12 @@ static void test_CoInternetParseUrl(void) ok(hres == E_POINTER, "schema failed: %08lx, expected E_POINTER\n", hres); for(i=0; i < sizeof(parse_tests)/sizeof(parse_tests[0]); i++) { + 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, sizeof(buf)/sizeof(WCHAR), &size, 0);