Commit 71ecb556 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

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

parent f3c805be
......@@ -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)
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment