Dmitry Timoshkov : urlmon: If ProtocolCF_CreateInstance doesn' t support aggregation retry without it.

Alexandre Julliard julliard at winehq.org
Wed May 22 15:52:06 CDT 2019


Module: wine
Branch: master
Commit: 43c1992821b5e1bc9ff51e6b327f29cb7613cf49
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=43c1992821b5e1bc9ff51e6b327f29cb7613cf49

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Wed May 22 15:32:12 2019 +0200

urlmon: If ProtocolCF_CreateInstance doesn't support aggregation retry without it.

This patch fixes a regression caused by 097811f2513e457ebf4afb1d2d21ab90b8684325.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47190
Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/urlmon/bindprot.c       | 23 +++++++++++++++--------
 dlls/urlmon/tests/protocol.c |  3 ---
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/dlls/urlmon/bindprot.c b/dlls/urlmon/bindprot.c
index 42d3d21..e9c97e8 100644
--- a/dlls/urlmon/bindprot.c
+++ b/dlls/urlmon/bindprot.c
@@ -509,15 +509,19 @@ static HRESULT WINAPI BindProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr
 
         hres = IClassFactory_CreateInstance(cf, (IUnknown*)&This->IInternetBindInfo_iface,
                 &IID_IUnknown, (void**)&protocol_unk);
+        if(SUCCEEDED(hres)) {
+            hres = IUnknown_QueryInterface(protocol_unk, &IID_IInternetProtocol, (void**)&protocol);
+            if(SUCCEEDED(hres))
+                This->protocol_unk = protocol_unk;
+            else
+                IUnknown_Release(protocol_unk);
+        }
+        else if(hres == CLASS_E_NOAGGREGATION)
+            hres = IClassFactory_CreateInstance(cf, NULL, &IID_IInternetProtocol, (void**)&protocol);
+
         IClassFactory_Release(cf);
         if(FAILED(hres))
             return hres;
-
-        hres = IUnknown_QueryInterface(protocol_unk, &IID_IInternetProtocol, (void**)&protocol);
-        if(FAILED(hres)) {
-            IUnknown_Release(protocol_unk);
-            return hres;
-        }
     }
 
     StringFromCLSID(&clsid, &clsid_str);
@@ -703,8 +707,11 @@ static HRESULT WINAPI ProtocolHandler_Terminate(IInternetProtocol *iface, DWORD
 
     if(This->protocol) {
         IInternetProtocol_Terminate(This->protocol, 0);
-        IInternetProtocol_Release(This->protocol);
-        This->protocol = NULL;
+
+        if (This->protocol_unk) {
+            IInternetProtocol_Release(This->protocol);
+            This->protocol = NULL;
+        }
     }
 
     set_binding_sink(This, NULL, NULL);
diff --git a/dlls/urlmon/tests/protocol.c b/dlls/urlmon/tests/protocol.c
index f161251..85ef7d0 100644
--- a/dlls/urlmon/tests/protocol.c
+++ b/dlls/urlmon/tests/protocol.c
@@ -3875,9 +3875,7 @@ static void test_CreateBinding(void)
     trace("Start >\n");
     expect_hrResult = S_OK;
     hres = IInternetProtocol_Start(protocol, test_url, &protocol_sink, &bind_info, 0, 0);
-todo_wine_if (no_aggregation)
     ok(hres == S_OK, "Start failed: %08x\n", hres);
-    if (hres != S_OK) goto fail;
     trace("Start <\n");
 
     CHECK_CALLED(QueryService_InternetProtocol);
@@ -4025,7 +4023,6 @@ todo_wine_if (no_aggregation)
     ok(hres == MK_E_SYNTAX, "Start failed: %08x, expected MK_E_SYNTAX\n", hres);
     CHECK_CALLED(QueryService_InternetProtocol);
 
-fail:
     IInternetProtocol_Release(protocol);
 
     IInternetSession_Release(session);




More information about the wine-cvs mailing list