[3/5] shell32: Set shelllink path when setting pidl.

Vincent Povirk vincent at codeweavers.com
Mon Sep 25 15:35:21 CDT 2017


Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
---
 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);
     }
 
-- 
2.7.4




More information about the wine-patches mailing list