wshom: Implement get_WorkingDirectory(), handle allocation failures.
This commit is contained in:
parent
9b037d559e
commit
2b1f2001b1
|
@ -409,7 +409,7 @@ static HRESULT WINAPI WshShortcut_get_Arguments(IWshShortcut *iface, BSTR *Argum
|
|||
return hr;
|
||||
|
||||
*Arguments = SysAllocString(buffW);
|
||||
return S_OK;
|
||||
return *Arguments ? S_OK : E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI WshShortcut_put_Arguments(IWshShortcut *iface, BSTR Arguments)
|
||||
|
@ -501,14 +501,26 @@ static HRESULT WINAPI WshShortcut_put_WindowStyle(IWshShortcut *iface, int ShowC
|
|||
static HRESULT WINAPI WshShortcut_get_WorkingDirectory(IWshShortcut *iface, BSTR *WorkingDirectory)
|
||||
{
|
||||
WshShortcut *This = impl_from_IWshShortcut(iface);
|
||||
FIXME("(%p)->(%p): stub\n", This, WorkingDirectory);
|
||||
return E_NOTIMPL;
|
||||
WCHAR buffW[MAX_PATH];
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, WorkingDirectory);
|
||||
|
||||
if (!WorkingDirectory)
|
||||
return E_POINTER;
|
||||
|
||||
*WorkingDirectory = NULL;
|
||||
hr = IShellLinkW_GetWorkingDirectory(This->link, buffW, sizeof(buffW)/sizeof(WCHAR));
|
||||
if (FAILED(hr)) return hr;
|
||||
|
||||
*WorkingDirectory = SysAllocString(buffW);
|
||||
return *WorkingDirectory ? S_OK : E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI WshShortcut_put_WorkingDirectory(IWshShortcut *iface, BSTR WorkingDirectory)
|
||||
{
|
||||
WshShortcut *This = impl_from_IWshShortcut(iface);
|
||||
TRACE("(%p)->(%s): stub\n", This, debugstr_w(WorkingDirectory));
|
||||
TRACE("(%p)->(%s)\n", This, debugstr_w(WorkingDirectory));
|
||||
return IShellLinkW_SetWorkingDirectory(This->link, WorkingDirectory);
|
||||
}
|
||||
|
||||
|
@ -584,6 +596,13 @@ static HRESULT WshShortcut_Create(const WCHAR *path, IDispatch **shortcut)
|
|||
}
|
||||
|
||||
This->path_link = SysAllocString(path);
|
||||
if (!This->path_link)
|
||||
{
|
||||
IShellLinkW_Release(This->link);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
*shortcut = (IDispatch*)&This->IWshShortcut_iface;
|
||||
|
||||
return S_OK;
|
||||
|
|
Loading…
Reference in New Issue