Commit 759e2eff authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

hlink: Return requested interface when creating IHlinkBrowseContext instance.

parent 0dad77af
......@@ -53,14 +53,17 @@ static HRESULT WINAPI IHlinkBC_fnQueryInterface( IHlinkBrowseContext *iface,
if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IHlinkBrowseContext))
*ppvObj = This;
if (*ppvObj)
{
IUnknown_AddRef((IUnknown*)(*ppvObj));
return S_OK;
*ppvObj = &This->IHlinkBrowseContext_iface;
}
return E_NOINTERFACE;
else
{
*ppvObj = NULL;
return E_NOINTERFACE;
}
IUnknown_AddRef((IUnknown *)*ppvObj);
return S_OK;
}
static ULONG WINAPI IHlinkBC_fnAddRef (IHlinkBrowseContext* iface)
......@@ -368,6 +371,7 @@ static const IHlinkBrowseContextVtbl hlvt =
HRESULT HLinkBrowseContext_Constructor(IUnknown *pUnkOuter, REFIID riid, void **ppv)
{
HlinkBCImpl * hl;
HRESULT hr;
TRACE("unkOut=%p riid=%s\n", pUnkOuter, debugstr_guid(riid));
*ppv = NULL;
......@@ -383,6 +387,8 @@ HRESULT HLinkBrowseContext_Constructor(IUnknown *pUnkOuter, REFIID riid, void **
hl->IHlinkBrowseContext_iface.lpVtbl = &hlvt;
list_init(&hl->links);
*ppv = hl;
return S_OK;
hr = IHlinkBrowseContext_QueryInterface(&hl->IHlinkBrowseContext_iface, riid, ppv);
IHlinkBrowseContext_Release(&hl->IHlinkBrowseContext_iface);
return hr;
}
......@@ -197,10 +197,20 @@ static void test_GetObject(void)
IMoniker_Release(dummy);
}
static void test_interfaces(void)
{
IHlinkBrowseContext *bc;
HRESULT hr;
hr = HlinkCreateBrowseContext(NULL, &IID_IMoniker, (void **)&bc);
ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
}
START_TEST(browse_ctx)
{
CoInitialize(NULL);
test_interfaces();
test_SetInitialHlink();
test_BrowseWindowInfo();
test_GetObject();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment