Commit ba40bbfc authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

hlink: Implement IHlinkBrowseContext_GetHlink().

parent a083415d
......@@ -234,20 +234,43 @@ static HRESULT WINAPI IHlinkBC_QueryHlink( IHlinkBrowseContext* iface,
return E_NOTIMPL;
}
static HRESULT WINAPI IHlinkBC_GetHlink( IHlinkBrowseContext* iface,
ULONG uHLID, IHlink** ppihl)
static HRESULT WINAPI IHlinkBC_GetHlink(IHlinkBrowseContext* iface, ULONG hlid, IHlink **ret)
{
HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface);
struct link_entry *link;
struct list *entry;
TRACE("(%p)->(%x %p)\n", This, uHLID, ppihl);
TRACE("(%p)->(0x%x %p)\n", This, hlid, ret);
if(uHLID != HLID_CURRENT) {
FIXME("Only HLID_CURRENT implemented, given: %x\n", uHLID);
return E_NOTIMPL;
switch (hlid)
{
case HLID_PREVIOUS:
entry = list_prev(&This->links, &This->current->entry);
break;
case HLID_NEXT:
entry = list_next(&This->links, &This->current->entry);
break;
case HLID_CURRENT:
entry = &This->current->entry;
break;
case HLID_STACKBOTTOM:
entry = list_tail(&This->links);
break;
case HLID_STACKTOP:
entry = list_head(&This->links);
break;
default:
WARN("unknown id 0x%x\n", hlid);
entry = NULL;
}
*ppihl = This->current->link;
IHlink_AddRef(*ppihl);
if (!entry)
return E_FAIL;
link = LIST_ENTRY(entry, struct link_entry, entry);
*ret = link->link;
IHlink_AddRef(*ret);
return S_OK;
}
......
......@@ -56,6 +56,13 @@ static void test_SetInitialHlink(void)
hres = IHlinkBrowseContext_SetInitialHlink(bc, dummy, five, NULL);
ok(hres == CO_E_ALREADYINITIALIZED, "got 0x%08x\n", hres);
/* there's only one */
hres = IHlinkBrowseContext_GetHlink(bc, HLID_PREVIOUS, &found_hlink);
ok(hres == E_FAIL, "got 0x%08x\n", hres);
hres = IHlinkBrowseContext_GetHlink(bc, HLID_NEXT, &found_hlink);
ok(hres == E_FAIL, "got 0x%08x\n", hres);
hres = IHlinkBrowseContext_GetHlink(bc, HLID_CURRENT, &found_hlink);
ok(hres == S_OK, "GetHlink failed: 0x%08x\n", hres);
......
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