urlmon: Added pluggable protocol support to CoInternetCombineUrlEx.

This commit is contained in:
Thomas Mullaly 2010-11-12 18:52:05 -05:00 committed by Alexandre Julliard
parent 90738c3464
commit 41c58b5a2a
2 changed files with 55 additions and 4 deletions

View File

@ -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();
}

View File

@ -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;