Nikolay Sivov : wshom.ocx: Implement IWshShortcut_put_Description().

Alexandre Julliard julliard at winehq.org
Tue Jan 3 12:52:52 CST 2012


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Mon Jan  2 15:10:43 2012 +0300

wshom.ocx: Implement IWshShortcut_put_Description().

---

 dlls/wshom.ocx/shell.c |   27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/dlls/wshom.ocx/shell.c b/dlls/wshom.ocx/shell.c
index 949707d..0ab5080 100644
--- a/dlls/wshom.ocx/shell.c
+++ b/dlls/wshom.ocx/shell.c
@@ -70,6 +70,9 @@ typedef struct
 {
     IWshShortcut IWshShortcut_iface;
     LONG ref;
+
+    IShellLinkW *link;
+    BSTR path_link;
 } WshShortcut;
 
 static inline WshCollection *impl_from_IWshCollection( IWshCollection *iface )
@@ -315,7 +318,11 @@ static ULONG WINAPI WshShortcut_Release(IWshShortcut *iface)
     TRACE("(%p) ref = %d\n", This, ref);
 
     if (!ref)
+    {
+        SysFreeString(This->path_link);
+        IShellLinkW_Release(This->link);
         HeapFree(GetProcessHeap(), 0, This);
+    }
 
     return ref;
 }
@@ -406,8 +413,8 @@ static HRESULT WINAPI WshShortcut_get_Description(IWshShortcut *iface, BSTR *Des
 static HRESULT WINAPI WshShortcut_put_Description(IWshShortcut *iface, BSTR Description)
 {
     WshShortcut *This = impl_from_IWshShortcut(iface);
-    FIXME("(%p)->(%s): stub\n", This, debugstr_w(Description));
-    return E_NOTIMPL;
+    TRACE("(%p)->(%s)\n", This, debugstr_w(Description));
+    return IShellLinkW_SetDescription(This->link, Description);
 }
 
 static HRESULT WINAPI WshShortcut_get_Hotkey(IWshShortcut *iface, BSTR *Hotkey)
@@ -529,9 +536,12 @@ static const IWshShortcutVtbl WshShortcutVtbl = {
     WshShortcut_Save
 };
 
-static HRESULT WshShortcut_Create(IDispatch **shortcut)
+static HRESULT WshShortcut_Create(const WCHAR *path, IDispatch **shortcut)
 {
     WshShortcut *This;
+    HRESULT hr;
+
+    *shortcut = NULL;
 
     This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
     if (!This) return E_OUTOFMEMORY;
@@ -539,6 +549,15 @@ static HRESULT WshShortcut_Create(IDispatch **shortcut)
     This->IWshShortcut_iface.lpVtbl = &WshShortcutVtbl;
     This->ref = 1;
 
+    hr = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
+            &IID_IShellLinkW, (void**)&This->link);
+    if (FAILED(hr))
+    {
+        HeapFree(GetProcessHeap(), 0, This);
+        return hr;
+    }
+
+    This->path_link = SysAllocString(path);
     *shortcut = (IDispatch*)&This->IWshShortcut_iface;
 
     return S_OK;
@@ -654,7 +673,7 @@ static HRESULT WINAPI WshShell3_Popup(IWshShell3 *iface, BSTR Text, VARIANT* Sec
 static HRESULT WINAPI WshShell3_CreateShortcut(IWshShell3 *iface, BSTR PathLink, IDispatch** Shortcut)
 {
     TRACE("(%s %p)\n", debugstr_w(PathLink), Shortcut);
-    return WshShortcut_Create(Shortcut);
+    return WshShortcut_Create(PathLink, Shortcut);
 }
 
 static HRESULT WINAPI WshShell3_ExpandEnvironmentStrings(IWshShell3 *iface, BSTR Src, BSTR* out_Dst)




More information about the wine-cvs mailing list