shell32: Set shelllink path when setting pidl.

Signed-off-by: Vincent Povirk <vincent@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Vincent Povirk 2017-09-25 15:35:21 -05:00 committed by Alexandre Julliard
parent 94378704f8
commit 3615db9a00
2 changed files with 13 additions and 1 deletions

View File

@ -1680,6 +1680,7 @@ static HRESULT WINAPI IShellLinkW_fnGetIDList(IShellLinkW * iface, LPITEMIDLIST
static HRESULT WINAPI IShellLinkW_fnSetIDList(IShellLinkW * iface, LPCITEMIDLIST pidl)
{
IShellLinkImpl *This = impl_from_IShellLinkW(iface);
WCHAR path[MAX_PATH];
TRACE("(%p)->(pidl=%p)\n",This, pidl);
@ -1689,6 +1690,18 @@ static HRESULT WINAPI IShellLinkW_fnSetIDList(IShellLinkW * iface, LPCITEMIDLIST
if( !This->pPidl )
return E_FAIL;
HeapFree( GetProcessHeap(), 0, This->sPath );
This->sPath = NULL;
if ( SHGetPathFromIDListW( pidl, path ) )
{
This->sPath = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(path)+1)*sizeof(WCHAR));
if (!This->sPath)
return E_OUTOFMEMORY;
lstrcpyW(This->sPath, path);
}
This->bDirty = TRUE;
return S_OK;

View File

@ -239,7 +239,6 @@ static void test_get_set(void)
strcpy(buffer,"garbage");
r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH);
ok(r == S_OK, "GetPath failed (0x%08x)\n", r);
todo_wine
ok(lstrcmpiA(buffer, mypath)==0, "GetPath returned '%s'\n", buffer);
}