Vincent Povirk : shell32: Set shelllink path when setting pidl.
Module: wine Branch: master Commit: 3615db9a005517a32ccbfcf3f296d298135c9ba2 URL: http://source.winehq.org/git/wine.git/?a=commit;h=3615db9a005517a32ccbfcf3f2... Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Mon Sep 25 15:35:21 2017 -0500 shell32: Set shelllink path when setting pidl. Signed-off-by: Vincent Povirk <vincent(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/shell32/shelllink.c | 13 +++++++++++++ dlls/shell32/tests/shelllink.c | 1 - 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/dlls/shell32/shelllink.c b/dlls/shell32/shelllink.c index 81d76d9..ba33477 100644 --- a/dlls/shell32/shelllink.c +++ b/dlls/shell32/shelllink.c @@ -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; diff --git a/dlls/shell32/tests/shelllink.c b/dlls/shell32/tests/shelllink.c index ba73e94..7326516 100644 --- a/dlls/shell32/tests/shelllink.c +++ b/dlls/shell32/tests/shelllink.c @@ -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); }
participants (1)
-
Alexandre Julliard