Nikolay Sivov : wshom.ocx: Implement IWshShell3::ExpandEnvironmentStrings() .
Alexandre Julliard
julliard at winehq.org
Mon Oct 28 15:13:05 CDT 2013
Module: wine
Branch: master
Commit: 71ecb55661a8cf14a0e19b94749f1d8957c9ab16
URL: http://source.winehq.org/git/wine.git/?a=commit;h=71ecb55661a8cf14a0e19b94749f1d8957c9ab16
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Sun Oct 27 12:28:06 2013 +0400
wshom.ocx: Implement IWshShell3::ExpandEnvironmentStrings().
---
dlls/wshom.ocx/shell.c | 22 +++++++++++++++++++---
dlls/wshom.ocx/tests/wshom.c | 10 ++++++++++
2 files changed, 29 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)
diff --git a/dlls/wshom.ocx/tests/wshom.c b/dlls/wshom.ocx/tests/wshom.c
index b2f60a8..50adb90 100644
--- a/dlls/wshom.ocx/tests/wshom.c
+++ b/dlls/wshom.ocx/tests/wshom.c
@@ -35,6 +35,7 @@ static void test_wshshell(void)
{
static const WCHAR desktopW[] = {'D','e','s','k','t','o','p',0};
static const WCHAR lnk1W[] = {'f','i','l','e','.','l','n','k',0};
+ static const WCHAR pathW[] = {'%','P','A','T','H','%',0};
IWshShell3 *sh3;
IDispatchEx *dispex;
IWshCollection *coll;
@@ -113,6 +114,15 @@ static void test_wshshell(void)
IUnknown_Release(unk);
IDispatch_Release(shortcut);
+ /* ExpandEnvironmentStrings */
+ hr = IWshShell3_ExpandEnvironmentStrings(sh3, NULL, NULL);
+ ok(hr == E_POINTER, "got 0x%08x\n", hr);
+
+ str = SysAllocString(pathW);
+ hr = IWshShell3_ExpandEnvironmentStrings(sh3, str, NULL);
+ ok(hr == E_POINTER, "got 0x%08x\n", hr);
+ SysFreeString(str);
+
IWshCollection_Release(coll);
IDispatch_Release(disp);
IWshShell3_Release(sh3);
More information about the wine-cvs
mailing list