Nikolay Sivov : hlink: Implement IHlinkBrowseContext_UpdateHlink().

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


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

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

hlink: Implement IHlinkBrowseContext_UpdateHlink().

---

 dlls/hlink/browse_ctx.c |   80 +++++++++++++++++++++++++++++-----------------
 1 files changed, 50 insertions(+), 30 deletions(-)

diff --git a/dlls/hlink/browse_ctx.c b/dlls/hlink/browse_ctx.c
index 48a20cb..d09d59d 100644
--- a/dlls/hlink/browse_ctx.c
+++ b/dlls/hlink/browse_ctx.c
@@ -212,12 +212,56 @@ static HRESULT WINAPI IHlinkBC_OnNavigateHlink(IHlinkBrowseContext *iface,
     return S_OK;
 }
 
+static struct link_entry *context_get_entry(HlinkBCImpl *ctxt, ULONG hlid)
+{
+    struct list *entry;
+
+    switch (hlid)
+    {
+    case HLID_PREVIOUS:
+        entry = list_prev(&ctxt->links, &ctxt->current->entry);
+        break;
+    case HLID_NEXT:
+        entry = list_next(&ctxt->links, &ctxt->current->entry);
+        break;
+    case HLID_CURRENT:
+        entry = &ctxt->current->entry;
+        break;
+    case HLID_STACKBOTTOM:
+        entry = list_tail(&ctxt->links);
+        break;
+    case HLID_STACKTOP:
+        entry = list_head(&ctxt->links);
+        break;
+    default:
+        WARN("unknown id 0x%x\n", hlid);
+        entry = NULL;
+    }
+
+    return entry ? LIST_ENTRY(entry, struct link_entry, entry) : NULL;
+}
+
 static HRESULT WINAPI IHlinkBC_UpdateHlink(IHlinkBrowseContext* iface,
-        ULONG uHLID, IMoniker* pimkTarget, LPCWSTR pwzLocation,
-        LPCWSTR pwzFriendlyName)
+        ULONG hlid, IMoniker *target, LPCWSTR location, LPCWSTR friendly_name)
 {
-    FIXME("\n");
-    return E_NOTIMPL;
+    HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface);
+    struct link_entry *entry = context_get_entry(This, hlid);
+    IHlink *link;
+    HRESULT hr;
+
+    TRACE("(%p)->(0x%x %p %s %s)\n", This, hlid, target, debugstr_w(location), debugstr_w(friendly_name));
+
+    if (!entry)
+        return E_INVALIDARG;
+
+    hr = HlinkCreateFromMoniker(target, location, friendly_name, NULL, 0, NULL, &IID_IHlink, (void**)&link);
+    if (FAILED(hr))
+        return hr;
+
+    IHlink_Release(entry->link);
+    entry->link = link;
+
+    return S_OK;
 }
 
 static HRESULT WINAPI IHlinkBC_EnumNavigationStack( IHlinkBrowseContext *iface,
@@ -238,37 +282,13 @@ static HRESULT WINAPI IHlinkBC_GetHlink(IHlinkBrowseContext* iface, ULONG hlid,
 {
     HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface);
     struct link_entry *link;
-    struct list *entry;
 
     TRACE("(%p)->(0x%x %p)\n", This, hlid, ret);
 
-    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;
-    }
-
-    if (!entry)
+    link = context_get_entry(This, hlid);
+    if (!link)
         return E_FAIL;
 
-    link = LIST_ENTRY(entry, struct link_entry, entry);
-
     *ret = link->link;
     IHlink_AddRef(*ret);
 




More information about the wine-cvs mailing list