[URLMON_WINETEST] Sync with Wine Staging 4.0. CORE-15682
authorAmine Khaldi <amine.khaldi@reactos.org>
Mon, 4 Feb 2019 12:05:00 +0000 (13:05 +0100)
committerAmine Khaldi <amine.khaldi@reactos.org>
Mon, 4 Feb 2019 12:05:00 +0000 (13:05 +0100)
modules/rostests/winetests/urlmon/misc.c
modules/rostests/winetests/urlmon/protocol.c
modules/rostests/winetests/urlmon/sec_mgr.c
modules/rostests/winetests/urlmon/uri.c
modules/rostests/winetests/urlmon/url.c

index e88c960..ff0f24e 100644 (file)
@@ -85,7 +85,7 @@ static HRESULT (WINAPI *pIEInstallScope)(DWORD*);
 static int strcmp_wa(const WCHAR *strw, const char *stra)
 {
     WCHAR buf[512];
 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);
 }
 
     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);
 
             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,
         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,
         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,
         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) {
         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,
 
         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);
         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,
                 && 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));
             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,
 
         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));
         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;
 
     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);
         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};
 
     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; i<sizeof(mime_tests)/sizeof(mime_tests[0]); i++) {
+    for(i = 0; i < ARRAY_SIZE(mime_tests); i++) {
         mime = (LPWSTR)0xf0f0f0f0;
         url = a2w(mime_tests[i].url);
         hres = pFindMimeFromData(NULL, url, NULL, 0, NULL, 0, &mime, 0);
         mime = (LPWSTR)0xf0f0f0f0;
         url = a2w(mime_tests[i].url);
         hres = pFindMimeFromData(NULL, url, NULL, 0, NULL, 0, &mime, 0);
@@ -757,7 +757,7 @@ static void test_FindMimeFromData(void)
         heap_free(url);
     }
 
         heap_free(url);
     }
 
-    for(i=0; i < sizeof(mime_tests2)/sizeof(mime_tests2[0]); i++) {
+    for(i = 0; i < ARRAY_SIZE(mime_tests2); i++) {
         url = a2w(mime_tests2[i].url);
         proposed_mime = a2w(mime_tests2[i].proposed_mime);
         hres = pFindMimeFromData(NULL, url, mime_tests2[i].data, mime_tests2[i].size,
         url = a2w(mime_tests2[i].url);
         proposed_mime = a2w(mime_tests2[i].proposed_mime);
         hres = pFindMimeFromData(NULL, url, mime_tests2[i].data, mime_tests2[i].size,
@@ -879,9 +879,9 @@ static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface
 
     if(ParseAction == PARSE_SECURITY_URL) {
         if(pcchResult)
 
     if(ParseAction == PARSE_SECURITY_URL) {
         if(pcchResult)
-            *pcchResult = sizeof(url1)/sizeof(WCHAR);
+            *pcchResult = ARRAY_SIZE(url1);
 
 
-        if(cchResult<sizeof(url1)/sizeof(WCHAR))
+        if(cchResult < ARRAY_SIZE(url1))
             return S_FALSE;
 
         memcpy(pwzResult, url1, sizeof(url1));
             return S_FALSE;
 
         memcpy(pwzResult, url1, sizeof(url1));
@@ -1032,8 +1032,7 @@ static void test_NameSpace(void)
     SET_EXPECT(CreateInstance);
     SET_EXPECT(ParseUrl);
 
     SET_EXPECT(CreateInstance);
     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);
     ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
 
     CHECK_CALLED(QI_IInternetProtocolInfo);
@@ -1044,8 +1043,7 @@ static void test_NameSpace(void)
     SET_EXPECT(QI_IInternetProtocolInfo);
     SET_EXPECT(ParseUrl);
 
     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);
     ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
 
     CHECK_CALLED(QI_IInternetProtocolInfo);
@@ -1054,11 +1052,10 @@ static void test_NameSpace(void)
     SET_EXPECT(QI_IInternetProtocolInfo);
     SET_EXPECT(ParseUrl);
 
     SET_EXPECT(QI_IInternetProtocolInfo);
     SET_EXPECT(ParseUrl);
 
-    hres = pCoInternetParseUrl(url8, PARSE_SECURITY_URL, 0, buf,
-            sizeof(buf)/sizeof(WCHAR), &size, 0);
+    hres = pCoInternetParseUrl(url8, PARSE_SECURITY_URL, 0, buf, ARRAY_SIZE(buf), &size, 0);
     ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
     ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
-    ok(size == sizeof(url1)/sizeof(WCHAR), "Size = %d\n", size);
-    if(size == sizeof(url1)/sizeof(WCHAR))
+    ok(size == ARRAY_SIZE(url1), "Size = %d\n", size);
+    if(size == ARRAY_SIZE(url1))
         ok(!memcmp(buf, url1, sizeof(url1)), "Encoded url = %s\n", wine_dbgstr_w(buf));
 
     CHECK_CALLED(QI_IInternetProtocolInfo);
         ok(!memcmp(buf, url1, sizeof(url1)), "Encoded url = %s\n", wine_dbgstr_w(buf));
 
     CHECK_CALLED(QI_IInternetProtocolInfo);
@@ -1071,7 +1068,7 @@ static void test_NameSpace(void)
         hres = pCoInternetGetSecurityUrl(url8, &sec_url, PSU_SECURITY_URL_ONLY, 0);
         ok(hres == S_OK, "CoInternetGetSecurityUrl failed: %08x\n", hres);
         if(hres == S_OK) {
         hres = pCoInternetGetSecurityUrl(url8, &sec_url, PSU_SECURITY_URL_ONLY, 0);
         ok(hres == S_OK, "CoInternetGetSecurityUrl failed: %08x\n", hres);
         if(hres == S_OK) {
-            ok(lstrlenW(sec_url)>sizeof(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);
                     !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 = 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,
     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);
 
     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);
     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);
 
     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);
     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);
 
     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);
     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 = 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);
     ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
 
     IInternetSession_Release(session);
@@ -1627,7 +1619,7 @@ static void test_MkParseDisplayNameEx(void)
 
     CreateBindCtx(0, &bctx);
 
 
     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;
     {
         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);
 
     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);
     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);
 
     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);
     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;
 
     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",
         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);
 
     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)
         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)
index d279694..6162a94 100644 (file)
@@ -824,7 +824,7 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface,
 
     if (winetest_debug > 1)
     {
 
     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) );
             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));
     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));
 
     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));
     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));
     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);
 
     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));
     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));
 
     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));
     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));
     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);
 
     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. */
     test_file_protocol_url(buf);
 
     /* Fragment part of URL is skipped if the file doesn't exist. */
index 7c57d9e..4d96eba 100644 (file)
@@ -224,7 +224,7 @@ static LONG myRegDeleteTreeA(HKEY hKey, LPCSTR lpszSubKey)
     dwMaxSubkeyLen++;
     dwMaxValueLen++;
     dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
     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))))
     {
         /* 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;
 
     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);
         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);
 
     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;
 
         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);
 
     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!
         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);
     }
 
         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;
         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");
 
 
     trace("testing CoInternetGetSecurityUrl...\n");
 
-    for(i=0; i<sizeof(in)/sizeof(WCHAR*); i++) {
+    for(i = 0; i < ARRAY_SIZE(in); i++) {
         hres = pCoInternetGetSecurityUrl(in[i], &sec, PSU_DEFAULT, 0);
         ok(hres == S_OK, "(%d) CoInternetGetSecurityUrl returned: %08x\n", i, hres);
         if(hres == S_OK) {
         hres = pCoInternetGetSecurityUrl(in[i], &sec, PSU_DEFAULT, 0);
         ok(hres == S_OK, "(%d) CoInternetGetSecurityUrl returned: %08x\n", i, hres);
         if(hres == S_OK) {
@@ -1628,7 +1628,7 @@ static void test_InternetGetSecurityUrlEx(void)
     ok(hr == E_INVALIDARG, "CoInternetGetSecurityUrlEx returned 0x%08x, expected E_INVALIDARG\n", hr);
     ok(result == (void*) 0xdeadbeef, "'result' was %p\n", result);
 
     ok(hr == E_INVALIDARG, "CoInternetGetSecurityUrlEx returned 0x%08x, expected E_INVALIDARG\n", hr);
     ok(result == (void*) 0xdeadbeef, "'result' was %p\n", result);
 
-    for(i = 0; i < sizeof(sec_url_ex_tests)/sizeof(sec_url_ex_tests[0]); ++i) {
+    for(i = 0; i < ARRAY_SIZE(sec_url_ex_tests); ++i) {
         LPWSTR uriW = a2w(sec_url_ex_tests[i].uri);
         uri = NULL;
 
         LPWSTR uriW = a2w(sec_url_ex_tests[i].uri);
         uri = NULL;
 
@@ -1830,7 +1830,7 @@ static void test_SecurityManagerEx2(void)
 
     IUri_Release(uri);
 
 
     IUri_Release(uri);
 
-    for(i = 0; i < sizeof(sec_mgr_ex2_tests)/sizeof(sec_mgr_ex2_tests[0]); ++i) {
+    for(i = 0; i < ARRAY_SIZE(sec_mgr_ex2_tests); ++i) {
         LPWSTR uriW = a2w(sec_mgr_ex2_tests[i].uri);
 
         uri = NULL;
         LPWSTR uriW = a2w(sec_mgr_ex2_tests[i].uri);
 
         uri = NULL;
@@ -1928,7 +1928,7 @@ static void test_CoInternetIsFeatureZoneElevationEnabled(void)
 
     trace("Testing CoInternetIsFeatureZoneElevationEnabled... (%x)\n", hres);
 
 
     trace("Testing CoInternetIsFeatureZoneElevationEnabled... (%x)\n", hres);
 
-    for(i=0; i<sizeof(testcases)/sizeof(testcases[0]); i++) {
+    for(i = 0; i < ARRAY_SIZE(testcases); i++) {
         if(hres==S_OK && testcases[i].flags == GET_FEATURE_FROM_PROCESS)
             testcases[i].policy_flags = URLPOLICY_ALLOW;
     }
         if(hres==S_OK && testcases[i].flags == GET_FEATURE_FROM_PROCESS)
             testcases[i].policy_flags = URLPOLICY_ALLOW;
     }
@@ -1943,7 +1943,7 @@ static void test_CoInternetIsFeatureZoneElevationEnabled(void)
         return;
     }
 
         return;
     }
 
-    for(i=0; i<sizeof(testcases)/sizeof(testcases[0]); i++) {
+    for(i = 0; i < ARRAY_SIZE(testcases); i++) {
         url_from = a2w(testcases[i].url_from);
         url_to = a2w(testcases[i].url_to);
 
         url_from = a2w(testcases[i].url_from);
         url_to = a2w(testcases[i].url_to);
 
index 90f51bf..9069a9c 100644 (file)
@@ -7786,7 +7786,7 @@ static void change_property(IUriBuilder *builder, const uri_builder_property *pr
 static void test_CreateUri_InvalidFlags(void) {
     DWORD i;
 
 static void test_CreateUri_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;
 
         HRESULT hr;
         IUri *uri = (void*) 0xdeadbeef;
 
@@ -7825,7 +7825,7 @@ static void test_CreateUri_InvalidArgs(void) {
 static void test_CreateUri_InvalidUri(void) {
     DWORD i;
 
 static void test_CreateUri_InvalidUri(void) {
     DWORD i;
 
-    for(i = 0; i < sizeof(invalid_uri_tests)/sizeof(invalid_uri_tests[0]); ++i) {
+    for(i = 0; i < ARRAY_SIZE(invalid_uri_tests); ++i) {
         invalid_uri test = invalid_uri_tests[i];
         IUri *uri = NULL;
         LPWSTR uriW;
         invalid_uri test = invalid_uri_tests[i];
         IUri *uri = NULL;
         LPWSTR uriW;
@@ -7877,7 +7877,7 @@ static void test_IUri_GetPropertyBSTR(void) {
     }
     if(uri) IUri_Release(uri);
 
     }
     if(uri) IUri_Release(uri);
 
-    for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
+    for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
         uri_properties test = uri_tests[i];
         LPWSTR uriW;
         uri = NULL;
         uri_properties test = uri_tests[i];
         LPWSTR uriW;
         uri = NULL;
@@ -7937,7 +7937,7 @@ static void test_IUri_GetPropertyDWORD(void) {
     }
     if(uri) IUri_Release(uri);
 
     }
     if(uri) IUri_Release(uri);
 
-    for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
+    for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
         uri_properties test = uri_tests[i];
         LPWSTR uriW;
         uri = NULL;
         uri_properties test = uri_tests[i];
         LPWSTR uriW;
         uri = NULL;
@@ -7952,7 +7952,7 @@ static void test_IUri_GetPropertyDWORD(void) {
             DWORD j;
 
             /* Checks all the DWORD properties of the uri. */
             DWORD j;
 
             /* Checks all the DWORD properties of the uri. */
-            for(j = 0; j < sizeof(test.dword_props)/sizeof(test.dword_props[0]); ++j) {
+            for(j = 0; j < ARRAY_SIZE(test.dword_props); ++j) {
                 DWORD received;
                 uri_dword_property prop = test.dword_props[j];
 
                 DWORD received;
                 uri_dword_property prop = test.dword_props[j];
 
@@ -8029,7 +8029,7 @@ static void test_IUri_GetStrProperties(void) {
     }
     if(uri) IUri_Release(uri);
 
     }
     if(uri) IUri_Release(uri);
 
-    for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
+    for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
         uri_properties test = uri_tests[i];
         LPWSTR uriW;
         uri = NULL;
         uri_properties test = uri_tests[i];
         LPWSTR uriW;
         uri = NULL;
@@ -8257,7 +8257,7 @@ static void test_IUri_GetDwordProperties(void) {
     }
     if(uri) IUri_Release(uri);
 
     }
     if(uri) IUri_Release(uri);
 
-    for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
+    for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
         uri_properties test = uri_tests[i];
         LPWSTR uriW;
         uri = NULL;
         uri_properties test = uri_tests[i];
         LPWSTR uriW;
         uri = NULL;
@@ -8343,7 +8343,7 @@ static void test_IUri_GetPropertyLength(void) {
     }
     if(uri) IUri_Release(uri);
 
     }
     if(uri) IUri_Release(uri);
 
-    for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
+    for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
         uri_properties test = uri_tests[i];
         LPWSTR uriW;
         uri = NULL;
         uri_properties test = uri_tests[i];
         LPWSTR uriW;
         uri = NULL;
@@ -8366,6 +8366,7 @@ static void test_IUri_GetPropertyLength(void) {
                 /* Value may be unicode encoded */
                 expectedValueW = a2w(prop.value);
                 expectedLen = lstrlenW(expectedValueW);
                 /* Value may be unicode encoded */
                 expectedValueW = a2w(prop.value);
                 expectedLen = lstrlenW(expectedValueW);
+                heap_free(expectedValueW);
 
                 /* This won't be necessary once GetPropertyLength is implemented. */
                 receivedLen = -1;
 
                 /* This won't be necessary once GetPropertyLength is implemented. */
                 receivedLen = -1;
@@ -8426,7 +8427,7 @@ static void test_IUri_GetProperties(void) {
     }
     if(uri) IUri_Release(uri);
 
     }
     if(uri) IUri_Release(uri);
 
-    for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
+    for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
         uri_properties test = uri_tests[i];
         LPWSTR uriW;
         uri = NULL;
         uri_properties test = uri_tests[i];
         LPWSTR uriW;
         uri = NULL;
@@ -8475,7 +8476,7 @@ static void test_IUri_HasProperty(void) {
     }
     if(uri) IUri_Release(uri);
 
     }
     if(uri) IUri_Release(uri);
 
-    for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
+    for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
         uri_properties test = uri_tests[i];
         LPWSTR uriW;
         uri = NULL;
         uri_properties test = uri_tests[i];
         LPWSTR uriW;
         uri = NULL;
@@ -8515,7 +8516,225 @@ static void test_IUri_HasProperty(void) {
     }
 }
 
     }
 }
 
+struct custom_uri {
+    IUri IUri_iface;
+    IUri *uri;
+};
+
+static inline struct custom_uri* impl_from_IUri(IUri *iface)
+{
+    return CONTAINING_RECORD(iface, struct custom_uri, IUri_iface);
+}
+
+static HRESULT WINAPI custom_uri_QueryInterface(IUri *iface, REFIID iid, void **out)
+{
+    if (IsEqualIID(iid, &IID_IUri) || IsEqualIID(iid, &IID_IUnknown))
+    {
+       *out = iface;
+       IUri_AddRef(iface);
+       return S_OK;
+    }
+
+    *out = NULL;
+    return E_NOINTERFACE;
+}
+
+static ULONG WINAPI custom_uri_AddRef(IUri *iface)
+{
+    struct custom_uri *uri = impl_from_IUri(iface);
+    return IUri_AddRef(uri->uri);
+}
+
+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) {
 static void test_IUri_IsEqual(void) {
+    struct custom_uri custom_uri;
     IUri *uriA, *uriB;
     BOOL equal;
     HRESULT hres;
     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);
 
     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);
 
     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;
 
         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);
         }
             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);
 
         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;
 
 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;
 
         HRESULT hr;
         IUri *uri = (void*) 0xdeadbeef;
 
@@ -8606,7 +8847,7 @@ static void test_CreateUriWithFragment_InvalidFlags(void) {
 static void test_CreateUriWithFragment(void) {
     DWORD i;
 
 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;
         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;
 
     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;
 
             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);
         }
 
             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;
 
             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;
 
     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;
 
             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);
         }
 
             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;
 
             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;
 
     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;
 
             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);
         }
 
             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;
 
             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. */
     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]);
     }
         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. */
     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]);
     }
         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. */
     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]);
     }
         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. */
     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]);
     }
         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. */
     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]);
     }
         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. */
     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]);
     }
         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. */
     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]);
     }
         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;
 
     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;
         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);
 
     }
     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;
         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);
                 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);
         }
             }
             if(builder) IUriBuilder_Release(builder);
         }
@@ -10328,7 +10569,7 @@ static void test_CoInternetCombineIUri(void) {
     if(base) IUri_Release(base);
     if(relative) IUri_Release(relative);
 
     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);
         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;
 
                 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;
 
                         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);
                     }
 
                         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;
 
                         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);
 
         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);
         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;
 
             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;
                     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);
                 }
 
                     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;
 
                     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));
     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;
 
         longurl[i] = 'x';
     longurl[len] = 0;
 
@@ -10803,7 +11044,7 @@ static void test_CoInternetParseIUri_InvalidArgs(void) {
 static void test_CoInternetParseIUri(void) {
     DWORD i;
 
 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;
         HRESULT hr;
         IUri *uri;
         LPWSTR uriW;
@@ -11001,7 +11242,7 @@ static void test_CreateURLMoniker(void)
     IUri *uri, *base_uri;
     HRESULT hres;
 
     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);
 
         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;
 
     props_order[Uri_PROPERTY_SCHEME_NAME] = 8;
     props_order[Uri_PROPERTY_USER_NAME] = 9;
 
-    for(i=0; i<sizeof(uri_tests)/sizeof(*uri_tests); i++) {
+    for(i = 0; i < ARRAY_SIZE(uri_tests); i++) {
         const uri_properties *test = uri_tests+i;
         LPWSTR uriW;
         IUri *uri;
         const uri_properties *test = uri_tests+i;
         LPWSTR uriW;
         IUri *uri;
@@ -11298,6 +11539,7 @@ static void test_IPersistStream(void)
         ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08x.\n", i, hr);
         hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
         ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
         ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08x.\n", i, hr);
         hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
         ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
+        IUri_Release(uri);
         hr = IMarshal_UnmarshalInterface(marshal, stream, &IID_IUri, (void**)&uri);
         ok(hr == S_OK, "%d) UnmarshalInterface failed 0x%08x, expected S_OK.\n", i, hr);
         hr = IUri_GetRawUri(uri, &raw_uri);
         hr = IMarshal_UnmarshalInterface(marshal, stream, &IID_IUri, (void**)&uri);
         ok(hr == S_OK, "%d) UnmarshalInterface failed 0x%08x, expected S_OK.\n", i, hr);
         hr = IUri_GetRawUri(uri, &raw_uri);
index 9fe2385..ada78c9 100644 (file)
@@ -1929,8 +1929,8 @@ static HRESULT WINAPI statusclb_OnStopBinding(IBindStatusCallbackEx *iface, HRES
     }
 
     if(test_protocol == HTTP_TEST && !emulate_protocol && http_cache_file[0]) {
     }
 
     if(test_protocol == HTTP_TEST && !emulate_protocol && http_cache_file[0]) {
-        HANDLE file = CreateFileW(http_cache_file, DELETE, FILE_SHARE_DELETE, NULL,
-                                  OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+        HANDLE file = CreateFileW(http_cache_file, DELETE, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
+                                  NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
         ok(file == INVALID_HANDLE_VALUE, "expected INVALID_HANDLE_VALUE, got %p\n", file);
         ok(GetLastError() == ERROR_SHARING_VIOLATION, "expected ERROR_SHARING_VIOLATION, got %u\n", GetLastError());
         http_cache_file[0] = 0;
         ok(file == INVALID_HANDLE_VALUE, "expected INVALID_HANDLE_VALUE, got %p\n", file);
         ok(GetLastError() == ERROR_SHARING_VIOLATION, "expected ERROR_SHARING_VIOLATION, got %u\n", GetLastError());
         http_cache_file[0] = 0;
@@ -2912,7 +2912,7 @@ static void init_bind_test(int protocol, DWORD flags, DWORD t)
     }
 
     if(url_a)
     }
 
     if(url_a)
-        MultiByteToWideChar(CP_ACP, 0, url_a, -1, current_url, sizeof(current_url)/sizeof(*current_url));
+        MultiByteToWideChar(CP_ACP, 0, url_a, -1, current_url, ARRAY_SIZE(current_url));
 
     test_redirect = (flags & BINDTEST_REDIRECT) != 0;
     use_cache_file = (flags & BINDTEST_USE_CACHE) != 0;
 
     test_redirect = (flags & BINDTEST_REDIRECT) != 0;
     use_cache_file = (flags & BINDTEST_USE_CACHE) != 0;