[URLMON_WINETEST]
authorAmine Khaldi <amine.khaldi@reactos.org>
Wed, 23 Apr 2014 17:36:51 +0000 (17:36 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Wed, 23 Apr 2014 17:36:51 +0000 (17:36 +0000)
* Sync with Wine 1.7.17.
CORE-8080

svn path=/trunk/; revision=62930

rostests/winetests/urlmon/misc.c
rostests/winetests/urlmon/protocol.c
rostests/winetests/urlmon/sec_mgr.c
rostests/winetests/urlmon/uri.c
rostests/winetests/urlmon/url.c

index 44483ed..ce3d117 100644 (file)
@@ -27,6 +27,7 @@
 #include <wine/test.h>
 //#include <stdarg.h>
 //#include <stddef.h>
+#include <stdio.h>
 
 //#include "windef.h"
 //#include "winbase.h"
@@ -1736,6 +1737,8 @@ static void test_internet_feature_defaults(void) {
  * call hasn't already been made for the specified Feature). Because of
  * this we skip these tests on IE 7 and earlier.
  */
+static const char* szFeatureControlKey = "Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl";
+
 static void test_internet_features_registry(void) {
     HRESULT hres;
     DWORD res;
@@ -1743,11 +1746,10 @@ static void test_internet_features_registry(void) {
     char *name;
     HKEY feature_control;
     HKEY feature;
-    DWORD value, skip_zone;
+    DWORD value;
+    BOOL skip_zone;
     BOOL delete_feature_key = TRUE;
-    BOOL delete_feature_control_key = FALSE;
 
-    static const char* szFeatureControlKey = "Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl";
     static const char* szFeatureBehaviorsKey = "FEATURE_BEHAVIORS";
     static const char* szFeatureZoneElevationKey = "FEATURE_ZONE_ELEVATION";
 
@@ -1763,17 +1765,13 @@ static void test_internet_features_registry(void) {
 
     /* Some Windows machines don't have a FeatureControl key in HKCU. */
     res = RegOpenKeyA(HKEY_CURRENT_USER, szFeatureControlKey, &feature_control);
-    if(res != ERROR_SUCCESS) {
-        res = RegCreateKeyA(HKEY_CURRENT_USER, szFeatureControlKey, &feature_control);
-        ok(res == ERROR_SUCCESS, "RegCreateKey failed: %d\n", res);
-        delete_feature_control_key = TRUE;
-    }
+    ok(res == ERROR_SUCCESS, "RegCreateKey failed: %d\n", res);
 
     res = RegOpenKeyA(feature_control, szFeatureBehaviorsKey, &feature);
-    if(res == ERROR_SUCCESS)
+    if(res == ERROR_SUCCESS) {
         /* FEATURE_BEHAVIORS already existed, so don't delete it when we're done. */
         delete_feature_key = FALSE;
-    else {
+    }else {
         res = RegCreateKeyA(feature_control, szFeatureBehaviorsKey, &feature);
         ok(res == ERROR_SUCCESS, "RegCreateKey failed: %d\n", res);
     }
@@ -1789,7 +1787,7 @@ static void test_internet_features_registry(void) {
         RegCloseKey(feature);
         RegDeleteKeyA(feature_control, szFeatureBehaviorsKey);
     } else {
-        RegDeleteValue(feature, name);
+        RegDeleteValueA(feature, name);
         RegCloseKey(feature);
     }
 
@@ -1802,8 +1800,6 @@ static void test_internet_features_registry(void) {
     ok(hres == S_OK, "CoInternetSetFeatureEnabled failed: %08x\n", hres);
 
     RegCloseKey(feature_control);
-    if(delete_feature_control_key)
-        RegDeleteKeyA(HKEY_CURRENT_USER, szFeatureControlKey);
 
     res = RegOpenKeyA(HKEY_LOCAL_MACHINE, szFeatureControlKey, &feature_control);
     ok(res == ERROR_SUCCESS, "RegOpenKey failed: %d\n", res);
@@ -1816,11 +1812,11 @@ static void test_internet_features_registry(void) {
     if (res == ERROR_ACCESS_DENIED)
     {
         skip("Not allowed to modify zone elevation\n");
-        skip_zone = 1;
+        skip_zone = TRUE;
     }
     else
     {
-        skip_zone = 0;
+        skip_zone = FALSE;
         ok(res == ERROR_SUCCESS, "RegSetValueEx failed: %d\n", res);
 
         hres = pCoInternetIsFeatureEnabled(FEATURE_ZONE_ELEVATION, GET_FEATURE_FROM_PROCESS);
@@ -1897,11 +1893,40 @@ static void test_CoInternetSetFeatureEnabled(void) {
 }
 
 static void test_internet_features(void) {
+    HKEY key;
+    DWORD res;
+
     if(!pCoInternetIsFeatureEnabled || !pCoInternetSetFeatureEnabled) {
         win_skip("Skipping internet feature tests, IE is too old\n");
         return;
     }
 
+    /* IE10 takes FeatureControl key into account only if it's available upon process start. */
+    res = RegOpenKeyA(HKEY_CURRENT_USER, szFeatureControlKey, &key);
+    if(res != ERROR_SUCCESS) {
+        PROCESS_INFORMATION pi;
+        STARTUPINFOA si = { 0 };
+        char cmdline[MAX_PATH];
+        char **argv;
+        BOOL ret;
+
+        res = RegCreateKeyA(HKEY_CURRENT_USER, szFeatureControlKey, &key);
+        ok(res == ERROR_SUCCESS, "RegCreateKey failed: %d\n", res);
+
+        trace("Running features tests in a separated process.\n");
+
+        winetest_get_mainargs( &argv );
+        sprintf(cmdline, "\"%s\" %s internet_features", argv[0], argv[1]);
+        ret = CreateProcessA(argv[0], cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
+        ok(ret, "Could not create process: %u\n", GetLastError());
+        winetest_wait_child_process( pi.hProcess );
+        CloseHandle(pi.hThread);
+        CloseHandle(pi.hProcess);
+
+        RegDeleteKeyA(HKEY_CURRENT_USER, szFeatureControlKey);
+        return;
+    }
+
     test_internet_features_registry();
     test_CoInternetIsFeatureEnabled();
     test_CoInternetSetFeatureEnabled();
@@ -1910,8 +1935,12 @@ static void test_internet_features(void) {
 START_TEST(misc)
 {
     HMODULE hurlmon;
+    int argc;
+    char **argv;
+
+    argc = winetest_get_mainargs(&argv);
 
-    hurlmon = GetModuleHandle("urlmon.dll");
+    hurlmon = GetModuleHandleA("urlmon.dll");
     pCoInternetCompareUrl = (void *) GetProcAddress(hurlmon, "CoInternetCompareUrl");
     pCoInternetGetSecurityUrl = (void*) GetProcAddress(hurlmon, "CoInternetGetSecurityUrl");
     pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
@@ -1936,23 +1965,26 @@ START_TEST(misc)
 
     OleInitialize(NULL);
 
-    register_protocols();
-
-    test_CreateFormatEnum();
-    test_RegisterFormatEnumerator();
-    test_CoInternetParseUrl();
-    test_CoInternetCompareUrl();
-    test_CoInternetQueryInfo();
-    test_FindMimeFromData();
-    test_NameSpace();
-    test_MimeFilter();
-    test_ReleaseBindInfo();
-    test_CopyStgMedium();
-    test_CopyBindInfo();
-    test_UrlMkGetSessionOption();
-    test_user_agent();
-    test_MkParseDisplayNameEx();
-    test_IsValidURL();
+    if(argc <= 2 || strcmp(argv[2], "internet_features")) {
+        register_protocols();
+
+        test_CreateFormatEnum();
+        test_RegisterFormatEnumerator();
+        test_CoInternetParseUrl();
+        test_CoInternetCompareUrl();
+        test_CoInternetQueryInfo();
+        test_FindMimeFromData();
+        test_NameSpace();
+        test_MimeFilter();
+        test_ReleaseBindInfo();
+        test_CopyStgMedium();
+        test_CopyBindInfo();
+        test_UrlMkGetSessionOption();
+        test_user_agent();
+        test_MkParseDisplayNameEx();
+        test_IsValidURL();
+    }
+
     test_internet_features();
 
     OleUninitialize();
index e7d7976..30fa046 100644 (file)
@@ -95,6 +95,7 @@ DEFINE_EXPECT(GetBindString_ACCEPT_MIMES);
 DEFINE_EXPECT(GetBindString_USER_AGENT);
 DEFINE_EXPECT(GetBindString_POST_COOKIE);
 DEFINE_EXPECT(GetBindString_URL);
+DEFINE_EXPECT(GetBindString_ROOTDOC_URL);
 DEFINE_EXPECT(QueryService_HttpNegotiate);
 DEFINE_EXPECT(QueryService_InternetProtocol);
 DEFINE_EXPECT(QueryService_HttpSecurity);
@@ -202,18 +203,6 @@ static const WCHAR binding_urls[][130] = {
 
 static const CHAR post_data[] = "mode=Test";
 
-static const char *debugstr_guid(REFIID riid)
-{
-    static char buf[50];
-
-    sprintf(buf, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
-            riid->Data1, riid->Data2, riid->Data3, riid->Data4[0],
-            riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4],
-            riid->Data4[5], riid->Data4[6], riid->Data4[7]);
-
-    return buf;
-}
-
 static int strcmp_wa(LPCWSTR strw, const char *stra)
 {
     CHAR buf[512];
@@ -420,7 +409,19 @@ static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFG
         return IHttpSecurity_QueryInterface(&http_security, riid, ppv);
     }
 
-    ok(0, "unexpected service %s\n", debugstr_guid(guidService));
+    if(IsEqualGUID(&IID_IGetBindHandle, guidService)) {
+        trace("QueryService(IID_IGetBindHandle)\n");
+        *ppv = NULL;
+        return E_NOINTERFACE;
+    }
+
+    if(IsEqualGUID(&IID_IWindowForBindingUI, guidService)) {
+        trace("QueryService(IID_IWindowForBindingUI)\n");
+        *ppv = NULL;
+        return E_NOINTERFACE;
+    }
+
+    ok(0, "unexpected service %s\n", wine_dbgstr_guid(guidService));
     return E_FAIL;
 }
 
@@ -435,7 +436,12 @@ static IServiceProvider service_provider = { &ServiceProviderVtbl };
 
 static HRESULT WINAPI Stream_QueryInterface(IStream *iface, REFIID riid, void **ppv)
 {
-    ok(0, "unexpected call\n");
+    static const IID IID_strm_unknown = {0x2f68429a,0x199a,0x4043,{0x93,0x11,0xf2,0xfe,0x7c,0x13,0xcc,0xb9}};
+
+    if(!IsEqualGUID(&IID_strm_unknown, riid)) /* IE11 */
+        ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
+
+    *ppv = NULL;
     return E_NOINTERFACE;
 }
 
@@ -579,6 +585,8 @@ static void call_continue(PROTOCOLDATA *protocol_data)
 {
     HRESULT hres;
 
+    trace("continue in state %d\n", state);
+
     if(state == STATE_CONNECTING) {
         if(tested_protocol == HTTP_TEST || tested_protocol == HTTPS_TEST || tested_protocol == FTP_TEST) {
             if (http_is_first){
@@ -877,8 +885,11 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface,
         CHECK_EXPECT(ReportProgress_DECODING);
         ok(!lstrcmpW(szStatusText, pjpegW), "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
         break;
+    case BINDSTATUS_RESERVED_7:
+        trace("BINDSTATUS_RESERVED_7\n");
+        break;
     default:
-        ok(0, "Unexpected status %d\n", ulStatusCode);
+        ok(0, "Unexpected status %d (%d)\n", ulStatusCode, ulStatusCode-BINDSTATUS_LAST);
     };
 
     return S_OK;
@@ -1237,6 +1248,7 @@ static IInternetProtocolSink mime_protocol_sink = { &mime_protocol_sink_vtbl };
 static HRESULT QueryInterface(REFIID riid, void **ppv)
 {
     static const IID IID_undocumented = {0x58DFC7D0,0x5381,0x43E5,{0x9D,0x72,0x4C,0xDD,0xE4,0xCB,0x0F,0x1A}};
+    static const IID IID_undocumentedIE10 = {0xc28722e5,0xbc1a,0x4c55,{0xa6,0x8d,0x33,0x21,0x9f,0x69,0x89,0x10}};
 
     *ppv = NULL;
 
@@ -1250,11 +1262,14 @@ static HRESULT QueryInterface(REFIID riid, void **ppv)
     /* NOTE: IE8 queries for undocumented {58DFC7D0-5381-43E5-9D72-4CDDE4CB0F1A} interface. */
     if(IsEqualGUID(&IID_undocumented, riid))
         return E_NOINTERFACE;
+    /* NOTE: IE10 queries for undocumented {c28722e5-bc1a-4c55-a68d-33219f698910} interface. */
+    if(IsEqualGUID(&IID_undocumentedIE10, riid))
+        return E_NOINTERFACE;
 
     if(*ppv)
         return S_OK;
 
-    ok(0, "unexpected call %s\n", debugstr_guid(riid));
+    ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
     return E_NOINTERFACE;
 }
 
@@ -1380,8 +1395,12 @@ static HRESULT WINAPI BindInfo_GetBindString(IInternetBindInfo *iface, ULONG ulS
         memcpy(*ppwzStr, binding_urls[tested_protocol], size);
         return S_OK;
     }
+    case BINDSTRING_ROOTDOC_URL:
+        CHECK_EXPECT(GetBindString_ROOTDOC_URL);
+        ok(cEl == 1, "cEl=%d, expected 1\n", cEl);
+        return E_NOTIMPL;
     default:
-        ok(0, "unexpected call\n");
+        ok(0, "unexpected ulStringType %d\n", ulStringType);
     }
 
     return E_NOTIMPL;
@@ -1518,7 +1537,7 @@ static HRESULT WINAPI ProtocolEmul_QueryInterface(IInternetProtocolEx *iface, RE
     }
 
     if(!IsEqualGUID(riid, &unknown_iid)) /* IE10 */
-        ok(0, "unexpected riid %s\n", debugstr_guid(riid));
+        ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid));
     *ppv = NULL;
     return E_NOINTERFACE;
 }
@@ -1805,7 +1824,7 @@ static HRESULT WINAPI ProtocolEmul_Continue(IInternetProtocolEx *iface,
     case 1: {
         IServiceProvider *service_provider;
         IHttpNegotiate *http_negotiate;
-        static WCHAR header[] = {'?',0};
+        static const WCHAR header[] = {'?',0};
 
         hres = IInternetProtocolSink_QueryInterface(binding_sink, &IID_IServiceProvider,
                                                     (void**)&service_provider);
@@ -2050,7 +2069,7 @@ static HRESULT WINAPI MimeProtocol_QueryInterface(IInternetProtocolEx *iface, RE
         return S_OK;
     }
 
-    ok(0, "unexpected riid %s\n", debugstr_guid(riid));
+    ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid));
     *ppv = NULL;
     return E_NOINTERFACE;
 }
@@ -2261,7 +2280,7 @@ static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown
     CHECK_EXPECT(CreateInstance);
 
     ok(pOuter == (IUnknown*)prot_bind_info, "pOuter != protocol_unk\n");
-    ok(IsEqualGUID(&IID_IUnknown, riid), "unexpected riid %s\n", debugstr_guid(riid));
+    ok(IsEqualGUID(&IID_IUnknown, riid), "unexpected riid %s\n", wine_dbgstr_guid(riid));
     ok(ppv != NULL, "ppv == NULL\n");
 
     *ppv = &Protocol;
@@ -2289,7 +2308,7 @@ static HRESULT WINAPI MimeFilter_CreateInstance(IClassFactory *iface, IUnknown *
     CHECK_EXPECT(MimeFilter_CreateInstance);
 
     ok(!outer, "outer = %p\n", outer);
-    ok(IsEqualGUID(&IID_IInternetProtocol, riid), "unexpected riid %s\n", debugstr_guid(riid));
+    ok(IsEqualGUID(&IID_IInternetProtocol, riid), "unexpected riid %s\n", wine_dbgstr_guid(riid));
 
     *ppv = &MimeProtocol;
     return S_OK;
@@ -2839,6 +2858,7 @@ static BOOL http_protocol_start(LPCWSTR url, BOOL use_iuri)
         SET_EXPECT(ReportProgress_DIRECTBIND);
     if(!got_user_agent)
         SET_EXPECT(GetBindString_USER_AGENT);
+    SET_EXPECT(GetBindString_ROOTDOC_URL);
     SET_EXPECT(GetBindString_ACCEPT_MIMES);
     SET_EXPECT(QueryService_HttpNegotiate);
     SET_EXPECT(BeginningTransaction);
@@ -2880,6 +2900,7 @@ static BOOL http_protocol_start(LPCWSTR url, BOOL use_iuri)
         CHECK_CALLED(GetBindString_USER_AGENT);
         got_user_agent = TRUE;
     }
+    CLEAR_CALLED(GetBindString_ROOTDOC_URL); /* New in IE11 */
     CHECK_CALLED(GetBindString_ACCEPT_MIMES);
     CHECK_CALLED(QueryService_HttpNegotiate);
     CHECK_CALLED(BeginningTransaction);
@@ -3075,7 +3096,7 @@ static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tym
                         CHECK_CALLED(ReportResult);
 
                         hres = IInternetProtocol_Abort(async_protocol, E_ABORT, 0);
-                        ok(hres == INET_E_RESULT_DISPATCHED, "Abort failed: %08x\n", hres);
+                        ok(hres == INET_E_RESULT_DISPATCHED || hres == S_OK /* IE10 */, "Abort failed: %08x\n", hres);
                         break;
                     }
                 }else {
@@ -3098,7 +3119,7 @@ static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tym
             CLEAR_CALLED(ReportProgress_COOKIE_SENT);
 
         hres = IInternetProtocol_Abort(async_protocol, E_ABORT, 0);
-        ok(hres == INET_E_RESULT_DISPATCHED, "Abort failed: %08x\n", hres);
+        ok(hres == INET_E_RESULT_DISPATCHED || hres == S_OK /* IE10 */, "Abort failed: %08x\n", hres);
 
         test_protocol_terminate(async_protocol);
 
@@ -3190,13 +3211,13 @@ static void test_http_protocol(void)
 
 static void test_https_protocol(void)
 {
-    static const WCHAR codeweavers_url[] =
-        {'h','t','t','p','s',':','/','/','w','w','w','.','c','o','d','e','w','e','a','v','e','r','s',
-         '.','c','o','m','/','t','e','s','t','.','h','t','m','l',0};
+    static const WCHAR https_winehq_url[] =
+        {'h','t','t','p','s',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/',
+         't','e','s','t','s','/','h','e','l','l','o','.','h','t','m','l',0};
 
     trace("Testing https protocol (from urlmon)...\n");
     bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE;
-    test_http_protocol_url(codeweavers_url, HTTPS_TEST, TEST_FIRST_HTTP, TYMED_NULL);
+    test_http_protocol_url(https_winehq_url, HTTPS_TEST, TEST_FIRST_HTTP, TYMED_NULL);
 }
 
 
@@ -3305,7 +3326,7 @@ static void test_gopher_protocol(void)
 
     hres = CoGetClassObject(&CLSID_GopherProtocol, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void**)&unk);
     ok(hres == S_OK ||
-       hres == REGDB_E_CLASSNOTREG, /* Gopher protocol has been removed as of Vista */
+       broken(hres == REGDB_E_CLASSNOTREG || hres == CLASS_E_CLASSNOTAVAILABLE), /* Gopher protocol has been removed as of Vista */
        "CoGetClassObject failed: %08x\n", hres);
     if(FAILED(hres))
         return;
@@ -3634,7 +3655,7 @@ static void test_binding(int prot, DWORD grf_pi, DWORD test_flags)
     CHECK_CALLED(QueryService_InternetProtocol);
     CHECK_CALLED(CreateInstance);
     CHECK_CALLED(ReportProgress_PROTOCOLCLASSID);
-    CHECK_CALLED(SetPriority);
+    CLEAR_CALLED(SetPriority); /* IE11 does not call it. */
     if(impl_protex)
         CHECK_CALLED(StartEx);
     else
@@ -3733,7 +3754,7 @@ START_TEST(protocol)
         return;
     }
 
-    hurlmon = GetModuleHandle("urlmon.dll");
+    hurlmon = GetModuleHandleA("urlmon.dll");
     pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
     pReleaseBindInfo = (void*) GetProcAddress(hurlmon, "ReleaseBindInfo");
     pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
@@ -3748,10 +3769,10 @@ START_TEST(protocol)
 
     OleInitialize(NULL);
 
-    event_complete = CreateEvent(NULL, FALSE, FALSE, NULL);
-    event_complete2 = CreateEvent(NULL, FALSE, FALSE, NULL);
-    event_continue = CreateEvent(NULL, FALSE, FALSE, NULL);
-    event_continue_done = CreateEvent(NULL, FALSE, FALSE, NULL);
+    event_complete = CreateEventW(NULL, FALSE, FALSE, NULL);
+    event_complete2 = CreateEventW(NULL, FALSE, FALSE, NULL);
+    event_continue = CreateEventW(NULL, FALSE, FALSE, NULL);
+    event_continue_done = CreateEventW(NULL, FALSE, FALSE, NULL);
     thread_id = GetCurrentThreadId();
 
     test_file_protocol();
index 1b83d84..016366a 100644 (file)
         expect_ ## func = called_ ## func = FALSE; \
     }while(0)
 
+#define SET_CALLED(func) \
+    do { \
+        expect_ ## func = called_ ## func = FALSE; \
+    }while(0)
+
 DEFINE_EXPECT(ParseUrl_SECURITY_URL_input);
 DEFINE_EXPECT(ParseUrl_SECURITY_URL_input2);
 DEFINE_EXPECT(ParseUrl_SECURITY_URL_expected);
@@ -516,15 +521,26 @@ static void test_url_action(IInternetSecurityManager *secmgr, IInternetZoneManag
      */
     res = RegOpenKeyA(HKEY_CURRENT_USER,
             "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\3", &hkey);
-    if(res != ERROR_SUCCESS) {
-        ok(0, "Could not open zone key\n");
+    ok(res == ERROR_SUCCESS, "Could not open zone key\n");
+    if(res != ERROR_SUCCESS)
         return;
-    }
 
-    wsprintf(buf, "%X", action);
+    wsprintfA(buf, "%X", action);
     size = sizeof(DWORD);
     res = RegQueryValueExA(hkey, buf, NULL, NULL, (BYTE*)&reg_policy, &size);
     RegCloseKey(hkey);
+
+    /* Try settings from HKEY_LOCAL_MACHINE. */
+    if(res != ERROR_SUCCESS || size != sizeof(DWORD)) {
+        res = RegOpenKeyA(HKEY_LOCAL_MACHINE,
+                "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\3", &hkey);
+        ok(res == ERROR_SUCCESS, "Could not open zone key\n");
+
+        size = sizeof(DWORD);
+        res = RegQueryValueExA(hkey, buf, NULL, NULL, (BYTE*)&reg_policy, &size);
+        RegCloseKey(hkey);
+    }
+
     if(res != ERROR_SUCCESS || size != sizeof(DWORD)) {
         policy = 0xdeadbeef;
         hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url9, action, (BYTE*)&policy,
@@ -737,7 +753,7 @@ typedef struct {
 static const zone_domain_mapping zone_domain_mappings[] = {
     /* Implicitly means "*.yabadaba.do". */
     {"yabadaba.do",NULL,"http",URLZONE_CUSTOM},
-    /* The '*' doesn't count as a wildcard, since its not the first component of the subdomain. */
+    /* The '*' doesn't count as a wildcard, since it's not the first component of the subdomain. */
     {"super.cool","testing.*","ftp",URLZONE_CUSTOM2},
     /* The '*' counts since it's the first component of the subdomain. */
     {"super.cool","*.testing","ftp",URLZONE_CUSTOM2},
@@ -850,7 +866,7 @@ static void run_child_process(void)
     char path[MAX_PATH];
     char **argv;
     PROCESS_INFORMATION pi;
-    STARTUPINFO si = { 0 };
+    STARTUPINFOA si = { 0 };
     BOOL ret;
 
     GetModuleFileNameA(NULL, path, MAX_PATH);
@@ -858,7 +874,7 @@ static void run_child_process(void)
     si.cb = sizeof(si);
     winetest_get_mainargs(&argv);
     sprintf(cmdline, "\"%s\" %s domain_tests", argv[0], argv[1]);
-    ret = CreateProcess(argv[0], cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
+    ret = CreateProcessA(argv[0], cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
     ok(ret, "Failed to spawn child process: %u\n", GetLastError());
     winetest_wait_child_process(pi.hProcess);
     CloseHandle(pi.hThread);
@@ -1220,10 +1236,10 @@ static void test_GetZoneAttributes(void)
     ok((pZA->cbSize == 0xffffffff) || (pZA->cbSize == sizeof(ZONEATTRIBUTES)),
         "got cbSize = 0x%x (expected 0xffffffff)\n", pZA->cbSize);
 
-    /* IE8 no longer fail on invalid zones */
+    /* IE8 up to IE10 don't fail on invalid zones */
     memset(buffer, -1, sizeof(buffer));
     hr = IInternetZoneManager_GetZoneAttributes(zonemgr, 0xdeadbeef, pZA);
-    ok(hr == S_OK || (hr == E_FAIL),
+    ok(hr == S_OK || hr == E_FAIL || hr == E_POINTER,
         "got 0x%x (expected S_OK or E_FAIL)\n", hr);
 
     hr = IInternetZoneManager_GetZoneAttributes(zonemgr, 0, NULL);
@@ -1965,6 +1981,16 @@ static void test_CoInternetIsFeatureZoneElevationEnabled(void)
             testcases[i].policy_flags = URLPOLICY_ALLOW;
     }
 
+    /* IE10 does not seem to use passed ISecurityManager */
+    SET_EXPECT(ProcessUrlAction);
+    pCoInternetIsFeatureZoneElevationEnabled(url1, url1, &security_manager, 0);
+    i = called_ProcessUrlAction;
+    SET_CALLED(ProcessUrlAction);
+    if(!i) {
+        skip("CoInternetIsFeatureZoneElevationEnabled does not use passed ISecurityManager\n");
+        return;
+    }
+
     for(i=0; i<sizeof(testcases)/sizeof(testcases[0]); i++) {
         url_from = a2w(testcases[i].url_from);
         url_to = a2w(testcases[i].url_to);
@@ -1998,7 +2024,7 @@ START_TEST(sec_mgr)
     int argc;
     char **argv;
 
-    hurlmon = GetModuleHandle("urlmon.dll");
+    hurlmon = GetModuleHandleA("urlmon.dll");
     pCoInternetCreateSecurityManager = (void*) GetProcAddress(hurlmon, "CoInternetCreateSecurityManager");
     pCoInternetCreateZoneManager = (void*) GetProcAddress(hurlmon, "CoInternetCreateZoneManager");
     pCoInternetGetSecurityUrl = (void*) GetProcAddress(hurlmon, "CoInternetGetSecurityUrl");
index 4a90a15..eedcc8f 100644 (file)
@@ -695,7 +695,7 @@ static const uri_properties uri_tests[] = {
             {URLZONE_INVALID,E_NOTIMPL,FALSE}
         }
     },
-    /* URI is considered opaque since CREATE_NO_CRACK_UNKNOWN_SCHEMES is set and its an unknown scheme. */
+    /* URI is considered opaque since CREATE_NO_CRACK_UNKNOWN_SCHEMES is set and it's an unknown scheme. */
     {   "zip://google.com", Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, S_OK, FALSE,
         {
             {"zip:/.//google.com",S_OK,FALSE},
@@ -903,7 +903,7 @@ static const uri_properties uri_tests[] = {
             {URLZONE_INVALID,E_NOTIMPL,FALSE}
         }
     },
-    /* Allowed to have invalid % encoded because its an unknown scheme type. */
+    /* Allowed to have invalid % encoded because it's an unknown scheme type. */
     {   "zip://%xy:word@winehq.org/", 0, S_OK, FALSE,
         {
             {"zip://%xy:word@winehq.org/",S_OK,FALSE},
@@ -1934,7 +1934,7 @@ static const uri_properties uri_tests[] = {
             {URLZONE_INVALID,E_NOTIMPL,FALSE}
         }
     },
-    /* Since foo isn't a recognized 3 character TLD its considered the domain name. */
+    /* Since foo isn't a recognized 3 character TLD it's considered the domain name. */
     {   "http://google.foo.uk", 0, S_OK, FALSE,
         {
             {"http://google.foo.uk/",S_OK,FALSE},
@@ -4078,7 +4078,7 @@ static const uri_properties uri_tests[] = {
             {URLZONE_INVALID,E_NOTIMPL,FALSE}
         }
     },
-    /* Res doesn't get forbidden characters percent encoded in it's path. */
+    /* Res doesn't get forbidden characters percent encoded in its path. */
     {   "res://c:\\test/tes<|>t", 0, S_OK, FALSE,
         {
             {"res://c:\\test/tes<|>t",S_OK,FALSE},
@@ -4602,7 +4602,7 @@ static const invalid_uri invalid_uri_tests[] = {
     {"*a*b*c*d://not.valid.com",0,FALSE},
     /* Not allowed to have invalid % encoded data. */
     {"ftp://google.co%XX/",0,FALSE},
-    /* To many h16 components. */
+    /* Too many h16 components. */
     {"http://[1:2:3:4:5:6:7:8:9]",0,FALSE},
     /* Not enough room for IPv4 address. */
     {"http://[1:2:3:4:5:6:7:192.0.1.0]",0,FALSE},
@@ -4614,8 +4614,6 @@ static const invalid_uri invalid_uri_tests[] = {
     {"http://[::192.0]",0,FALSE},
     /* Can't have elision of 1 h16 at beginning of address. */
     {"http://[::2:3:4:5:6:7:8]",0,FALSE},
-    /* Can't have elision of 1 h16 at end of address. */
-    {"http://[1:2:3:4:5:6:7::]",0,FALSE},
     /* Expects a valid IP Literal. */
     {"ftp://[not.valid.uri]/",0,FALSE},
     /* Expects valid port for a known scheme type. */
@@ -7425,12 +7423,16 @@ static void test_IUri_GetPropertyBSTR(void) {
         hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, NULL, 0);
         ok(hr == E_POINTER, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
 
-        /* Make sure it handles a invalid Uri_PROPERTY's correctly. */
+        /* Make sure it handles an invalid Uri_PROPERTY correctly. */
         hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_PORT, &received, 0);
-        ok(hr == S_OK, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
-        ok(received != NULL, "Error: Expected the string not to be NULL.\n");
-        ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
-        SysFreeString(received);
+        ok(hr == E_INVALIDARG /* IE10 */ || broken(hr == S_OK), "Error: GetPropertyBSTR returned 0x%08x, expected E_INVALIDARG or S_OK.\n", hr);
+        if(SUCCEEDED(hr)) {
+            ok(received != NULL, "Error: Expected the string not to be NULL.\n");
+            ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
+            SysFreeString(received);
+        }else {
+            ok(!received, "received = %s\n", wine_dbgstr_w(received));
+        }
 
         /* Make sure it handles the ZONE property correctly. */
         received = NULL;
@@ -8136,11 +8138,10 @@ static void test_IUri_GetPropertyLength(void) {
             DWORD j;
 
             for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
-                DWORD expectedLen, brokenLen, receivedLen;
+                DWORD expectedLen, receivedLen;
                 uri_str_property prop = test.str_props[j];
 
-                expectedLen = lstrlen(prop.value);
-                brokenLen = lstrlen(prop.broken_value);
+                expectedLen = lstrlenA(prop.value);
 
                 /* This won't be necessary once GetPropertyLength is implemented. */
                 receivedLen = -1;
@@ -8152,14 +8153,14 @@ static void test_IUri_GetPropertyLength(void) {
                                 hr, prop.expected, i, j);
                     }
                     todo_wine {
-                        ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
+                        ok(receivedLen == expectedLen || broken(prop.broken_value && receivedLen == lstrlenA(prop.broken_value)),
                                 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
                                 expectedLen, receivedLen, i, j);
                     }
                 } else {
                     ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
                             hr, prop.expected, i, j);
-                    ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
+                    ok(receivedLen == expectedLen || broken(prop.broken_value && receivedLen == lstrlenA(prop.broken_value)),
                             "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
                             expectedLen, receivedLen, i, j);
                 }
@@ -8966,6 +8967,7 @@ static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder
     if(prop) {
         /* Use expected_value unless it's NULL, then use value. */
         LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
+        DWORD expected_len = expected ? strlen(expected) : 0;
         hr = IUriBuilder_GetFragment(builder, &len, &received);
         if(prop->todo) {
             todo_wine {
@@ -8979,9 +8981,9 @@ static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder
                         expected, wine_dbgstr_w(received), test_index);
                 }
                 todo_wine {
-                    ok(lstrlen(expected) == len,
+                    ok(expected_len == len,
                         "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
-                        lstrlen(expected), len, test_index);
+                        expected_len, len, test_index);
                 }
             }
         } else {
@@ -8990,9 +8992,9 @@ static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder
                 hr, (expected ? S_OK : S_FALSE), test_index);
             ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
                 expected, wine_dbgstr_w(received), test_index);
-            ok(lstrlen(expected) == len,
+            ok(expected_len == len,
                 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
-                lstrlen(expected), len, test_index);
+                expected_len, len, test_index);
         }
     } else {
         /* The property wasn't set earlier, so it should return whatever
@@ -9075,6 +9077,7 @@ static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_tes
     if(prop) {
         /* Use expected_value unless it's NULL, then use value. */
         LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
+        DWORD expected_len = expected ? strlen(expected) : 0;
         hr = IUriBuilder_GetHost(builder, &len, &received);
         if(prop->todo) {
             todo_wine {
@@ -9088,9 +9091,9 @@ static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_tes
                         expected, wine_dbgstr_w(received), test_index);
                 }
                 todo_wine {
-                    ok(lstrlen(expected) == len,
+                    ok(expected_len == len,
                         "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
-                        lstrlen(expected), len, test_index);
+                        expected_len, len, test_index);
                 }
             }
         } else {
@@ -9099,9 +9102,9 @@ static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_tes
                 hr, (expected ? S_OK : S_FALSE), test_index);
             ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
                 expected, wine_dbgstr_w(received), test_index);
-            ok(lstrlen(expected) == len,
+            ok(expected_len == len,
                 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
-                lstrlen(expected), len, test_index);
+                expected_len, len, test_index);
         }
     } else {
         /* The property wasn't set earlier, so it should return whatever
@@ -9184,6 +9187,7 @@ static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder
     if(prop) {
         /* Use expected_value unless it's NULL, then use value. */
         LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
+        DWORD expected_len = expected ? strlen(expected) : 0;
         hr = IUriBuilder_GetPassword(builder, &len, &received);
         if(prop->todo) {
             todo_wine {
@@ -9197,9 +9201,9 @@ static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder
                         expected, wine_dbgstr_w(received), test_index);
                 }
                 todo_wine {
-                    ok(lstrlen(expected) == len,
+                    ok(expected_len == len,
                         "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
-                        lstrlen(expected), len, test_index);
+                        expected_len, len, test_index);
                 }
             }
         } else {
@@ -9208,9 +9212,9 @@ static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder
                 hr, (expected ? S_OK : S_FALSE), test_index);
             ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
                 expected, wine_dbgstr_w(received), test_index);
-            ok(lstrlen(expected) == len,
+            ok(expected_len == len,
                 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
-                lstrlen(expected), len, test_index);
+                expected_len, len, test_index);
         }
     } else {
         /* The property wasn't set earlier, so it should return whatever
@@ -9293,6 +9297,7 @@ static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_tes
     if(prop) {
         /* Use expected_value unless it's NULL, then use value. */
         LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
+        DWORD expected_len = expected ? strlen(expected) : 0;
         hr = IUriBuilder_GetPath(builder, &len, &received);
         if(prop->todo) {
             todo_wine {
@@ -9306,9 +9311,9 @@ static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_tes
                         expected, wine_dbgstr_w(received), test_index);
                 }
                 todo_wine {
-                    ok(lstrlen(expected) == len,
+                    ok(expected_len == len,
                         "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
-                        lstrlen(expected), len, test_index);
+                        expected_len, len, test_index);
                 }
             }
         } else {
@@ -9317,9 +9322,9 @@ static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_tes
                 hr, (expected ? S_OK : S_FALSE), test_index);
             ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
                 expected, wine_dbgstr_w(received), test_index);
-            ok(lstrlen(expected) == len,
+            ok(expected_len == len,
                 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
-                lstrlen(expected), len, test_index);
+                expected_len, len, test_index);
         }
     } else {
         /* The property wasn't set earlier, so it should return whatever
@@ -9487,6 +9492,7 @@ static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_te
     if(prop) {
         /* Use expected_value unless it's NULL, then use value. */
         LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
+        DWORD expected_len = expected ? strlen(expected) : 0;
         hr = IUriBuilder_GetQuery(builder, &len, &received);
         if(prop->todo) {
             todo_wine {
@@ -9500,9 +9506,9 @@ static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_te
                         expected, wine_dbgstr_w(received), test_index);
                 }
                 todo_wine {
-                    ok(lstrlen(expected) == len,
+                    ok(expected_len == len,
                         "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
-                        lstrlen(expected), len, test_index);
+                        expected_len, len, test_index);
                 }
             }
         } else {
@@ -9511,9 +9517,9 @@ static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_te
                 hr, (expected ? S_OK : S_FALSE), test_index);
             ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
                 expected, wine_dbgstr_w(received), test_index);
-            ok(lstrlen(expected) == len,
+            ok(expected_len == len,
                 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
-                lstrlen(expected), len, test_index);
+                expected_len, len, test_index);
         }
     } else {
         /* The property wasn't set earlier, so it should return whatever
@@ -9596,6 +9602,7 @@ static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_build
     if(prop) {
         /* Use expected_value unless it's NULL, then use value. */
         LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
+        DWORD expected_len = expected ? strlen(expected) : 0;
         hr = IUriBuilder_GetSchemeName(builder, &len, &received);
         if(prop->todo) {
             todo_wine {
@@ -9609,9 +9616,9 @@ static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_build
                         expected, wine_dbgstr_w(received), test_index);
                 }
                 todo_wine {
-                    ok(lstrlen(expected) == len,
+                    ok(expected_len == len,
                         "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
-                        lstrlen(expected), len, test_index);
+                        expected_len, len, test_index);
                 }
             }
         } else {
@@ -9620,9 +9627,9 @@ static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_build
                 hr, (expected ? S_OK : S_FALSE), test_index);
             ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
                 expected, wine_dbgstr_w(received), test_index);
-            ok(lstrlen(expected) == len,
+            ok(expected_len == len,
                 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
-                lstrlen(expected), len, test_index);
+                expected_len, len, test_index);
         }
     } else {
         /* The property wasn't set earlier, so it should return whatever
@@ -9705,6 +9712,7 @@ static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder
     if(prop && prop->value && *prop->value) {
         /* Use expected_value unless it's NULL, then use value. */
         LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
+        DWORD expected_len = expected ? strlen(expected) : 0;
         hr = IUriBuilder_GetUserName(builder, &len, &received);
         if(prop->todo) {
             todo_wine {
@@ -9718,9 +9726,9 @@ static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder
                         expected, wine_dbgstr_w(received), test_index);
                 }
                 todo_wine {
-                    ok(lstrlen(expected) == len,
+                    ok(expected_len == len,
                         "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
-                        lstrlen(expected), len, test_index);
+                        expected_len, len, test_index);
                 }
             }
         } else {
@@ -9729,9 +9737,9 @@ static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder
                 hr, (expected ? S_OK : S_FALSE), test_index);
             ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
                 expected, wine_dbgstr_w(received), test_index);
-            ok(lstrlen(expected) == len,
+            ok(expected_len == len,
                 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
-                lstrlen(expected), len, test_index);
+                expected_len, len, test_index);
         }
     } else {
         /* The property wasn't set earlier, so it should return whatever
@@ -9946,7 +9954,7 @@ static void test_IUriBuilder_HasBeenModified(void) {
             hr = IUriBuilder_SetIUri(builder, uri);
             ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
 
-            /* IUriBuilder already had 'uri' as it's IUri property and so Windows doesn't
+            /* IUriBuilder already had 'uri' as its IUri property and so Windows doesn't
              * reset any of the changes that were made to the IUriBuilder.
              */
             hr = IUriBuilder_HasBeenModified(builder, &received);
@@ -10069,7 +10077,7 @@ static void test_IUriBuilder_IUriProperty(void) {
             if(test) IUri_Release(test);
 
             /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
-             * explicitly set (because it's a default flags).
+             * explicitly set (because it's a default flag).
              */
             test = NULL;
             hr = IUriBuilder_CreateUri(builder, Uri_CREATE_CANONICALIZE, 0, 0, &test);
@@ -10117,7 +10125,7 @@ static void test_IUriBuilder_IUriProperty(void) {
             if(test) IUri_Release(test);
 
             /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
-             * explicitly set (because it's a default flags).
+             * explicitly set (because it's a default flag).
              */
             test = NULL;
             hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_CANONICALIZE, 0, 0, 0, &test);
@@ -11298,7 +11306,6 @@ static void test_IPersistStream(void)
         ok(props == 0, "%d) Not all properties were processed %d. Next property type: %d\n",
                 i, props, dw_data[0]);
 
-        IPersistStream_Release(persist_stream);
         IUri_Release(uri);
 
         hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
@@ -11306,6 +11313,8 @@ static void test_IPersistStream(void)
         hr = IPersistStream_GetClassID(persist_stream, &curi);
         ok(hr == S_OK, "%d) GetClassID failed 0x%08x, expected S_OK.\n", i, hr);
         ok(IsEqualCLSID(&curi, &CLSID_CUri), "%d) GetClassID returned incorrect CLSID.\n", i);
+        IPersistStream_Release(persist_stream);
+
         hr = CoCreateInstance(&curi, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
                 &IID_IUri, (void**)&uri);
         ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08x.\n", i, hr);
@@ -11321,6 +11330,7 @@ static void test_IPersistStream(void)
                 "%d) Expected %s but got %s.\n", i, test->str_props[Uri_PROPERTY_RAW_URI].value,
                 wine_dbgstr_w(raw_uri));
         SysFreeString(raw_uri);
+        IPersistStream_Release(persist_stream);
 
         hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
         ok(hr == S_OK, "%d) QueryInterface(IID_IMarshal) failed 0x%08x, expected S_OK.\n", i, hr);
@@ -11394,7 +11404,6 @@ static void test_IPersistStream(void)
 
         IMarshal_Release(marshal);
         IStream_Release(stream);
-        IPersistStream_Release(persist_stream);
         IUri_Release(uri);
         heap_free(uriW);
     }
@@ -11495,7 +11504,7 @@ static void test_UninitializedUri(void)
 START_TEST(uri) {
     HMODULE hurlmon;
 
-    hurlmon = GetModuleHandle("urlmon.dll");
+    hurlmon = GetModuleHandleA("urlmon.dll");
     pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
     pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
     pCreateUriWithFragment = (void*) GetProcAddress(hurlmon, "CreateUriWithFragment");
index cc83b3f..820c93f 100644 (file)
@@ -50,6 +50,7 @@ static HRESULT (WINAPI *pCreateUri)(LPCWSTR, DWORD, DWORD_PTR, IUri**);
 DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
 DEFINE_GUID(CLSID_IdentityUnmarshal,0x0000001b,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
 DEFINE_GUID(IID_IBindStatusCallbackHolder,0x79eac9cc,0xbaf9,0x11ce,0x8c,0x82,0x00,0xaa,0x00,0x4b,0xa9,0x0b);
+static const IID IID_undocumentedIE11 = {0xd5ae15f6,0x2032,0x488e,{0x8f,0x96,0xf9,0x24,0x06,0xd8,0xd8,0xb4}};
 extern CLSID CLSID_AboutProtocol;
 
 #define DEFINE_EXPECT(func) \
@@ -96,7 +97,6 @@ DEFINE_EXPECT(QueryInterface_IHttpNegotiate);
 DEFINE_EXPECT(QueryInterface_IBindStatusCallback);
 DEFINE_EXPECT(QueryInterface_IBindStatusCallbackEx);
 DEFINE_EXPECT(QueryInterface_IBindStatusCallbackHolder);
-DEFINE_EXPECT(QueryInterface_IInternetBindInfo);
 DEFINE_EXPECT(QueryInterface_IAuthenticate);
 DEFINE_EXPECT(QueryInterface_IInternetProtocol);
 DEFINE_EXPECT(QueryInterface_IWindowForBindingUI);
@@ -196,6 +196,8 @@ static BOOL invalid_cn_accepted = FALSE;
 static BOOL abort_start = FALSE;
 static BOOL abort_progress = FALSE;
 static BOOL async_switch = FALSE;
+static BOOL strict_bsc_qi;
+static DWORD bindtest_flags;
 static const char *test_file;
 
 static WCHAR file_url[INTERNET_MAX_URL_LENGTH], current_url[INTERNET_MAX_URL_LENGTH];
@@ -218,18 +220,6 @@ static enum {
     END_DOWNLOAD
 } download_state;
 
-static const char *debugstr_guid(REFIID riid)
-{
-    static char buf[50];
-
-    sprintf(buf, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
-            riid->Data1, riid->Data2, riid->Data3, riid->Data4[0],
-            riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4],
-            riid->Data4[5], riid->Data4[6], riid->Data4[7]);
-
-    return buf;
-}
-
 static BOOL proxy_active(void)
 {
     HKEY internet_settings;
@@ -383,6 +373,8 @@ static IInternetPriority InternetPriority = { &InternetPriorityVtbl };
 
 static HRESULT WINAPI Protocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
 {
+    static const IID IID_undocumentedIE10 = {0x7daf9908,0x8415,0x4005,{0x95,0xae,0xbd,0x27,0xf6,0xe3,0xdc,0x00}};
+
     *ppv = NULL;
 
     if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetProtocol, riid)) {
@@ -401,7 +393,12 @@ static HRESULT WINAPI Protocol_QueryInterface(IInternetProtocol *iface, REFIID r
     if(IsEqualGUID(&IID_IInternetProtocolEx, riid))
         return E_NOINTERFACE; /* TODO */
 
-    ok(0, "unexpected call %s\n", debugstr_guid(riid));
+    if(IsEqualGUID(&IID_undocumentedIE10, riid)) {
+        trace("QI(%s)\n", wine_dbgstr_guid(riid));
+        return E_NOINTERFACE; /* TODO */
+    }
+
+    ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
     return E_NOINTERFACE;
 }
 
@@ -636,7 +633,7 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
     if(filedwl_api || !is_urlmon_protocol(test_protocol) || tymed != TYMED_ISTREAM ||
        !(bindf&BINDF_ASYNCSTORAGE) || !(bindf&BINDF_PULLDATA))
         ok(bind_info & BINDF_NEEDFILE, "BINDF_NEEDFILE is not set\n");
-    else
+    else if(test_protocol != MK_TEST) /* IE10 sets BINDF_NEEDFILE for mk: protocol */
         ok(!(bind_info & BINDF_NEEDFILE), "BINDF_NEEDFILE is set\n");
 
     bind_info &= ~(BINDF_NEEDFILE|BINDF_FROMURLMON);
@@ -705,11 +702,9 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
 
         static const WCHAR wszMimes[] = {'*','/','*',0};
 
-        SET_EXPECT(QueryInterface_IInternetBindInfo);
         SET_EXPECT(QueryService_IInternetBindInfo);
         hres = IInternetBindInfo_GetBindString(pOIBindInfo, BINDSTRING_USER_AGENT,
                                                &ua, 1, &fetched);
-        CLEAR_CALLED(QueryInterface_IInternetBindInfo); /* IE <8 */
         CLEAR_CALLED(QueryService_IInternetBindInfo); /* IE <8 */
 
         ok(hres == E_NOINTERFACE,
@@ -967,7 +962,7 @@ static HRESULT WINAPI Protocol_Continue(IInternetProtocol *iface,
     case 1: {
         IServiceProvider *service_provider;
         IHttpNegotiate *http_negotiate;
-        static WCHAR header[] = {'?',0};
+        static const WCHAR header[] = {'?',0};
 
         hres = IInternetProtocolSink_QueryInterface(protocol_sink, &IID_IServiceProvider,
                                                     (void**)&service_provider);
@@ -1134,7 +1129,7 @@ static HRESULT WINAPI Protocol_Read(IInternetProtocol *iface, void *pv,
     }
 
     if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST || test_protocol == WINETEST_TEST) {
-        static int pending = TRUE;
+        static BOOL pending = TRUE;
 
         pending = !pending;
 
@@ -1363,7 +1358,7 @@ static HRESULT WINAPI HttpSecurity_GetWindow(IHttpSecurity *iface, REFGUID rguid
     else if(IsEqualGUID(rguidReason, &IID_ICodeInstall))
         CHECK_EXPECT(GetWindow_ICodeInstall);
     else
-        ok(0, "Unexpected rguidReason: %s\n", debugstr_guid(rguidReason));
+        ok(0, "Unexpected rguidReason: %s\n", wine_dbgstr_guid(rguidReason));
 
     *phwnd = NULL;
     return S_OK;
@@ -1442,7 +1437,19 @@ static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface,
         return S_OK;
     }
 
-    ok(0, "unexpected service %s\n", debugstr_guid(guidService));
+    if(IsEqualGUID(&IID_IGetBindHandle, guidService)) {
+        trace("QueryService(IID_IGetBindHandle)\n");
+        *ppv = NULL;
+        return E_NOINTERFACE;
+    }
+
+    if(IsEqualGUID(&IID_undocumentedIE11, guidService)) {
+        trace("QueryService(IID_undocumentedIE11)\n");
+        *ppv = NULL;
+        return E_NOINTERFACE;
+    }
+
+    ok(0, "unexpected service %s\n", wine_dbgstr_guid(guidService));
     return E_NOINTERFACE;
 }
 
@@ -1462,7 +1469,7 @@ static void test_WinInetHttpInfo(IWinInetHttpInfo *http_info, DWORD progress)
     DWORD status, size;
     HRESULT hres, expect;
 
-    /* QueryInfo changes it's behavior during this request */
+    /* QueryInfo changes its behavior during this request */
     if(progress == BINDSTATUS_SENDINGREQUEST)
         return;
 
@@ -1505,6 +1512,8 @@ static void test_WinInetHttpInfo(IWinInetHttpInfo *http_info, DWORD progress)
 
 static HRESULT WINAPI statusclb_QueryInterface(IBindStatusCallbackEx *iface, REFIID riid, void **ppv)
 {
+    static const IID IID_undocumentedIE10 = {0xf286fa56,0xc1fd,0x4270,{0x8e,0x67,0xb3,0xeb,0x79,0x0a,0x81,0xe8}};
+
     ok(GetCurrentThreadId() == thread_id, "wrong thread %d\n", GetCurrentThreadId());
 
     if(IsEqualGUID(&IID_IInternetProtocol, riid)) {
@@ -1515,67 +1524,57 @@ static HRESULT WINAPI statusclb_QueryInterface(IBindStatusCallbackEx *iface, REF
         }else {
             return E_NOINTERFACE;
         }
-    }
-    else if (IsEqualGUID(&IID_IServiceProvider, riid))
-    {
+    }else if (IsEqualGUID(&IID_IServiceProvider, riid)) {
         CHECK_EXPECT2(QueryInterface_IServiceProvider);
         *ppv = &ServiceProvider;
         return S_OK;
-    }
-    else if (IsEqualGUID(&IID_IHttpNegotiate, riid))
-    {
+    }else if (IsEqualGUID(&IID_IHttpNegotiate, riid)) {
         CHECK_EXPECT2(QueryInterface_IHttpNegotiate);
         *ppv = &HttpNegotiate;
         return S_OK;
-    }
-    else if (IsEqualGUID(&IID_IHttpNegotiate2, riid))
-    {
+    }else if (IsEqualGUID(&IID_IHttpNegotiate2, riid)) {
         CHECK_EXPECT(QueryInterface_IHttpNegotiate2);
         *ppv = &HttpNegotiate;
         return S_OK;
-    }
-    else if (IsEqualGUID(&IID_IAuthenticate, riid))
-    {
+    }else if (IsEqualGUID(&IID_IAuthenticate, riid)) {
         CHECK_EXPECT(QueryInterface_IAuthenticate);
         return E_NOINTERFACE;
-    }
-    else if(IsEqualGUID(&IID_IBindStatusCallback, riid))
-    {
-        CHECK_EXPECT2(QueryInterface_IBindStatusCallback);
+    }else if(IsEqualGUID(&IID_IBindStatusCallback, riid)) {
+        if(strict_bsc_qi)
+            CHECK_EXPECT2(QueryInterface_IBindStatusCallback);
         *ppv = iface;
         return S_OK;
-    }
-    else if(IsEqualGUID(&IID_IBindStatusCallbackHolder, riid))
-    {
+    }else if(IsEqualGUID(&IID_IBindStatusCallbackHolder, riid)) {
         CHECK_EXPECT2(QueryInterface_IBindStatusCallbackHolder);
         return E_NOINTERFACE;
-    }
-    else if(IsEqualGUID(&IID_IBindStatusCallbackEx, riid))
-    {
+    }else if(IsEqualGUID(&IID_IBindStatusCallbackEx, riid)) {
         CHECK_EXPECT(QueryInterface_IBindStatusCallbackEx);
         if(!use_bscex)
             return E_NOINTERFACE;
         *ppv = iface;
         return S_OK;
-    }
-    else if(IsEqualGUID(&IID_IInternetBindInfo, riid))
-    {
+    }else if(IsEqualGUID(&IID_IInternetBindInfo, riid)) {
         /* TODO */
-        CHECK_EXPECT2(QueryInterface_IInternetBindInfo);
-    }
-    else if(IsEqualGUID(&IID_IWindowForBindingUI, riid))
-    {
+    }else if(IsEqualGUID(&IID_IWindowForBindingUI, riid)) {
         CHECK_EXPECT2(QueryInterface_IWindowForBindingUI);
         return E_NOINTERFACE;
-    }
-    else if(IsEqualGUID(&IID_IHttpSecurity, riid))
-    {
+    }else if(IsEqualGUID(&IID_IHttpSecurity, riid)) {
         CHECK_EXPECT2(QueryInterface_IHttpSecurity);
         return E_NOINTERFACE;
-    }
-    else
-    {
-        ok(0, "unexpected interface %s\n", debugstr_guid(riid));
+    }else if(IsEqualGUID(&IID_IGetBindHandle, riid)) {
+        trace("QI(IID_IGetBindHandle)\n");
+        *ppv = NULL;
+        return E_NOINTERFACE;
+    }else if(IsEqualGUID(&IID_undocumentedIE10, riid)) {
+        trace("QI(IID_undocumentedIE10)\n");
+        *ppv = NULL;
+        return E_NOINTERFACE;
+    }else if(IsEqualGUID(&IID_undocumentedIE11, riid)) {
+        trace("QI(IID_undocumentedIE11)\n");
+        *ppv = NULL;
+        return E_NOINTERFACE;
+    }else {
+        ok(0, "unexpected interface %s\n", wine_dbgstr_guid(riid));
     }
 
     return E_NOINTERFACE;
@@ -1637,7 +1636,7 @@ static HRESULT WINAPI statusclb_OnStartBinding(IBindStatusCallbackEx *iface, DWO
 
     hres = IBinding_GetBindResult(pib, &clsid, &res, &res_str, NULL);
     ok(hres == S_OK, "GetBindResult failed: %08x, expected S_OK\n", hres);
-    ok(IsEqualCLSID(&clsid, &CLSID_NULL), "incorrect clsid: %s\n", debugstr_guid(&clsid));
+    ok(IsEqualCLSID(&clsid, &CLSID_NULL), "incorrect clsid: %s\n", wine_dbgstr_guid(&clsid));
     ok(!res, "incorrect res: %x\n", res);
     ok(!res_str, "incorrect res_str: %s\n", wine_dbgstr_w(res_str));
 
@@ -1672,6 +1671,8 @@ static HRESULT WINAPI statusclb_OnProgress(IBindStatusCallbackEx *iface, ULONG u
             CHECK_EXPECT(Obj_OnProgress_FINDINGRESOURCE);
         else if(test_protocol == FTP_TEST)
             todo_wine CHECK_EXPECT(OnProgress_FINDINGRESOURCE);
+        else if(test_protocol == HTTPS_TEST && !bindtest_flags)
+            todo_wine CHECK_EXPECT(OnProgress_FINDINGRESOURCE);
         else
             CHECK_EXPECT(OnProgress_FINDINGRESOURCE);
         if(emulate_protocol && (test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST || test_protocol == WINETEST_TEST))
@@ -1807,7 +1808,7 @@ static HRESULT WINAPI statusclb_OnProgress(IBindStatusCallbackEx *iface, ULONG u
         hr = CLSIDFromString((LPCOLESTR)szStatusText, &clsid);
         ok(hr == S_OK, "CLSIDFromString failed with error 0x%08x\n", hr);
         ok(IsEqualCLSID(&clsid, &CLSID_HTMLDocument),
-            "Expected clsid to be CLSID_HTMLDocument instead of %s\n", debugstr_guid(&clsid));
+            "Expected clsid to be CLSID_HTMLDocument instead of %s\n", wine_dbgstr_guid(&clsid));
         break;
     }
     case BINDSTATUS_BEGINSYNCOPERATION:
@@ -1899,31 +1900,31 @@ static HRESULT WINAPI statusclb_OnStopBinding(IBindStatusCallbackEx *iface, HRES
         if(hresult==S_OK || (abort_start && hresult!=S_FALSE) || hresult == REGDB_E_CLASSNOTREG) {
             ok(IsEqualCLSID(&clsid, &CLSID_NULL),
                     "incorrect protocol CLSID: %s, expected CLSID_NULL\n",
-                    debugstr_guid(&clsid));
+                    wine_dbgstr_guid(&clsid));
         }else if(emulate_protocol) {
             todo_wine ok(IsEqualCLSID(&clsid, &CLSID_FtpProtocol),
                     "incorrect protocol CLSID: %s, expected CLSID_FtpProtocol\n",
-                    debugstr_guid(&clsid));
+                    wine_dbgstr_guid(&clsid));
         }else if(test_protocol == FTP_TEST) {
             ok(IsEqualCLSID(&clsid, &CLSID_FtpProtocol),
                     "incorrect protocol CLSID: %s, expected CLSID_FtpProtocol\n",
-                    debugstr_guid(&clsid));
+                    wine_dbgstr_guid(&clsid));
         }else if(test_protocol == FILE_TEST) {
             ok(IsEqualCLSID(&clsid, &CLSID_FileProtocol),
                     "incorrect protocol CLSID: %s, expected CLSID_FileProtocol\n",
-                    debugstr_guid(&clsid));
+                    wine_dbgstr_guid(&clsid));
         }else if(test_protocol == HTTP_TEST) {
             ok(IsEqualCLSID(&clsid, &CLSID_HttpProtocol),
                     "incorrect protocol CLSID: %s, expected CLSID_HttpProtocol\n",
-                    debugstr_guid(&clsid));
+                    wine_dbgstr_guid(&clsid));
         }else if(test_protocol == HTTPS_TEST) {
             ok(IsEqualCLSID(&clsid, &CLSID_HttpSProtocol),
                     "incorrect protocol CLSID: %s, expected CLSID_HttpSProtocol\n",
-                    debugstr_guid(&clsid));
+                    wine_dbgstr_guid(&clsid));
         }else if(test_protocol == ABOUT_TEST) {
             ok(IsEqualCLSID(&clsid, &CLSID_AboutProtocol),
                     "incorrect protocol CLSID: %s, expected CLSID_AboutProtocol\n",
-                    debugstr_guid(&clsid));
+                    wine_dbgstr_guid(&clsid));
         }else {
             ok(0, "unexpected (%d)\n", test_protocol);
         }
@@ -1985,9 +1986,9 @@ static HRESULT WINAPI statusclb_OnDataAvailable(IBindStatusCallbackEx *iface, DW
         if (mime_type[0]) {
             INT ret;
             clipfmt[0] = 0;
-            ret = GetClipboardFormatName(pformatetc->cfFormat, clipfmt, sizeof(clipfmt)-1);
+            ret = GetClipboardFormatNameA(pformatetc->cfFormat, clipfmt, sizeof(clipfmt)-1);
             ok(ret, "GetClipboardFormatName failed, error %d\n", GetLastError());
-            ok(!lstrcmp(clipfmt, mime_type), "clipformat %x != mime_type, \"%s\" != \"%s\"\n",
+            ok(!strcmp(clipfmt, mime_type), "clipformat %x != mime_type, \"%s\" != \"%s\"\n",
                pformatetc->cfFormat, clipfmt, mime_type);
         } else {
             ok(pformatetc->cfFormat == 0, "clipformat=%x\n", pformatetc->cfFormat);
@@ -2078,7 +2079,7 @@ static HRESULT WINAPI statusclb_OnObjectAvailable(IBindStatusCallbackEx *iface,
     if(iface != &objbsc)
         ok(0, "unexpected call\n");
 
-    ok(IsEqualGUID(&IID_IUnknown, riid), "riid = %s\n", debugstr_guid(riid));
+    ok(IsEqualGUID(&IID_IUnknown, riid), "riid = %s\n", wine_dbgstr_guid(riid));
     ok(punk != NULL, "punk == NULL\n");
 
     return S_OK;
@@ -2119,7 +2120,7 @@ static IBindStatusCallbackEx objbsc = { &BindStatusCallbackVtbl };
 static HRESULT WINAPI MonikerProp_QueryInterface(IMonikerProp *iface, REFIID riid, void **ppv)
 {
     *ppv = NULL;
-    ok(0, "unexpected riid %s\n", debugstr_guid(riid));
+    ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid));
     return E_NOINTERFACE;
 }
 
@@ -2171,7 +2172,7 @@ static HRESULT WINAPI PersistMoniker_QueryInterface(IPersistMoniker *iface, REFI
     if(*ppv)
         return S_OK;
 
-    ok(0, "unexpected riid %s\n", debugstr_guid(riid));
+    ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid));
     return E_NOINTERFACE;
 }
 
@@ -2319,7 +2320,7 @@ static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID r
     if(IsEqualGUID(&CLSID_IdentityUnmarshal, riid))
         return E_NOINTERFACE;
 
-    ok(0, "unexpected riid %s\n", debugstr_guid(riid));
+    ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid));
     return E_NOTIMPL;
 }
 
@@ -2337,7 +2338,7 @@ static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown
 {
     CHECK_EXPECT(CreateInstance);
     ok(!outer, "outer = %p\n", outer);
-    ok(IsEqualGUID(&IID_IUnknown, riid), "unexpected riid %s\n", debugstr_guid(riid));
+    ok(IsEqualGUID(&IID_IUnknown, riid), "unexpected riid %s\n", wine_dbgstr_guid(riid));
     *ppv = &PersistMoniker;
     return S_OK;
 }
@@ -2370,7 +2371,7 @@ static HRESULT WINAPI ProtocolCF_QueryInterface(IClassFactory *iface, REFIID rii
     if(IsEqualGUID(&IID_IInternetProtocolInfo, riid))
         return E_NOINTERFACE;
 
-    ok(0, "unexpected riid %s\n", debugstr_guid(riid));
+    ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid));
     return E_NOTIMPL;
 }
 
@@ -2380,7 +2381,7 @@ static HRESULT WINAPI ProtocolCF_CreateInstance(IClassFactory *iface, IUnknown *
         return E_NOINTERFACE;
 
     todo_wine ok(outer != NULL, "outer == NULL\n");
-    todo_wine ok(IsEqualGUID(&IID_IUnknown, riid), "unexpected riid %s\n", debugstr_guid(riid));
+    todo_wine ok(IsEqualGUID(&IID_IUnknown, riid), "unexpected riid %s\n", wine_dbgstr_guid(riid));
     *ppv = &Protocol;
     return S_OK;
 }
@@ -2711,6 +2712,8 @@ static BOOL test_RegisterBindStatusCallback(void)
     IUnknown *unk;
     HRESULT hres;
 
+    strict_bsc_qi = TRUE;
+
     hres = CreateBindCtx(0, &bindctx);
     ok(hres == S_OK, "BindCtx failed: %08x\n", hres);
 
@@ -2797,6 +2800,8 @@ static BOOL test_RegisterBindStatusCallback(void)
     IBindStatusCallback_Release(prev_clb);
 
     IBindCtx_Release(bindctx);
+
+    strict_bsc_qi = FALSE;
     return ret;
 }
 
@@ -2819,6 +2824,7 @@ static void init_bind_test(int protocol, DWORD flags, DWORD t)
     const char *url_a = NULL;
 
     test_protocol = protocol;
+    bindtest_flags = flags;
     emulate_protocol = (flags & BINDTEST_EMULATE) != 0;
     download_state = BEFORE_DOWNLOAD;
     stopped_binding = FALSE;
@@ -2851,7 +2857,7 @@ static void init_bind_test(int protocol, DWORD flags, DWORD t)
         url_a = "its:test.chm::/blank.html";
         break;
     case HTTPS_TEST:
-        url_a = (flags & BINDTEST_INVALID_CN) ? "https://209.46.25.132/test.html" : "https://www.codeweavers.com/test.html";
+        url_a = (flags & BINDTEST_INVALID_CN) ? "https://209.46.25.134/favicon.ico" : "https://test.winehq.org/tests/hello.html";
         break;
     case FTP_TEST:
         url_a = "ftp://ftp.winehq.org/pub/other/winelogo.xcf.tar.bz2";
@@ -2959,7 +2965,6 @@ static void test_BindToStorage(int protocol, DWORD flags, DWORD t)
             SET_EXPECT(UnlockRequest);
     }else {
         if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST || test_protocol == WINETEST_TEST) {
-            SET_EXPECT(QueryInterface_IInternetBindInfo);
             SET_EXPECT(QueryService_IInternetBindInfo);
             if(!abort_start)
                 SET_EXPECT(QueryInterface_IHttpNegotiate);
@@ -3061,9 +3066,9 @@ static void test_BindToStorage(int protocol, DWORD flags, DWORD t)
         return;
 
     if((bindf & BINDF_ASYNCHRONOUS) && !no_callback) {
-        while(!stopped_binding && GetMessage(&msg,NULL,0,0)) {
+        while(!stopped_binding && GetMessageA(&msg,NULL,0,0)) {
             TranslateMessage(&msg);
-            DispatchMessage(&msg);
+            DispatchMessageA(&msg);
         }
     }
 
@@ -3091,7 +3096,7 @@ static void test_BindToStorage(int protocol, DWORD flags, DWORD t)
     }
     if(emulate_protocol) {
         if(is_urlmon_protocol(test_protocol))
-            CHECK_CALLED(SetPriority);
+            CLEAR_CALLED(SetPriority); /* Not called by IE11 */
         CHECK_CALLED(Start);
         if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST || test_protocol == WINETEST_TEST
            || test_protocol == WINETEST_SYNC_TEST) {
@@ -3103,7 +3108,6 @@ static void test_BindToStorage(int protocol, DWORD flags, DWORD t)
             CHECK_CALLED(UnlockRequest);
     }else {
         if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST || test_protocol == WINETEST_TEST) {
-            CLEAR_CALLED(QueryInterface_IInternetBindInfo);
             CLEAR_CALLED(QueryService_IInternetBindInfo);
             if(!abort_start)
                 CHECK_CALLED(QueryInterface_IHttpNegotiate);
@@ -3331,9 +3335,9 @@ static void test_BindToObject(int protocol, DWORD flags, HRESULT exhres)
         IUnknown_Release(unk);
 
     while((bindf & BINDF_ASYNCHRONOUS) &&
-          !((!emulate_protocol || stopped_binding) && stopped_obj_binding) && GetMessage(&msg,NULL,0,0)) {
+          !((!emulate_protocol || stopped_binding) && stopped_obj_binding) && GetMessageA(&msg,NULL,0,0)) {
         TranslateMessage(&msg);
-        DispatchMessage(&msg);
+        DispatchMessageA(&msg);
     }
 
     CLEAR_CALLED(QueryInterface_IBindStatusCallbackEx);
@@ -3344,7 +3348,7 @@ static void test_BindToObject(int protocol, DWORD flags, HRESULT exhres)
     CHECK_CALLED(Obj_OnStartBinding);
     if(emulate_protocol) {
         if(is_urlmon_protocol(test_protocol))
-            CHECK_CALLED(SetPriority);
+            CLEAR_CALLED(SetPriority); /* Not called by IE11 */
         CHECK_CALLED(Start);
         if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST)
             CHECK_CALLED(Terminate);
@@ -3424,10 +3428,9 @@ static void test_URLDownloadToFile(DWORD prot, BOOL emul)
 
     SET_EXPECT(GetBindInfo);
     SET_EXPECT(QueryInterface_IInternetProtocol);
-    if(!emulate_protocol) {
-        SET_EXPECT(QueryInterface_IServiceProvider);
+    SET_EXPECT(QueryInterface_IServiceProvider);
+    if(!emulate_protocol)
         SET_EXPECT(QueryService_IInternetProtocol);
-    }
     SET_EXPECT(OnStartBinding);
     if(emulate_protocol) {
         if(is_urlmon_protocol(test_protocol))
@@ -3467,11 +3470,13 @@ static void test_URLDownloadToFile(DWORD prot, BOOL emul)
     if(!emulate_protocol) {
         CHECK_CALLED(QueryInterface_IServiceProvider);
         CHECK_CALLED(QueryService_IInternetProtocol);
+    }else {
+        CLEAR_CALLED(QueryInterface_IServiceProvider);
     }
     CHECK_CALLED(OnStartBinding);
     if(emulate_protocol) {
         if(is_urlmon_protocol(test_protocol))
-            CHECK_CALLED(SetPriority);
+            CLEAR_CALLED(SetPriority); /* Not called by IE11 */
         CHECK_CALLED(Start);
         CHECK_CALLED(UnlockRequest);
     }else {
@@ -3724,7 +3729,7 @@ static void test_ReportResult(HRESULT exhres)
     CHECK_CALLED(QueryInterface_IInternetProtocol);
     CHECK_CALLED(OnStartBinding);
     if(is_urlmon_protocol(test_protocol))
-        CHECK_CALLED(SetPriority);
+        CLEAR_CALLED(SetPriority); /* Not called by IE11 */
     CHECK_CALLED(Start);
 
     ok(unk == NULL, "unk=%p\n", unk);
@@ -3843,7 +3848,7 @@ START_TEST(url)
 {
     HMODULE hurlmon;
 
-    hurlmon = GetModuleHandle("urlmon.dll");
+    hurlmon = GetModuleHandleA("urlmon.dll");
     pCreateAsyncBindCtxEx = (void*) GetProcAddress(hurlmon, "CreateAsyncBindCtxEx");
 
     if(!GetProcAddress(hurlmon, "CompareSecurityIds")) {
@@ -3855,8 +3860,8 @@ START_TEST(url)
     if(!pCreateUri)
         win_skip("IUri not supported\n");
 
-    complete_event = CreateEvent(NULL, FALSE, FALSE, NULL);
-    complete_event2 = CreateEvent(NULL, FALSE, FALSE, NULL);
+    complete_event = CreateEventW(NULL, FALSE, FALSE, NULL);
+    complete_event2 = CreateEventW(NULL, FALSE, FALSE, NULL);
     thread_id = GetCurrentThreadId();
     create_html_file();
     create_cache_file();
@@ -3923,11 +3928,13 @@ START_TEST(url)
         http_is_first = TRUE;
         test_BindToStorage(HTTPS_TEST, BINDTEST_INVALID_CN, TYMED_ISTREAM);
 
-        trace("synchronous https test (invalid CN, fail)\n");
+        bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA;
+
+        trace("asynchronous https test (invalid CN, fail)\n");
         onsecurityproblem_hres = E_FAIL;
         test_BindToStorage(HTTPS_TEST, BINDTEST_INVALID_CN, TYMED_ISTREAM);
 
-        trace("synchronous https test (invalid CN, accept)\n");
+        trace("asynchronous https test (invalid CN, accept)\n");
         onsecurityproblem_hres = S_OK;
         test_BindToStorage(HTTPS_TEST, BINDTEST_INVALID_CN, TYMED_ISTREAM);
 
@@ -3936,8 +3943,6 @@ START_TEST(url)
         test_BindToStorage(HTTPS_TEST, BINDTEST_INVALID_CN, TYMED_ISTREAM);
         invalid_cn_accepted = FALSE;
 
-        bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA;
-
         trace("winetest test (async switch)...\n");
         test_BindToStorage(WINETEST_TEST, BINDTEST_EMULATE|BINDTEST_ASYNC_SWITCH, TYMED_ISTREAM);
 
@@ -3992,7 +3997,6 @@ START_TEST(url)
         test_BindToStorage(WINETEST_TEST, BINDTEST_EMULATE|BINDTEST_NO_CALLBACK|BINDTEST_USE_CACHE, TYMED_ISTREAM);
 
         trace("asynchronous https test...\n");
-        http_is_first = TRUE;
         test_BindToStorage(HTTPS_TEST, 0, TYMED_ISTREAM);
 
         trace("emulated https test...\n");