Author: spetreolle
Date: Tue Mar 15 15:37:09 2011
New Revision: 51053

URL: http://svn.reactos.org/svn/reactos?rev=51053&view=rev
Log:
[SHELL32]
Fix missing "Open" menu entry on right click for All Users desktop shortcuts.
Patch by Thomas Faber <thfabba at gmx dot de>

See issue #5998 for more details.

Modified:
    trunk/reactos/dll/win32/shell32/clipboard.c

Modified: trunk/reactos/dll/win32/shell32/clipboard.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/clipboard.c?rev=51053&r1=51052&r2=51053&view=diff
==============================================================================
--- trunk/reactos/dll/win32/shell32/clipboard.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/clipboard.c [iso-8859-1] Tue Mar 15 
15:37:09 2011
@@ -47,26 +47,26 @@
 HGLOBAL RenderHDROP(LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl)
 {
        UINT i;
-       int rootlen = 0,size = 0;
-       WCHAR wszRootPath[MAX_PATH];
+       int size = 0;
        WCHAR wszFileName[MAX_PATH];
        HGLOBAL hGlobal;
        DROPFILES *pDropFiles;
        int offset;
-
-       TRACE("(%p,%p,%u)\n", pidlRoot, apidl, cidl);
+       LPITEMIDLIST *pidls;
+
+       TRACE("(%p,%p,%u)\n", pidlRoot, apidl, cidl);
+
+       pidls = HeapAlloc(GetProcessHeap(), 0, cidl * sizeof *pidls);
+       if (!pidls) return NULL;
 
        /* get the size needed */
        size = sizeof(DROPFILES);
 
-       SHGetPathFromIDListW(pidlRoot, wszRootPath);
-       PathAddBackslashW(wszRootPath);
-       rootlen = wcslen(wszRootPath);
-
        for (i=0; i<cidl;i++)
        {
-         _ILSimpleGetTextW(apidl[i], wszFileName, MAX_PATH);
-         size += (rootlen + wcslen(wszFileName) + 1) * sizeof(WCHAR);
+         pidls[i] = ILCombine(pidlRoot, apidl[i]);
+         SHGetPathFromIDListW(pidls[i], wszFileName);
+         size += (wcslen(wszFileName) + 1) * sizeof(WCHAR);
        }
 
        size += sizeof(WCHAR);
@@ -80,18 +80,18 @@
         pDropFiles->pFiles = offset * sizeof(WCHAR);
         pDropFiles->fWide = TRUE;
 
-       wcscpy(wszFileName, wszRootPath);
-
        for (i=0; i<cidl;i++)
        {
-
-         _ILSimpleGetTextW(apidl[i], wszFileName + rootlen, MAX_PATH - 
rootlen);
+         SHGetPathFromIDListW(pidls[i], wszFileName);
          wcscpy(((WCHAR*)pDropFiles)+offset, wszFileName);
          offset += wcslen(wszFileName) + 1;
+         ILFree(pidls[i]);
        }
 
        ((WCHAR*)pDropFiles)[offset] = 0;
        GlobalUnlock(hGlobal);
+
+       HeapFree(GetProcessHeap(), 0, pidls);
 
        return hGlobal;
 }


Reply via email to