Commit 19f802c0 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

hlink: Return correct requested interface from HlinkCreateFromMoniker().

parent bbb9c273
...@@ -49,15 +49,15 @@ HRESULT WINAPI HlinkCreateFromMoniker( IMoniker *pimkTrgt, LPCWSTR pwzLocation, ...@@ -49,15 +49,15 @@ HRESULT WINAPI HlinkCreateFromMoniker( IMoniker *pimkTrgt, LPCWSTR pwzLocation,
IUnknown* piunkOuter, REFIID riid, void** ppvObj) IUnknown* piunkOuter, REFIID riid, void** ppvObj)
{ {
IHlink *hl = NULL; IHlink *hl = NULL;
HRESULT r; HRESULT hr;
TRACE("%p %s %s %p %li %p %s %p\n", pimkTrgt, debugstr_w(pwzLocation), TRACE("%p %s %s %p %li %p %s %p\n", pimkTrgt, debugstr_w(pwzLocation),
debugstr_w(pwzFriendlyName), pihlsite, dwSiteData, piunkOuter, debugstr_w(pwzFriendlyName), pihlsite, dwSiteData, piunkOuter,
debugstr_guid(riid), ppvObj); debugstr_guid(riid), ppvObj);
r = CoCreateInstance(&CLSID_StdHlink, piunkOuter, CLSCTX_INPROC_SERVER, riid, (LPVOID*)&hl); hr = CoCreateInstance(&CLSID_StdHlink, piunkOuter, CLSCTX_INPROC_SERVER, &IID_IHlink, (LPVOID*)&hl);
if (FAILED(r)) if (FAILED(hr))
return r; return hr;
IHlink_SetMonikerReference(hl, HLINKSETF_LOCATION | HLINKSETF_TARGET, pimkTrgt, pwzLocation); IHlink_SetMonikerReference(hl, HLINKSETF_LOCATION | HLINKSETF_TARGET, pimkTrgt, pwzLocation);
...@@ -66,11 +66,10 @@ HRESULT WINAPI HlinkCreateFromMoniker( IMoniker *pimkTrgt, LPCWSTR pwzLocation, ...@@ -66,11 +66,10 @@ HRESULT WINAPI HlinkCreateFromMoniker( IMoniker *pimkTrgt, LPCWSTR pwzLocation,
if (pihlsite) if (pihlsite)
IHlink_SetHlinkSite(hl, pihlsite, dwSiteData); IHlink_SetHlinkSite(hl, pihlsite, dwSiteData);
*ppvObj = hl; hr = IHlink_QueryInterface(hl, riid, ppvObj);
IHlink_Release(hl);
TRACE("Returning %lx\n",r);
return r; return hr;
} }
/*********************************************************************** /***********************************************************************
......
...@@ -2607,6 +2607,22 @@ static void test_HlinkUpdateStackItem(void) ...@@ -2607,6 +2607,22 @@ static void test_HlinkUpdateStackItem(void)
CHECK_CALLED(HLF_UpdateHlink); CHECK_CALLED(HLF_UpdateHlink);
} }
static void test_HlinkCreateFromMoniker(void)
{
IPersistStream *stream;
IMoniker *moniker;
HRESULT hr;
hr = CreateItemMoniker(L"1", L"1", &moniker);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = HlinkCreateFromMoniker(moniker, L"1", L"a", NULL, 0, NULL, &IID_IPersistStream, (void **)&stream);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
IPersistStream_Release(stream);
IMoniker_Release(moniker);
}
START_TEST(hlink) START_TEST(hlink)
{ {
CoInitialize(NULL); CoInitialize(NULL);
...@@ -2627,6 +2643,7 @@ START_TEST(hlink) ...@@ -2627,6 +2643,7 @@ START_TEST(hlink)
test_StdHlink(); test_StdHlink();
test_Hlink_Navigate(); test_Hlink_Navigate();
test_HlinkUpdateStackItem(); test_HlinkUpdateStackItem();
test_HlinkCreateFromMoniker();
CoUninitialize(); CoUninitialize();
} }
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