Thomas Mullaly : urlmon: Added pluggable protocol support to CoInternetCombineUrlEx.
Alexandre Julliard
julliard at winehq.org
Mon Nov 15 13:28:53 CST 2010
Module: wine
Branch: master
Commit: 41c58b5a2a6ec3d164aad195a1807d0c1f8ff08c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=41c58b5a2a6ec3d164aad195a1807d0c1f8ff08c
Author: Thomas Mullaly <thomas.mullaly at gmail.com>
Date: Fri Nov 12 18:52:05 2010 -0500
urlmon: Added pluggable protocol support to CoInternetCombineUrlEx.
---
dlls/urlmon/tests/uri.c | 43 +++++++++++++++++++++++++++++++++++++++----
dlls/urlmon/uri.c | 16 ++++++++++++++++
2 files changed, 55 insertions(+), 4 deletions(-)
diff --git a/dlls/urlmon/tests/uri.c b/dlls/urlmon/tests/uri.c
index 7a148f3..d27d4ed 100644
--- a/dlls/urlmon/tests/uri.c
+++ b/dlls/urlmon/tests/uri.c
@@ -9255,8 +9255,6 @@ static void test_CoInternetCombineIUri_Pluggable(void) {
HRESULT hr;
IUri *base = NULL;
- register_protocols();
-
hr = pCreateUri(combine_baseW, 0, 0, &base);
ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
if(SUCCEEDED(hr)) {
@@ -9290,8 +9288,6 @@ static void test_CoInternetCombineIUri_Pluggable(void) {
if(relative) IUri_Release(relative);
}
if(base) IUri_Release(base);
-
- unregister_protocols();
}
static void test_CoInternetCombineUrlEx(void) {
@@ -9413,6 +9409,38 @@ static void test_CoInternetCombineUrlEx(void) {
}
}
+static void test_CoInternetCombineUrlEx_Pluggable(void) {
+ HRESULT hr;
+ IUri *base = NULL;
+
+ hr = pCreateUri(combine_baseW, 0, 0, &base);
+ ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
+ if(SUCCEEDED(hr)) {
+ IUri *result = NULL;
+
+ SET_EXPECT(CombineUrl);
+
+ hr = pCoInternetCombineUrlEx(base, combine_relativeW, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
+ &result, 0);
+ ok(hr == S_OK, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+
+ CHECK_CALLED(CombineUrl);
+
+ if(SUCCEEDED(hr)) {
+ BSTR received = NULL;
+ hr = IUri_GetAbsoluteUri(result, &received);
+ ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
+ if(SUCCEEDED(hr)) {
+ ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
+ wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
+ }
+ SysFreeString(received);
+ }
+ if(result) IUri_Release(result);
+ }
+ if(base) IUri_Release(base);
+}
+
START_TEST(uri) {
HMODULE hurlmon;
@@ -9501,6 +9529,13 @@ START_TEST(uri) {
trace("test CoInternetCombineUrlEx...\n");
test_CoInternetCombineUrlEx();
+ register_protocols();
+
trace("test CoInternetCombineIUri pluggable...\n");
test_CoInternetCombineIUri_Pluggable();
+
+ trace("test CoInternetCombineUrlEx Pluggable...\n");
+ test_CoInternetCombineUrlEx_Pluggable();
+
+ unregister_protocols();
}
diff --git a/dlls/urlmon/uri.c b/dlls/urlmon/uri.c
index 22829fa..61140c0 100644
--- a/dlls/urlmon/uri.c
+++ b/dlls/urlmon/uri.c
@@ -6028,6 +6028,7 @@ HRESULT WINAPI CoInternetCombineUrlEx(IUri *pBaseUri, LPCWSTR pwzRelativeUrl, DW
IUri *relative;
Uri *base;
HRESULT hr;
+ IInternetProtocolInfo *info;
TRACE("(%p %s %x %p %x) stub\n", pBaseUri, debugstr_w(pwzRelativeUrl), dwCombineFlags,
ppCombinedUri, (DWORD)dwReserved);
@@ -6053,6 +6054,21 @@ HRESULT WINAPI CoInternetCombineUrlEx(IUri *pBaseUri, LPCWSTR pwzRelativeUrl, DW
return E_NOTIMPL;
}
+ info = get_protocol_info(base->canon_uri);
+ if(info) {
+ WCHAR result[INTERNET_MAX_URL_LENGTH+1];
+ DWORD result_len = 0;
+
+ hr = IInternetProtocolInfo_CombineUrl(info, base->canon_uri, pwzRelativeUrl, dwCombineFlags,
+ result, INTERNET_MAX_URL_LENGTH+1, &result_len, 0);
+ IInternetProtocolInfo_Release(info);
+ if(SUCCEEDED(hr)) {
+ hr = CreateUri(result, Uri_CREATE_ALLOW_RELATIVE, 0, ppCombinedUri);
+ if(SUCCEEDED(hr))
+ return hr;
+ }
+ }
+
hr = CreateUri(pwzRelativeUrl, Uri_CREATE_ALLOW_RELATIVE, 0, &relative);
if(FAILED(hr)) {
*ppCombinedUri = NULL;
More information about the wine-cvs
mailing list