Thomas Mullaly : urlmon: Added pluggable protocol support to CoInternetGetSecurityUrlEx.
Alexandre Julliard
julliard at winehq.org
Fri Jan 21 11:08:19 CST 2011
Module: wine
Branch: master
Commit: 670c8503f779c67cb591b080ea97c9846e9d6789
URL: http://source.winehq.org/git/wine.git/?a=commit;h=670c8503f779c67cb591b080ea97c9846e9d6789
Author: Thomas Mullaly <thomas.mullaly at gmail.com>
Date: Tue Jan 18 23:33:56 2011 -0500
urlmon: Added pluggable protocol support to CoInternetGetSecurityUrlEx.
---
dlls/urlmon/sec_mgr.c | 58 +++++++++++++++++++++++++++++++++++++++++++
dlls/urlmon/tests/sec_mgr.c | 20 ++++++--------
2 files changed, 67 insertions(+), 11 deletions(-)
diff --git a/dlls/urlmon/sec_mgr.c b/dlls/urlmon/sec_mgr.c
index 89669f9..87b8fda 100644
--- a/dlls/urlmon/sec_mgr.c
+++ b/dlls/urlmon/sec_mgr.c
@@ -293,6 +293,59 @@ static HRESULT get_action_policy(DWORD zone, DWORD action, BYTE *policy, DWORD s
return hres;
}
+static HRESULT parse_security_uri(IUri *uri, PSUACTION action, IUri **result) {
+ WCHAR buf1[INTERNET_MAX_URL_LENGTH], buf2[INTERNET_MAX_URL_LENGTH];
+ LPWSTR url, tmp;
+ HRESULT hres;
+ DWORD len = 0;
+ BOOL use_url = FALSE;
+
+ url = buf1;
+ tmp = buf2;
+ *result = NULL;
+
+ hres = IUri_GetPropertyLength(uri, Uri_PROPERTY_ABSOLUTE_URI, &len, 0);
+ if(FAILED(hres))
+ return hres;
+
+ hres = CoInternetParseIUri(uri, PARSE_SECURITY_URL, 0, url, len+1, &len, 0);
+ if(hres == S_OK) {
+ use_url = TRUE;
+ while(TRUE) {
+ hres = CoInternetParseUrl(url, PARSE_SECURITY_URL, 0, tmp, len+1, &len, 0);
+ if(hres != S_OK || !strcmpW(url, tmp))
+ break;
+
+ if(url == buf1) {
+ url = buf2;
+ tmp = buf1;
+ } else {
+ url = buf1;
+ tmp = buf2;
+ }
+ }
+ }
+
+ if(action == PSU_DEFAULT) {
+ if(use_url) {
+ hres = CoInternetParseUrl(url, PARSE_SECURITY_DOMAIN, 0, tmp, len+1, &len, 0);
+ url = tmp;
+ } else {
+ hres = CoInternetParseIUri(uri, PARSE_SECURITY_DOMAIN, 0, url, len+1, &len, 0);
+ if(hres == S_OK)
+ use_url = TRUE;
+ }
+ }
+
+ if(use_url) {
+ hres = CreateUri(url, 0, 0, result);
+ if(FAILED(hres))
+ return hres;
+ }
+
+ return S_OK;
+}
+
/***********************************************************************
* InternetSecurityManager implementation
*
@@ -1344,6 +1397,11 @@ HRESULT WINAPI CoInternetGetSecurityUrlEx(IUri *pUri, IUri **ppSecUri, PSUACTION
if(!pUri || !ppSecUri)
return E_INVALIDARG;
+ /* Try to find the Security url using pluggable protocols first. */
+ hres = parse_security_uri(pUri, psuAction, ppSecUri);
+ if(FAILED(hres) || *ppSecUri)
+ return hres;
+
hres = IUri_GetScheme(pUri, (DWORD*)&scheme_type);
if(FAILED(hres))
return hres;
diff --git a/dlls/urlmon/tests/sec_mgr.c b/dlls/urlmon/tests/sec_mgr.c
index 4ab93c9..d5e7426 100644
--- a/dlls/urlmon/tests/sec_mgr.c
+++ b/dlls/urlmon/tests/sec_mgr.c
@@ -1045,9 +1045,9 @@ static void test_InternetGetSecurityUrlEx_Pluggable(void)
hr = pCoInternetGetSecurityUrlEx(uri, &result, PSU_DEFAULT, 0);
ok(hr == S_OK, "CoInternetGetSecurityUrlEx returned 0x%08x, expected S_OK\n", hr);
- todo_wine CHECK_CALLED(ParseUrl_SECURITY_URL_input);
- todo_wine CHECK_CALLED(ParseUrl_SECURITY_URL_expected);
- todo_wine CHECK_CALLED(ParseUrl_SECURITY_DOMAIN_expected);
+ CHECK_CALLED(ParseUrl_SECURITY_URL_input);
+ CHECK_CALLED(ParseUrl_SECURITY_URL_expected);
+ CHECK_CALLED(ParseUrl_SECURITY_DOMAIN_expected);
if(hr == S_OK) {
BSTR received = NULL;
@@ -1055,9 +1055,8 @@ static void test_InternetGetSecurityUrlEx_Pluggable(void)
hr = IUri_GetAbsoluteUri(result, &received);
ok(hr == S_OK, "GetAbsoluteUri returned 0x%08x\n", hr);
if(hr == S_OK) {
- todo_wine
- ok(!strcmp_w(security_expectedW, received), "Expected %s but got %s\n",
- wine_dbgstr_w(security_expectedW), wine_dbgstr_w(received));
+ ok(!strcmp_w(security_expectedW, received), "Expected %s but got %s\n",
+ wine_dbgstr_w(security_expectedW), wine_dbgstr_w(received));
}
SysFreeString(received);
}
@@ -1071,8 +1070,8 @@ static void test_InternetGetSecurityUrlEx_Pluggable(void)
hr = pCoInternetGetSecurityUrlEx(uri, &result, PSU_SECURITY_URL_ONLY, 0);
ok(hr == S_OK, "CoInternetGetSecurityUrlEx returned 0x%08x, expected S_OK\n", hr);
- todo_wine CHECK_CALLED(ParseUrl_SECURITY_URL_input);
- todo_wine CHECK_CALLED(ParseUrl_SECURITY_URL_expected);
+ CHECK_CALLED(ParseUrl_SECURITY_URL_input);
+ CHECK_CALLED(ParseUrl_SECURITY_URL_expected);
if(hr == S_OK) {
BSTR received = NULL;
@@ -1080,9 +1079,8 @@ static void test_InternetGetSecurityUrlEx_Pluggable(void)
hr = IUri_GetAbsoluteUri(result, &received);
ok(hr == S_OK, "GetAbsoluteUri returned 0x%08x\n", hr);
if(hr == S_OK) {
- todo_wine
- ok(!strcmp_w(security_expectedW, received), "Expected %s but got %s\n",
- wine_dbgstr_w(security_expectedW), wine_dbgstr_w(received));
+ ok(!strcmp_w(security_expectedW, received), "Expected %s but got %s\n",
+ wine_dbgstr_w(security_expectedW), wine_dbgstr_w(received));
}
SysFreeString(received);
}
More information about the wine-cvs
mailing list