Nikolay Sivov : hlink: Implement IHlinkBrowseContext_GetHlink().

Alexandre Julliard julliard at winehq.org
Tue Mar 26 15:11:12 CDT 2013


Module: wine
Branch: master
Commit: ba40bbfcbf41d1e7f96e96493334f7ba75a696c5
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ba40bbfcbf41d1e7f96e96493334f7ba75a696c5

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Mon Mar 25 17:44:31 2013 +0400

hlink: Implement IHlinkBrowseContext_GetHlink().

---

 dlls/hlink/browse_ctx.c       |   41 ++++++++++++++++++++++++++++++++---------
 dlls/hlink/tests/browse_ctx.c |    7 +++++++
 2 files changed, 39 insertions(+), 9 deletions(-)

diff --git a/dlls/hlink/browse_ctx.c b/dlls/hlink/browse_ctx.c
index 0bfc061..48a20cb 100644
--- a/dlls/hlink/browse_ctx.c
+++ b/dlls/hlink/browse_ctx.c
@@ -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);
+    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;
 }
diff --git a/dlls/hlink/tests/browse_ctx.c b/dlls/hlink/tests/browse_ctx.c
index df801ab..40d132b 100644
--- a/dlls/hlink/tests/browse_ctx.c
+++ b/dlls/hlink/tests/browse_ctx.c
@@ -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);
 




More information about the wine-cvs mailing list