From: Amine Khaldi Date: Mon, 4 Feb 2019 12:05:00 +0000 (+0100) Subject: [URLMON_WINETEST] Sync with Wine Staging 4.0. CORE-15682 X-Git-Tag: 0.4.13-dev~470 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=11d1bab6f30c3294258b83b942ae5c3dc2555f84 [URLMON_WINETEST] Sync with Wine Staging 4.0. CORE-15682 --- diff --git a/modules/rostests/winetests/urlmon/misc.c b/modules/rostests/winetests/urlmon/misc.c index e88c9604979..ff0f24ed764 100644 --- a/modules/rostests/winetests/urlmon/misc.c +++ b/modules/rostests/winetests/urlmon/misc.c @@ -85,7 +85,7 @@ static HRESULT (WINAPI *pIEInstallScope)(DWORD*); static int strcmp_wa(const WCHAR *strw, const char *stra) { WCHAR buf[512]; - MultiByteToWideChar(CP_ACP, 0, stra, -1, buf, sizeof(buf)/sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, stra, -1, buf, ARRAY_SIZE(buf)); return lstrcmpW(strw, buf); } @@ -367,23 +367,23 @@ static void test_CoInternetParseUrl(void) 3, &size, 0); ok(hres == E_POINTER, "schema failed: %08x, expected E_POINTER\n", hres); - for(i=0; i < sizeof(parse_tests)/sizeof(parse_tests[0]); i++) { + for(i = 0; i < ARRAY_SIZE(parse_tests); i++) { memset(buf, 0xf0, sizeof(buf)); hres = pCoInternetParseUrl(parse_tests[i].url, PARSE_SECURITY_URL, 0, buf, - sizeof(buf)/sizeof(WCHAR), &size, 0); + ARRAY_SIZE(buf), &size, 0); ok(hres == parse_tests[i].secur_hres, "[%d] security url failed: %08x, expected %08x\n", i, hres, parse_tests[i].secur_hres); memset(buf, 0xf0, sizeof(buf)); hres = pCoInternetParseUrl(parse_tests[i].url, PARSE_ENCODE, 0, buf, - sizeof(buf)/sizeof(WCHAR), &size, 0); + ARRAY_SIZE(buf), &size, 0); ok(hres == S_OK, "[%d] encoding failed: %08x\n", i, hres); ok(size == lstrlenW(parse_tests[i].encoded_url), "[%d] wrong size\n", i); ok(!lstrcmpW(parse_tests[i].encoded_url, buf), "[%d] wrong encoded url\n", i); memset(buf, 0xf0, sizeof(buf)); hres = pCoInternetParseUrl(parse_tests[i].url, PARSE_PATH_FROM_URL, 0, buf, - sizeof(buf)/sizeof(WCHAR), &size, 0); + ARRAY_SIZE(buf), &size, 0); ok(hres == parse_tests[i].path_hres, "[%d] path failed: %08x, expected %08x\n", i, hres, parse_tests[i].path_hres); if(parse_tests[i].path) { @@ -393,7 +393,7 @@ static void test_CoInternetParseUrl(void) memset(buf, 0xf0, sizeof(buf)); hres = pCoInternetParseUrl(parse_tests[i].url, PARSE_SCHEMA, 0, buf, - sizeof(buf)/sizeof(WCHAR), &size, 0); + ARRAY_SIZE(buf), &size, 0); ok(hres == S_OK, "[%d] schema failed: %08x\n", i, hres); ok(size == lstrlenW(parse_tests[i].schema), "[%d] wrong size\n", i); ok(!lstrcmpW(parse_tests[i].schema, buf), "[%d] wrong schema\n", i); @@ -402,7 +402,7 @@ static void test_CoInternetParseUrl(void) && memcmp(parse_tests[i].url, wszAbout, 5*sizeof(WCHAR))) { memset(buf, 0xf0, sizeof(buf)); hres = pCoInternetParseUrl(parse_tests[i].url, PARSE_DOMAIN, 0, buf, - sizeof(buf)/sizeof(WCHAR), &size, 0); + ARRAY_SIZE(buf), &size, 0); ok(hres == parse_tests[i].domain_hres, "[%d] domain failed: %08x\n", i, hres); if(parse_tests[i].domain) ok(!lstrcmpW(parse_tests[i].domain, buf), "[%d] wrong domain, received %s\n", i, wine_dbgstr_w(buf)); @@ -410,7 +410,7 @@ static void test_CoInternetParseUrl(void) memset(buf, 0xf0, sizeof(buf)); hres = pCoInternetParseUrl(parse_tests[i].url, PARSE_ROOTDOCUMENT, 0, buf, - sizeof(buf)/sizeof(WCHAR), &size, 0); + ARRAY_SIZE(buf), &size, 0); ok(hres == parse_tests[i].rootdocument_hres, "[%d] rootdocument failed: %08x\n", i, hres); if(parse_tests[i].rootdocument) ok(!lstrcmpW(parse_tests[i].rootdocument, buf), "[%d] wrong rootdocument, received %s\n", i, wine_dbgstr_w(buf)); @@ -451,7 +451,7 @@ static void test_CoInternetQueryInfo(void) DWORD cb, i; HRESULT hres; - for(i=0; i < sizeof(query_info_tests)/sizeof(query_info_tests[0]); i++) { + for(i = 0; i < ARRAY_SIZE(query_info_tests); i++) { cb = 0xdeadbeef; memset(buf, '?', sizeof(buf)); hres = pCoInternetQueryInfo(query_info_tests[0].url, QUERY_USES_NETWORK, 0, buf, sizeof(buf), &cb, 0); @@ -724,7 +724,7 @@ static void test_FindMimeFromData(void) static const WCHAR text_htmlW[] = {'t','e','x','t','/','h','t','m','l',0}; static const WCHAR text_plainW[] = {'t','e','x','t','/','p','l','a','i','n',0}; - for(i=0; isizeof(wszFile)/sizeof(WCHAR) && + ok(lstrlenW(sec_url) > ARRAY_SIZE(wszFile) && !memcmp(sec_url, wszFile, sizeof(wszFile)-sizeof(WCHAR)), "Encoded url = %s\n", wine_dbgstr_w(sec_url)); CoTaskMemFree(sec_url); @@ -1084,8 +1081,7 @@ static void test_NameSpace(void) hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest); ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres); - hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, sizeof(buf)/sizeof(WCHAR), - &size, 0); + hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, ARRAY_SIZE(buf), &size, 0); ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres); hres = IInternetSession_RegisterNameSpace(session, &test_protocol_cf2, &IID_NULL, @@ -1103,8 +1099,7 @@ static void test_NameSpace(void) SET_EXPECT(QI_IInternetProtocolInfo); SET_EXPECT(ParseUrl); - hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, sizeof(buf)/sizeof(WCHAR), - &size, 0); + hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, ARRAY_SIZE(buf), &size, 0); ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres); CHECK_CALLED(QI_IInternetProtocolInfo); @@ -1116,8 +1111,7 @@ static void test_NameSpace(void) SET_EXPECT(QI_IInternetProtocolInfo); SET_EXPECT(ParseUrl); - hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, sizeof(buf)/sizeof(WCHAR), - &size, 0); + hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, ARRAY_SIZE(buf), &size, 0); ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres); CHECK_CALLED(QI_IInternetProtocolInfo); @@ -1130,8 +1124,7 @@ static void test_NameSpace(void) SET_EXPECT(QI_IInternetProtocolInfo); SET_EXPECT(ParseUrl); - hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, sizeof(buf)/sizeof(WCHAR), - &size, 0); + hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, ARRAY_SIZE(buf), &size, 0); ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres); CHECK_CALLED(QI_IInternetProtocolInfo); @@ -1149,8 +1142,7 @@ static void test_NameSpace(void) hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf2, wszTest); ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres); - hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, sizeof(buf)/sizeof(WCHAR), - &size, 0); + hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, ARRAY_SIZE(buf), &size, 0); ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres); IInternetSession_Release(session); @@ -1627,7 +1619,7 @@ static void test_MkParseDisplayNameEx(void) CreateBindCtx(0, &bctx); - for (i = 0; i < sizeof(invalid_parameters)/sizeof(invalid_parameters[0]); i++) + for (i = 0; i < ARRAY_SIZE(invalid_parameters); i++) { eaten = 0xdeadbeef; mon = (IMoniker *)0xdeadbeef; @@ -1643,7 +1635,7 @@ static void test_MkParseDisplayNameEx(void) hres = MkParseDisplayNameEx(bctx, url9, &eaten, &mon); ok(hres == S_OK, "MkParseDisplayNameEx failed: %08x\n", hres); - ok(eaten == sizeof(url9)/sizeof(WCHAR)-1, "eaten=%d\n", eaten); + ok(eaten == ARRAY_SIZE(url9)-1, "eaten=%d\n", eaten); ok(mon != NULL, "mon == NULL\n"); hres = IMoniker_GetDisplayName(mon, NULL, 0, &name); @@ -1659,7 +1651,7 @@ static void test_MkParseDisplayNameEx(void) hres = MkParseDisplayNameEx(bctx, clsid_nameW, &eaten, &mon); ok(hres == S_OK, "MkParseDisplayNameEx failed: %08x\n", hres); - ok(eaten == sizeof(clsid_nameW)/sizeof(WCHAR)-1, "eaten=%d\n", eaten); + ok(eaten == ARRAY_SIZE(clsid_nameW)-1, "eaten=%d\n", eaten); ok(mon != NULL, "mon == NULL\n"); hres = IMoniker_IsSystemMoniker(mon, &issys); @@ -1733,7 +1725,7 @@ static void test_internet_feature_defaults(void) { HRESULT hres; DWORD i; - for(i = 0; i < sizeof(default_feature_tests)/sizeof(default_feature_tests[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(default_feature_tests); ++i) { hres = pCoInternetIsFeatureEnabled(default_feature_tests[i].feature, default_feature_tests[i].get_flags); todo_wine_if (default_feature_tests[i].todo) ok(hres == default_feature_tests[i].expected, "CoInternetIsFeatureEnabled returned %08x, expected %08x on test %d\n", @@ -1880,7 +1872,7 @@ static void test_CoInternetSetFeatureEnabled(void) { hres = pCoInternetSetFeatureEnabled(FEATURE_ENTRY_COUNT,SET_FEATURE_ON_PROCESS,TRUE); ok(hres == E_FAIL, "CoInternetSetFeatureEnabled returned %08x, expected E_FAIL\n", hres); - for(i = 0; i < sizeof(internet_feature_tests)/sizeof(internet_feature_tests[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(internet_feature_tests); ++i) { hres = pCoInternetSetFeatureEnabled(internet_feature_tests[i].feature, internet_feature_tests[i].set_flags, internet_feature_tests[i].enable); todo_wine_if (internet_feature_tests[i].set_todo) diff --git a/modules/rostests/winetests/urlmon/protocol.c b/modules/rostests/winetests/urlmon/protocol.c index d279694601a..6162a94fc8e 100644 --- a/modules/rostests/winetests/urlmon/protocol.c +++ b/modules/rostests/winetests/urlmon/protocol.c @@ -824,7 +824,7 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface, if (winetest_debug > 1) { - if (ulStatusCode < sizeof(status_names)/sizeof(status_names[0])) + if (ulStatusCode < ARRAY_SIZE(status_names)) trace( "progress: %s %s\n", status_names[ulStatusCode], wine_dbgstr_w(szStatusText) ); else trace( "progress: %u %s\n", ulStatusCode, wine_dbgstr_w(szStatusText) ); @@ -3057,55 +3057,55 @@ static void test_file_protocol(void) { test_file_protocol_url(index_url); memcpy(buf, wszFile, sizeof(wszFile)); - len = sizeof(wszFile)/sizeof(WCHAR)-1; - len += GetCurrentDirectoryW(sizeof(buf)/sizeof(WCHAR)-len, buf+len); + len = ARRAY_SIZE(wszFile)-1; + len += GetCurrentDirectoryW(ARRAY_SIZE(buf)-len, buf+len); buf[len++] = '\\'; memcpy(buf+len, wszIndexHtml, sizeof(wszIndexHtml)); - file_name = buf + sizeof(wszFile)/sizeof(WCHAR)-1; + file_name = buf + ARRAY_SIZE(wszFile)-1; bindf = 0; test_file_protocol_url(buf); bindf = BINDF_FROMURLMON; test_file_protocol_url(buf); memcpy(buf, wszFile2, sizeof(wszFile2)); - len = GetCurrentDirectoryW(sizeof(file_name_buf)/sizeof(WCHAR), file_name_buf); + len = GetCurrentDirectoryW(ARRAY_SIZE(file_name_buf), file_name_buf); file_name_buf[len++] = '\\'; memcpy(file_name_buf+len, wszIndexHtml, sizeof(wszIndexHtml)); - lstrcpyW(buf+sizeof(wszFile2)/sizeof(WCHAR)-1, file_name_buf); + lstrcpyW(buf+ARRAY_SIZE(wszFile2)-1, file_name_buf); file_name = file_name_buf; bindf = 0; test_file_protocol_url(buf); bindf = BINDF_FROMURLMON; test_file_protocol_url(buf); - buf[sizeof(wszFile2)/sizeof(WCHAR)] = '|'; + buf[ARRAY_SIZE(wszFile2)] = '|'; test_file_protocol_url(buf); memcpy(buf, wszFile3, sizeof(wszFile3)); - len = sizeof(wszFile3)/sizeof(WCHAR)-1; - len += GetCurrentDirectoryW(sizeof(buf)/sizeof(WCHAR)-len, buf+len); + len = ARRAY_SIZE(wszFile3)-1; + len += GetCurrentDirectoryW(ARRAY_SIZE(buf)-len, buf+len); buf[len++] = '\\'; memcpy(buf+len, wszIndexHtml, sizeof(wszIndexHtml)); - file_name = buf + sizeof(wszFile3)/sizeof(WCHAR)-1; + file_name = buf + ARRAY_SIZE(wszFile3)-1; bindf = 0; test_file_protocol_url(buf); bindf = BINDF_FROMURLMON; test_file_protocol_url(buf); memcpy(buf, wszFile4, sizeof(wszFile4)); - len = GetCurrentDirectoryW(sizeof(file_name_buf)/sizeof(WCHAR), file_name_buf); + len = GetCurrentDirectoryW(ARRAY_SIZE(file_name_buf), file_name_buf); file_name_buf[len++] = '\\'; memcpy(file_name_buf+len, wszIndexHtml, sizeof(wszIndexHtml)); - lstrcpyW(buf+sizeof(wszFile4)/sizeof(WCHAR)-1, file_name_buf); + lstrcpyW(buf+ARRAY_SIZE(wszFile4)-1, file_name_buf); file_name = file_name_buf; bindf = 0; test_file_protocol_url(buf); bindf = BINDF_FROMURLMON; test_file_protocol_url(buf); - buf[sizeof(wszFile4)/sizeof(WCHAR)] = '|'; + buf[ARRAY_SIZE(wszFile4)] = '|'; test_file_protocol_url(buf); /* Fragment part of URL is skipped if the file doesn't exist. */ diff --git a/modules/rostests/winetests/urlmon/sec_mgr.c b/modules/rostests/winetests/urlmon/sec_mgr.c index 7c57d9e375a..4d96eba6289 100644 --- a/modules/rostests/winetests/urlmon/sec_mgr.c +++ b/modules/rostests/winetests/urlmon/sec_mgr.c @@ -224,7 +224,7 @@ static LONG myRegDeleteTreeA(HKEY hKey, LPCSTR lpszSubKey) dwMaxSubkeyLen++; dwMaxValueLen++; dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen); - if (dwMaxLen > sizeof(szNameBuf)/sizeof(CHAR)) + if (dwMaxLen > ARRAY_SIZE(szNameBuf)) { /* Name too big: alloc a buffer for it */ if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen*sizeof(CHAR)))) @@ -384,7 +384,7 @@ static void test_SecurityManager(void) if(FAILED(hres)) return; - for(i=0; i < sizeof(secmgr_tests)/sizeof(secmgr_tests[0]); i++) { + for(i = 0; i < ARRAY_SIZE(secmgr_tests); i++) { zone = 100; hres = IInternetSecurityManager_MapUrlToZone(secmgr, secmgr_tests[i].url, &zone, 0); @@ -788,7 +788,7 @@ static BOOL register_zone_domains(void) res = RegOpenKeyA(HKEY_CURRENT_USER, szZoneMapDomainsKey, &domains); ok(res == ERROR_SUCCESS, "RegOpenKey failed: %d\n", res); - for(i = 0; i < sizeof(zone_domain_mappings)/sizeof(zone_domain_mappings[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(zone_domain_mappings); ++i) { const zone_domain_mapping *test = zone_domain_mappings+i; HKEY domain; @@ -833,7 +833,7 @@ static void unregister_zone_domains(void) res = RegOpenKeyA(HKEY_CURRENT_USER, szZoneMapDomainsKey, &domains); ok(res == ERROR_SUCCESS, "RegOpenKey failed: %d\n", res); - for(i = 0; i < sizeof(zone_domain_mappings)/sizeof(zone_domain_mappings[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(zone_domain_mappings); ++i) { const zone_domain_mapping *test = zone_domain_mappings+i; /* FIXME: Uses the "cludge" approach to remove the test data from the registry! @@ -939,7 +939,7 @@ static void test_zone_domain_mappings(void) RegCloseKey(domains); } - for(i = 0; i < sizeof(zone_mapping_tests)/sizeof(zone_mapping_tests[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(zone_mapping_tests); ++i) { const zone_mapping_test *test = zone_mapping_tests+i; LPWSTR urlW = a2w(test->url); zone = URLZONE_INVALID; @@ -1363,7 +1363,7 @@ static void test_InternetGetSecurityUrl(void) trace("testing CoInternetGetSecurityUrl...\n"); - for(i=0; iuri); +} + +static ULONG WINAPI custom_uri_Release(IUri *iface) +{ + struct custom_uri *uri = impl_from_IUri(iface); + return IUri_Release(uri->uri); +} + +static HRESULT WINAPI custom_uri_GetPropertyBSTR(IUri *iface, Uri_PROPERTY property, BSTR *value, DWORD flags) +{ + struct custom_uri *uri = impl_from_IUri(iface); + return IUri_GetPropertyBSTR(uri->uri, property, value, flags); +} + +static HRESULT WINAPI custom_uri_GetPropertyLength(IUri *iface, Uri_PROPERTY property, DWORD *length, DWORD flags) +{ + struct custom_uri *uri = impl_from_IUri(iface); + return IUri_GetPropertyLength(uri->uri, property, length, flags); +} + +static HRESULT WINAPI custom_uri_GetPropertyDWORD(IUri *iface, Uri_PROPERTY property, DWORD *value, DWORD flags) +{ + struct custom_uri *uri = impl_from_IUri(iface); + return IUri_GetPropertyDWORD(uri->uri, property, value, flags); +} + +static HRESULT WINAPI custom_uri_HasProperty(IUri *iface, Uri_PROPERTY property, BOOL *has_property) +{ + struct custom_uri *uri = impl_from_IUri(iface); + return IUri_HasProperty(uri->uri, property, has_property); +} + +static HRESULT WINAPI custom_uri_GetAbsoluteUri(IUri *iface, BSTR *value) +{ + struct custom_uri *uri = impl_from_IUri(iface); + return IUri_GetAbsoluteUri(uri->uri, value); +} + +static HRESULT WINAPI custom_uri_GetAuthority(IUri *iface, BSTR *value) +{ + struct custom_uri *uri = impl_from_IUri(iface); + return IUri_GetAbsoluteUri(uri->uri, value); +} + +static HRESULT WINAPI custom_uri_GetDisplayUri(IUri *iface, BSTR *value) +{ + struct custom_uri *uri = impl_from_IUri(iface); + return IUri_GetAbsoluteUri(uri->uri, value); +} + +static HRESULT WINAPI custom_uri_GetDomain(IUri *iface, BSTR *value) +{ + struct custom_uri *uri = impl_from_IUri(iface); + return IUri_GetAbsoluteUri(uri->uri, value); +} + +static HRESULT WINAPI custom_uri_GetExtension(IUri *iface, BSTR *value) +{ + struct custom_uri *uri = impl_from_IUri(iface); + return IUri_GetAbsoluteUri(uri->uri, value); +} + +static HRESULT WINAPI custom_uri_GetFragment(IUri *iface, BSTR *value) +{ + struct custom_uri *uri = impl_from_IUri(iface); + return IUri_GetAbsoluteUri(uri->uri, value); +} + +static HRESULT WINAPI custom_uri_GetHost(IUri *iface, BSTR *value) +{ + struct custom_uri *uri = impl_from_IUri(iface); + return IUri_GetAbsoluteUri(uri->uri, value); +} + +static HRESULT WINAPI custom_uri_GetPassword(IUri *iface, BSTR *value) +{ + struct custom_uri *uri = impl_from_IUri(iface); + return IUri_GetAbsoluteUri(uri->uri, value); +} + +static HRESULT WINAPI custom_uri_GetPath(IUri *iface, BSTR *value) +{ + struct custom_uri *uri = impl_from_IUri(iface); + return IUri_GetAbsoluteUri(uri->uri, value); +} + +static HRESULT WINAPI custom_uri_GetPathAndQuery(IUri *iface, BSTR *value) +{ + struct custom_uri *uri = impl_from_IUri(iface); + return IUri_GetAbsoluteUri(uri->uri, value); +} + +static HRESULT WINAPI custom_uri_GetQuery(IUri *iface, BSTR *value) +{ + struct custom_uri *uri = impl_from_IUri(iface); + return IUri_GetAbsoluteUri(uri->uri, value); +} + +static HRESULT WINAPI custom_uri_GetRawUri(IUri *iface, BSTR *value) +{ + struct custom_uri *uri = impl_from_IUri(iface); + return IUri_GetAbsoluteUri(uri->uri, value); +} + +static HRESULT WINAPI custom_uri_GetSchemeName(IUri *iface, BSTR *value) +{ + struct custom_uri *uri = impl_from_IUri(iface); + return IUri_GetSchemeName(uri->uri, value); +} + +static HRESULT WINAPI custom_uri_GetUserInfo(IUri *iface, BSTR *value) +{ + struct custom_uri *uri = impl_from_IUri(iface); + return IUri_GetUserInfo(uri->uri, value); +} + +static HRESULT WINAPI custom_uri_GetUserName(IUri *iface, BSTR *value) +{ + struct custom_uri *uri = impl_from_IUri(iface); + return IUri_GetUserName(uri->uri, value); +} + +static HRESULT WINAPI custom_uri_GetHostType(IUri *iface, DWORD *value) +{ + struct custom_uri *uri = impl_from_IUri(iface); + return IUri_GetHostType(uri->uri, value); +} + +static HRESULT WINAPI custom_uri_GetPort(IUri *iface, DWORD *value) +{ + struct custom_uri *uri = impl_from_IUri(iface); + return IUri_GetPort(uri->uri, value); +} + +static HRESULT WINAPI custom_uri_GetScheme(IUri *iface, DWORD *value) +{ + struct custom_uri *uri = impl_from_IUri(iface); + return IUri_GetScheme(uri->uri, value); +} + +static HRESULT WINAPI custom_uri_GetZone(IUri *iface, DWORD *value) +{ + struct custom_uri *uri = impl_from_IUri(iface); + return IUri_GetZone(uri->uri, value); +} + +static HRESULT WINAPI custom_uri_GetProperties(IUri *iface, DWORD *flags) +{ + struct custom_uri *uri = impl_from_IUri(iface); + return IUri_GetProperties(uri->uri, flags); +} + +static HRESULT WINAPI custom_uri_IsEqual(IUri *iface, IUri *pUri, BOOL *is_equal) +{ + struct custom_uri *uri = impl_from_IUri(iface); + return IUri_IsEqual(uri->uri, pUri, is_equal); +} + +static const IUriVtbl custom_uri_vtbl = +{ + custom_uri_QueryInterface, + custom_uri_AddRef, + custom_uri_Release, + custom_uri_GetPropertyBSTR, + custom_uri_GetPropertyLength, + custom_uri_GetPropertyDWORD, + custom_uri_HasProperty, + custom_uri_GetAbsoluteUri, + custom_uri_GetAuthority, + custom_uri_GetDisplayUri, + custom_uri_GetDomain, + custom_uri_GetExtension, + custom_uri_GetFragment, + custom_uri_GetHost, + custom_uri_GetPassword, + custom_uri_GetPath, + custom_uri_GetPathAndQuery, + custom_uri_GetQuery, + custom_uri_GetRawUri, + custom_uri_GetSchemeName, + custom_uri_GetUserInfo, + custom_uri_GetUserName, + custom_uri_GetHostType, + custom_uri_GetPort, + custom_uri_GetScheme, + custom_uri_GetZone, + custom_uri_GetProperties, + custom_uri_IsEqual, +}; + static void test_IUri_IsEqual(void) { + struct custom_uri custom_uri; IUri *uriA, *uriB; BOOL equal; HRESULT hres; @@ -8537,10 +8756,22 @@ static void test_IUri_IsEqual(void) { hres = IUri_IsEqual(uriA, uriB, NULL); ok(hres == E_POINTER, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, E_POINTER); + equal = FALSE; + hres = IUri_IsEqual(uriA, uriA, &equal); + ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, S_OK); + ok(equal, "Error: Expected equal URIs.\n"); + + equal = FALSE; + hres = IUri_IsEqual(uriA, uriB, &equal); + ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, S_OK); + ok(equal, "Error: Expected equal URIs.\n"); + IUri_Release(uriA); IUri_Release(uriB); - for(i = 0; i < sizeof(equality_tests)/sizeof(equality_tests[0]); ++i) { + custom_uri.IUri_iface.lpVtbl = &custom_uri_vtbl; + + for(i = 0; i < ARRAY_SIZE(equality_tests); ++i) { uri_equality test = equality_tests[i]; LPWSTR uriA_W, uriB_W; @@ -8561,6 +8792,16 @@ static void test_IUri_IsEqual(void) { ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres, S_OK, i); ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i); } + + custom_uri.uri = uriB; + + equal = -1; + hres = IUri_IsEqual(uriA, &custom_uri.IUri_iface, &equal); + todo_wine { + ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres, S_OK, i); + ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i); + } + if(uriA) IUri_Release(uriA); if(uriB) IUri_Release(uriB); @@ -8592,7 +8833,7 @@ static void test_CreateUriWithFragment_InvalidArgs(void) { static void test_CreateUriWithFragment_InvalidFlags(void) { DWORD i; - for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(invalid_flag_tests); ++i) { HRESULT hr; IUri *uri = (void*) 0xdeadbeef; @@ -8606,7 +8847,7 @@ static void test_CreateUriWithFragment_InvalidFlags(void) { static void test_CreateUriWithFragment(void) { DWORD i; - for(i = 0; i < sizeof(uri_fragment_tests)/sizeof(uri_fragment_tests[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(uri_fragment_tests); ++i) { HRESULT hr; IUri *uri = NULL; LPWSTR uriW, fragW; @@ -8685,7 +8926,7 @@ static void test_IUriBuilder_CreateUri(IUriBuilder *builder, const uri_builder_t if(SUCCEEDED(hr)) { DWORD i; - for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(test->expected_str_props); ++i) { uri_builder_str_property prop = test->expected_str_props[i]; BSTR received = NULL; @@ -8703,7 +8944,7 @@ static void test_IUriBuilder_CreateUri(IUriBuilder *builder, const uri_builder_t SysFreeString(received); } - for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(test->expected_dword_props); ++i) { uri_builder_dword_property prop = test->expected_dword_props[i]; DWORD received = -2; @@ -8737,7 +8978,7 @@ static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_bui if(SUCCEEDED(hr)) { DWORD i; - for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(test->expected_str_props); ++i) { uri_builder_str_property prop = test->expected_str_props[i]; BSTR received = NULL; @@ -8755,7 +8996,7 @@ static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_bui SysFreeString(received); } - for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(test->expected_dword_props); ++i) { uri_builder_dword_property prop = test->expected_dword_props[i]; DWORD received = -2; @@ -8790,7 +9031,7 @@ static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_ if(SUCCEEDED(hr)) { DWORD i; - for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(test->expected_str_props); ++i) { uri_builder_str_property prop = test->expected_str_props[i]; BSTR received = NULL; @@ -8808,7 +9049,7 @@ static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_ SysFreeString(received); } - for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(test->expected_dword_props); ++i) { uri_builder_dword_property prop = test->expected_dword_props[i]; DWORD received = -2; @@ -9051,7 +9292,7 @@ static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder const uri_builder_property *prop = NULL; /* Check if the property was set earlier. */ - for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(test->properties); ++i) { if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_FRAGMENT) prop = &(test->properties[i]); } @@ -9146,7 +9387,7 @@ static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_tes const uri_builder_property *prop = NULL; /* Check if the property was set earlier. */ - for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(test->properties); ++i) { if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_HOST) prop = &(test->properties[i]); } @@ -9241,7 +9482,7 @@ static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder const uri_builder_property *prop = NULL; /* Check if the property was set earlier. */ - for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(test->properties); ++i) { if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PASSWORD) prop = &(test->properties[i]); } @@ -9336,7 +9577,7 @@ static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_tes const uri_builder_property *prop = NULL; /* Check if the property was set earlier. */ - for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(test->properties); ++i) { if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PATH) prop = &(test->properties[i]); } @@ -9498,7 +9739,7 @@ static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_te const uri_builder_property *prop = NULL; /* Check if the property was set earlier. */ - for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(test->properties); ++i) { if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_QUERY) prop = &(test->properties[i]); } @@ -9593,7 +9834,7 @@ static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_build const uri_builder_property *prop = NULL; /* Check if the property was set earlier. */ - for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(test->properties); ++i) { if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_SCHEME_NAME) prop = &(test->properties[i]); } @@ -9688,7 +9929,7 @@ static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder const uri_builder_property *prop = NULL; /* Check if the property was set earlier. */ - for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(test->properties); ++i) { if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_USER_NAME) prop = &(test->properties[i]); } @@ -9780,7 +10021,7 @@ static void test_IUriBuilder(void) { IUriBuilder *builder; DWORD i; - for(i = 0; i < sizeof(uri_builder_tests)/sizeof(uri_builder_tests[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(uri_builder_tests); ++i) { IUri *uri = NULL; uri_builder_test test = uri_builder_tests[i]; LPWSTR uriW = NULL; @@ -10132,7 +10373,7 @@ static void test_IUriBuilder_RemoveProperties(void) { } if(builder) IUriBuilder_Release(builder); - for(i = 0; i < sizeof(uri_builder_remove_tests)/sizeof(uri_builder_remove_tests[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(uri_builder_remove_tests); ++i) { uri_builder_remove_test test = uri_builder_remove_tests[i]; IUri *uri = NULL; LPWSTR uriW; @@ -10288,7 +10529,7 @@ static void test_IUriBuilderFactory(void) { ok(hr == S_OK, "Error: GetIUri return 0x%08x, expected 0x%08x.\n", hr, S_OK); ok(tmp == uri, "Error: Expected tmp to be %p, but was %p.\n", uri, tmp); - if(uri) IUri_Release(uri); + if(tmp) IUri_Release(tmp); } if(builder) IUriBuilder_Release(builder); } @@ -10328,7 +10569,7 @@ static void test_CoInternetCombineIUri(void) { if(base) IUri_Release(base); if(relative) IUri_Release(relative); - for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(uri_combine_tests); ++i) { LPWSTR baseW = a2w(uri_combine_tests[i].base_uri); hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base); @@ -10349,7 +10590,7 @@ static void test_CoInternetCombineIUri(void) { if(SUCCEEDED(hr)) { DWORD j; - for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) { + for(j = 0; j < ARRAY_SIZE(uri_combine_tests[i].str_props); ++j) { uri_combine_str_property prop = uri_combine_tests[i].str_props[j]; BSTR received; @@ -10366,7 +10607,7 @@ static void test_CoInternetCombineIUri(void) { SysFreeString(received); } - for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) { + for(j = 0; j < ARRAY_SIZE(uri_combine_tests[i].dword_props); ++j) { uri_dword_property prop = uri_combine_tests[i].dword_props[j]; DWORD received; @@ -10619,7 +10860,7 @@ static void test_CoInternetCombineUrlEx(void) { hr, E_POINTER); if(base) IUri_Release(base); - for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(uri_combine_tests); ++i) { LPWSTR baseW = a2w(uri_combine_tests[i].base_uri); hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base); @@ -10636,7 +10877,7 @@ static void test_CoInternetCombineUrlEx(void) { if(SUCCEEDED(hr)) { DWORD j; - for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) { + for(j = 0; j < ARRAY_SIZE(uri_combine_tests[i].str_props); ++j) { uri_combine_str_property prop = uri_combine_tests[i].str_props[j]; BSTR received; LPCSTR value = (prop.value_ex) ? prop.value_ex : prop.value; @@ -10654,7 +10895,7 @@ static void test_CoInternetCombineUrlEx(void) { SysFreeString(received); } - for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) { + for(j = 0; j < ARRAY_SIZE(uri_combine_tests[i].dword_props); ++j) { uri_dword_property prop = uri_combine_tests[i].dword_props[j]; DWORD received; @@ -10776,7 +11017,7 @@ static void test_CoInternetParseIUri_InvalidArgs(void) { len = INTERNET_MAX_URL_LENGTH*2; longurl = heap_alloc((len+1)*sizeof(WCHAR)); memcpy(longurl, http_urlW, sizeof(http_urlW)); - for(i = sizeof(http_urlW)/sizeof(WCHAR)-1; i < len; i++) + for(i = ARRAY_SIZE(http_urlW)-1; i < len; i++) longurl[i] = 'x'; longurl[len] = 0; @@ -10803,7 +11044,7 @@ static void test_CoInternetParseIUri_InvalidArgs(void) { static void test_CoInternetParseIUri(void) { DWORD i; - for(i = 0; i < sizeof(uri_parse_tests)/sizeof(uri_parse_tests[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(uri_parse_tests); ++i) { HRESULT hr; IUri *uri; LPWSTR uriW; @@ -11001,7 +11242,7 @@ static void test_CreateURLMoniker(void) IUri *uri, *base_uri; HRESULT hres; - for(test = create_urlmon_tests; test < create_urlmon_tests + sizeof(create_urlmon_tests)/sizeof(*create_urlmon_tests); test++) { + for(test = create_urlmon_tests; test < create_urlmon_tests + ARRAY_SIZE(create_urlmon_tests); test++) { url = a2w(test->url); base_url = a2w(test->base_url); @@ -11100,7 +11341,7 @@ static void test_IPersistStream(void) props_order[Uri_PROPERTY_SCHEME_NAME] = 8; props_order[Uri_PROPERTY_USER_NAME] = 9; - for(i=0; i