From: Dmitry Timoshkov Subject: [PATCH 2/2] urlmon: If ProtocolCF_CreateInstance doesn't support aggregation retry without it. Message-Id: <20190520144410.a6731af5e35dbbcc737b8ee2@baikal.ru> Date: Mon, 20 May 2019 14:44:10 +0800 This patch fixes regression caused by 097811f2513e457ebf4afb1d2d21ab90b8684325, and reported in the bug 47190. Signed-off-by: Dmitry Timoshkov --- dlls/urlmon/bindprot.c | 17 +++++++++++++---- dlls/urlmon/tests/url.c | 3 --- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/dlls/urlmon/bindprot.c b/dlls/urlmon/bindprot.c index 42d3d21925..4334d2336b 100644 --- a/dlls/urlmon/bindprot.c +++ b/dlls/urlmon/bindprot.c @@ -509,13 +509,22 @@ 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); + else if (hres == CLASS_E_NOAGGREGATION) + { + hres = IClassFactory_CreateInstance(cf, NULL, &IID_IInternetProtocol, (void**)&protocol); + if(SUCCEEDED(hres)) + { + protocol_unk = (IUnknown*)protocol; + IUnknown_AddRef(protocol_unk); + } + } IClassFactory_Release(cf); - if(FAILED(hres)) - return hres; - hres = IUnknown_QueryInterface(protocol_unk, &IID_IInternetProtocol, (void**)&protocol); if(FAILED(hres)) { - IUnknown_Release(protocol_unk); + if (protocol_unk) + IUnknown_Release(protocol_unk); return hres; } } diff --git a/dlls/urlmon/tests/url.c b/dlls/urlmon/tests/url.c index 84dedc07f4..5f3199ba37 100644 --- a/dlls/urlmon/tests/url.c +++ b/dlls/urlmon/tests/url.c @@ -3109,11 +3109,8 @@ static void test_BindToStorage(int protocol, DWORD flags, DWORD t) ok(hres == MK_S_ASYNCHRONOUS, "IMoniker_BindToStorage failed: %08x\n", hres); else if(no_callback) { if(emulate_protocol) - todo_wine_if(no_aggregation) ok( WaitForSingleObject(complete_event2, 3000) == WAIT_OBJECT_0, "wait timed out\n" ); - todo_wine_if(no_aggregation) ok(hres == S_OK, "IMoniker_BindToStorage failed: %08x\n", hres); - todo_wine_if(no_aggregation) ok(unk != NULL, "unk == NULL\n"); }else if(!(bindf & BINDF_ASYNCHRONOUS) && tymed == TYMED_FILE) { ok(hres == S_OK, "IMoniker_BindToStorage failed: %08x\n", hres); -- 2.20.1