Nikolay Sivov : wshom.ocx: Implement IWshShell3::ExpandEnvironmentStrings( ).

Alexandre Julliard julliard at winehq.org
Fri Jan 10 14:44:53 CST 2014


Module: wine
Branch: stable
Commit: 73ab03c3a2f9b4bef109f2dca3b1b570a470a394
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=73ab03c3a2f9b4bef109f2dca3b1b570a470a394

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sun Oct 27 12:28:06 2013 +0400

wshom.ocx: Implement IWshShell3::ExpandEnvironmentStrings().

(cherry picked from commit 71ecb55661a8cf14a0e19b94749f1d8957c9ab16)

---

 dlls/wshom.ocx/shell.c |   22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/dlls/wshom.ocx/shell.c b/dlls/wshom.ocx/shell.c
index 17d0306..385d2a3 100644
--- a/dlls/wshom.ocx/shell.c
+++ b/dlls/wshom.ocx/shell.c
@@ -745,10 +745,26 @@ static HRESULT WINAPI WshShell3_CreateShortcut(IWshShell3 *iface, BSTR PathLink,
     return WshShortcut_Create(PathLink, Shortcut);
 }
 
-static HRESULT WINAPI WshShell3_ExpandEnvironmentStrings(IWshShell3 *iface, BSTR Src, BSTR* out_Dst)
+static HRESULT WINAPI WshShell3_ExpandEnvironmentStrings(IWshShell3 *iface, BSTR Src, BSTR* Dst)
 {
-    FIXME("(%s %p): stub\n", debugstr_w(Src), out_Dst);
-    return E_NOTIMPL;
+    DWORD ret;
+
+    TRACE("(%s %p)\n", debugstr_w(Src), Dst);
+
+    if (!Src || !Dst) return E_POINTER;
+
+    ret = ExpandEnvironmentStringsW(Src, NULL, 0);
+    *Dst = SysAllocStringLen(NULL, ret);
+    if (!*Dst) return E_OUTOFMEMORY;
+
+    if (ExpandEnvironmentStringsW(Src, *Dst, ret))
+        return S_OK;
+    else
+    {
+        SysFreeString(*Dst);
+        *Dst = NULL;
+        return HRESULT_FROM_WIN32(GetLastError());
+    }
 }
 
 static HRESULT WINAPI WshShell3_RegRead(IWshShell3 *iface, BSTR Name, VARIANT* out_Value)




More information about the wine-cvs mailing list