[PATCH 2/2] urlmon: If ProtocolCF_CreateInstance doesn't support aggregation retry without it.
Dmitry Timoshkov
dmitry at baikal.ru
Wed May 22 00:26:06 CDT 2019
This patch fixes regression caused by 097811f2513e457ebf4afb1d2d21ab90b8684325,
and reported in the bug 47190.
Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
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 42d3d21925..e9c97e8a9d 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 eb8b1099d7..20a8e89d0d 100644
--- a/dlls/urlmon/tests/protocol.c
+++ b/dlls/urlmon/tests/protocol.c
@@ -3884,9 +3884,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);
@@ -4040,7 +4038,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);
--
2.20.1
More information about the wine-devel
mailing list