Author: gedmurphy
Date: Wed May 25 20:36:21 2011
New Revision: 51910

URL: http://svn.reactos.org/svn/reactos?rev=51910&view=rev
Log:
[SHELL32_NEW]
- Merge 50899, 50941, 50957, 50964, 51053

- Check the correct pidl instead of the free one
- Found by the amazing DPH!
- Return the icon index, not the icon id
-Fix missing "Open" menu entry on right click for All Users desktop shortcuts.

Modified:
    branches/shell32_new-bringup/dll/win32/shell32/clipboard.cpp
    branches/shell32_new-bringup/dll/win32/shell32/dialogs.cpp
    branches/shell32_new-bringup/dll/win32/shell32/iconcache.cpp
    branches/shell32_new-bringup/dll/win32/shell32/she_ocmenu.cpp
    branches/shell32_new-bringup/dll/win32/shell32/shlview.cpp

Modified: branches/shell32_new-bringup/dll/win32/shell32/clipboard.cpp
URL: 
http://svn.reactos.org/svn/reactos/branches/shell32_new-bringup/dll/win32/shell32/clipboard.cpp?rev=51910&r1=51909&r2=51910&view=diff
==============================================================================
--- branches/shell32_new-bringup/dll/win32/shell32/clipboard.cpp [iso-8859-1] 
(original)
+++ branches/shell32_new-bringup/dll/win32/shell32/clipboard.cpp [iso-8859-1] 
Wed May 25 20:36:21 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 = (LPITEMIDLIST *)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;
 }

Modified: branches/shell32_new-bringup/dll/win32/shell32/dialogs.cpp
URL: 
http://svn.reactos.org/svn/reactos/branches/shell32_new-bringup/dll/win32/shell32/dialogs.cpp?rev=51910&r1=51909&r2=51910&view=diff
==============================================================================
--- branches/shell32_new-bringup/dll/win32/shell32/dialogs.cpp [iso-8859-1] 
(original)
+++ branches/shell32_new-bringup/dll/win32/shell32/dialogs.cpp [iso-8859-1] Wed 
May 25 20:36:21 2011
@@ -63,7 +63,7 @@
     PPICK_ICON_CONTEXT pIconContext = (PPICK_ICON_CONTEXT)lParam;
 
     if (IS_INTRESOURCE(lpszName))
-        swprintf(szName, L"%u\n", lpszName);
+        swprintf(szName, L"%u", lpszName);
     else
         wcscpy(szName, (WCHAR*)lpszName);
 
@@ -105,7 +105,7 @@
     LPMEASUREITEMSTRUCT lpmis; 
     LPDRAWITEMSTRUCT lpdis; 
     HICON hIcon;
-    INT index;
+    INT index, count;
     WCHAR szText[MAX_PATH], szTitle[100], szFilter[100];
     OPENFILENAMEW ofn = {0};
 
@@ -123,18 +123,21 @@
         else
             SendDlgItemMessageW(hwndDlg, IDC_EDIT_PATH, WM_SETTEXT, 0, 
(LPARAM)pIconContext->szName);
 
-        swprintf(szText, L"%u", pIconContext->Index);
-        index = SendMessageW(pIconContext->hDlgCtrl, LB_FINDSTRING, -1, 
(LPARAM)szText);
-        if (index != LB_ERR)
-            SendMessageW(pIconContext->hDlgCtrl, LB_SETCURSEL, index, 0);
+        count = SendMessage(pIconContext->hDlgCtrl, LB_GETCOUNT, 0, 0);
+        if (count != LB_ERR)
+        {
+            if (count > pIconContext->Index)
+                SendMessageW(pIconContext->hDlgCtrl, LB_SETCURSEL, 
pIconContext->Index, 0);
+            else
+                SendMessageW(pIconContext->hDlgCtrl, LB_SETCURSEL, 0, 0);
+        }
         return TRUE;
     case WM_COMMAND:
         switch(LOWORD(wParam))
         {
         case IDOK:
             index = SendMessageW(pIconContext->hDlgCtrl, LB_GETCURSEL, 0, 0);
-            SendMessageW(pIconContext->hDlgCtrl, LB_GETTEXT, index, 
(LPARAM)szText);
-            pIconContext->Index = _wtoi(szText);
+            pIconContext->Index = index;
             SendDlgItemMessageW(hwndDlg, IDC_EDIT_PATH, WM_GETTEXT, MAX_PATH, 
(LPARAM)pIconContext->szName);
             DestroyIconList(pIconContext->hDlgCtrl);
             EndDialog(hwndDlg, 1);

Modified: branches/shell32_new-bringup/dll/win32/shell32/iconcache.cpp
URL: 
http://svn.reactos.org/svn/reactos/branches/shell32_new-bringup/dll/win32/shell32/iconcache.cpp?rev=51910&r1=51909&r2=51910&view=diff
==============================================================================
--- branches/shell32_new-bringup/dll/win32/shell32/iconcache.cpp [iso-8859-1] 
(original)
+++ branches/shell32_new-bringup/dll/win32/shell32/iconcache.cpp [iso-8859-1] 
Wed May 25 20:36:21 2011
@@ -183,8 +183,8 @@
     if (NULL == SelectObject(ShortcutDC, ShortcutIconInfo.hbmColor)) goto fail;
     if (!MaskBlt(TargetDC, 0, SourceBitmapInfo.bmHeight - 
ShortcutBitmapInfo.bmHeight,
                  ShortcutBitmapInfo.bmWidth, ShortcutBitmapInfo.bmHeight,
-                 ShortcutDC, 0, 0, ShortcutIconInfo.hbmMask, 0, 0, 
-                 MAKEROP4(SRCCOPY, 0xAA0000)))
+                 ShortcutDC, 0, 0, ShortcutIconInfo.hbmMask, 0, 0,
+                 MAKEROP4(0xAA0000, SRCCOPY)))
     {
         goto fail;
     }

Modified: branches/shell32_new-bringup/dll/win32/shell32/she_ocmenu.cpp
URL: 
http://svn.reactos.org/svn/reactos/branches/shell32_new-bringup/dll/win32/shell32/she_ocmenu.cpp?rev=51910&r1=51909&r2=51910&view=diff
==============================================================================
--- branches/shell32_new-bringup/dll/win32/shell32/she_ocmenu.cpp [iso-8859-1] 
(original)
+++ branches/shell32_new-bringup/dll/win32/shell32/she_ocmenu.cpp [iso-8859-1] 
Wed May 25 20:36:21 2011
@@ -1059,8 +1059,8 @@
         ERR("no mem\n");
         return E_OUTOFMEMORY;
     }
-    if (_ILIsDesktop(pidl_child) || _ILIsMyDocuments(pidl_child) || 
_ILIsControlPanel(pidl_child) || _ILIsNetHood(pidl_child) ||
-        _ILIsBitBucket(pidl_child) || _ILIsDrive(pidl_child) || 
_ILIsCPanelStruct(pidl_child) || _ILIsFolder(pidl_child) || 
_ILIsControlPanel(pidl_folder))
+    if (_ILIsDesktop(pidl) || _ILIsMyDocuments(pidl) || 
_ILIsControlPanel(pidl) || _ILIsNetHood(pidl) ||
+        _ILIsBitBucket(pidl) || _ILIsDrive(pidl) || _ILIsCPanelStruct(pidl) || 
_ILIsFolder(pidl) || _ILIsControlPanel(pidl))
     {
         TRACE("pidl is a folder\n");
         SHFree((void*)pidl);

Modified: branches/shell32_new-bringup/dll/win32/shell32/shlview.cpp
URL: 
http://svn.reactos.org/svn/reactos/branches/shell32_new-bringup/dll/win32/shell32/shlview.cpp?rev=51910&r1=51909&r2=51910&view=diff
==============================================================================
--- branches/shell32_new-bringup/dll/win32/shell32/shlview.cpp [iso-8859-1] 
(original)
+++ branches/shell32_new-bringup/dll/win32/shell32/shlview.cpp [iso-8859-1] Wed 
May 25 20:36:21 2011
@@ -1712,7 +1712,7 @@
 
          case LVN_ENDLABELEDITW:
            {
-             TRACE("-- LVN_ENDLABELEDITA %p\n", this);
+             TRACE("-- LVN_ENDLABELEDITW %p\n", this);
              if (lpdi->item.pszText)
              {
                HRESULT hr;


Reply via email to