shell32: simplify cut/copy operations

Daniel Jeliński djelinski1 at gmail.com
Sun Aug 18 11:12:57 CDT 2013


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20130818/7e404d4a/attachment.html>
-------------- next part --------------
From 60deaf66e4c4060284ba1090ea5928fcb8363f93 Mon Sep 17 00:00:00 2001
From: Daniel Jelinski <djelinski1 at gmail.com>
Date: Sun, 11 Aug 2013 01:02:58 +0200
Subject: shell32: simplify cut/copy operations

allows Cut & Copy to work in Total commander (currently they fail because SendMessage returns 0).
With this patch Cut and Copy from TC to wine explorer work fine (except that they both work as Copy).
Without explicit cast to LPCITEMIDLIST* gcc throws a warning.
---
 dlls/shell32/shlview_cmenu.c | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/dlls/shell32/shlview_cmenu.c b/dlls/shell32/shlview_cmenu.c
index 6004afc..4c4edef 100644
--- a/dlls/shell32/shlview_cmenu.c
+++ b/dlls/shell32/shlview_cmenu.c
@@ -257,29 +257,17 @@ static void DoDelete(ContextMenu *This)
  *
  * copies the currently selected items into the clipboard
  */
-static BOOL DoCopyOrCut(ContextMenu *This, HWND hwnd, BOOL cut)
+static void DoCopyOrCut(ContextMenu *This, HWND hwnd, BOOL cut)
 {
     IDataObject *dataobject;
-    IShellBrowser *browser;
-    IShellView *view;
 
     TRACE("(%p)->(wnd=%p, cut=%d)\n", This, hwnd, cut);
 
-    /* get the active IShellView */
-    if ((browser = (IShellBrowser*)SendMessageA(hwnd, CWM_GETISHELLBROWSER, 0, 0)))
+    if (SUCCEEDED(IShellFolder_GetUIObjectOf(This->parent, hwnd, This->cidl, (LPCITEMIDLIST*)This->apidl, &IID_IDataObject, 0, (void**)&dataobject)))
     {
-        if (SUCCEEDED(IShellBrowser_QueryActiveShellView(browser, &view)))
-        {
-            if (SUCCEEDED(IShellView_GetItemObject(view, SVGIO_SELECTION, &IID_IDataObject, (void**)&dataobject)))
-	    {
-                OleSetClipboard(dataobject);
-                IDataObject_Release(dataobject);
-	    }
-            IShellView_Release(view);
-        }
+        OleSetClipboard(dataobject);
+        IDataObject_Release(dataobject);
     }
-
-    return TRUE;
 }
 
 /**************************************************************************
-- 
1.8.1.2


More information about the wine-patches mailing list