mirror of
https://github.com/reactos/wine.git
synced 2025-02-07 04:29:02 +00:00
wshom: Implement LocationPath property for shortcut.
This commit is contained in:
parent
0e73e478ff
commit
9239b86037
@ -451,16 +451,57 @@ static HRESULT WINAPI WshShortcut_put_Hotkey(IWshShortcut *iface, BSTR Hotkey)
|
|||||||
|
|
||||||
static HRESULT WINAPI WshShortcut_get_IconLocation(IWshShortcut *iface, BSTR *IconPath)
|
static HRESULT WINAPI WshShortcut_get_IconLocation(IWshShortcut *iface, BSTR *IconPath)
|
||||||
{
|
{
|
||||||
|
static const WCHAR fmtW[] = {'%','s',',',' ','%','d',0};
|
||||||
WshShortcut *This = impl_from_IWshShortcut(iface);
|
WshShortcut *This = impl_from_IWshShortcut(iface);
|
||||||
FIXME("(%p)->(%p): stub\n", This, IconPath);
|
WCHAR buffW[MAX_PATH], pathW[MAX_PATH];
|
||||||
return E_NOTIMPL;
|
INT icon = 0;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
TRACE("(%p)->(%p)\n", This, IconPath);
|
||||||
|
|
||||||
|
if (!IconPath)
|
||||||
|
return E_POINTER;
|
||||||
|
|
||||||
|
hr = IShellLinkW_GetIconLocation(This->link, buffW, sizeof(buffW)/sizeof(WCHAR), &icon);
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
|
||||||
|
sprintfW(pathW, fmtW, buffW, icon);
|
||||||
|
*IconPath = SysAllocString(pathW);
|
||||||
|
if (!*IconPath) return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI WshShortcut_put_IconLocation(IWshShortcut *iface, BSTR IconPath)
|
static HRESULT WINAPI WshShortcut_put_IconLocation(IWshShortcut *iface, BSTR IconPath)
|
||||||
{
|
{
|
||||||
WshShortcut *This = impl_from_IWshShortcut(iface);
|
WshShortcut *This = impl_from_IWshShortcut(iface);
|
||||||
FIXME("(%p)->(%s): stub\n", This, debugstr_w(IconPath));
|
HRESULT hr;
|
||||||
return E_NOTIMPL;
|
WCHAR *ptr;
|
||||||
|
BSTR path;
|
||||||
|
INT icon;
|
||||||
|
|
||||||
|
TRACE("(%p)->(%s)\n", This, debugstr_w(IconPath));
|
||||||
|
|
||||||
|
/* scan for icon id */
|
||||||
|
ptr = strrchrW(IconPath, ',');
|
||||||
|
if (!ptr)
|
||||||
|
{
|
||||||
|
WARN("icon index not found\n");
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
path = SysAllocStringLen(IconPath, ptr-IconPath);
|
||||||
|
|
||||||
|
/* skip spaces if any */
|
||||||
|
while (isspaceW(*++ptr))
|
||||||
|
;
|
||||||
|
|
||||||
|
icon = atoiW(ptr);
|
||||||
|
|
||||||
|
hr = IShellLinkW_SetIconLocation(This->link, path, icon);
|
||||||
|
SysFreeString(path);
|
||||||
|
|
||||||
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI WshShortcut_put_RelativePath(IWshShortcut *iface, BSTR rhs)
|
static HRESULT WINAPI WshShortcut_put_RelativePath(IWshShortcut *iface, BSTR rhs)
|
||||||
|
@ -116,6 +116,9 @@ static void test_wshshell(void)
|
|||||||
hr = IWshShortcut_get_Arguments(shcut, NULL);
|
hr = IWshShortcut_get_Arguments(shcut, NULL);
|
||||||
ok(hr == E_POINTER, "got 0x%08x\n", hr);
|
ok(hr == E_POINTER, "got 0x%08x\n", hr);
|
||||||
|
|
||||||
|
hr = IWshShortcut_get_IconLocation(shcut, NULL);
|
||||||
|
ok(hr == E_POINTER, "got 0x%08x\n", hr);
|
||||||
|
|
||||||
IWshShortcut_Release(shcut);
|
IWshShortcut_Release(shcut);
|
||||||
IDispatch_Release(shortcut);
|
IDispatch_Release(shortcut);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user