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

This commit is contained in:
Nikolay Sivov 2013-10-27 12:28:06 +04:00 committed by Alexandre Julliard
parent f3c805be67
commit 71ecb55661
2 changed files with 29 additions and 3 deletions

View file

@ -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)

View file

@ -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);