>From 377012019a071138250256d18d21ad74e823b996 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov@codeweavers.com>
Date: Tue, 10 Jan 2012 16:02:44 +0300
Subject: [PATCH 3/4] Get rid of rename helper

---
 dlls/shell32/shv_item_cmenu.c |   43 +++++++++++++++++-----------------------
 1 files changed, 18 insertions(+), 25 deletions(-)

diff --git a/dlls/shell32/shv_item_cmenu.c b/dlls/shell32/shv_item_cmenu.c
index ac91f37..06169c5 100644
--- a/dlls/shell32/shv_item_cmenu.c
+++ b/dlls/shell32/shv_item_cmenu.c
@@ -260,29 +260,6 @@ static void DoOpenExplore(ItemCmImpl *This, HWND hwnd, LPCSTR verb)
 }
 
 /**************************************************************************
-* DoRename
-*/
-static void DoRename(ItemCmImpl *This, HWND hwnd)
-{
-	LPSHELLBROWSER	lpSB;
-	LPSHELLVIEW	lpSV;
-
-	TRACE("(%p)->(wnd=%p)\n",This, hwnd);
-
-	/* get the active IShellView */
-	if ((lpSB = (LPSHELLBROWSER)SendMessageA(hwnd, CWM_GETISHELLBROWSER,0,0)))
-	{
-	  if(SUCCEEDED(IShellBrowser_QueryActiveShellView(lpSB, &lpSV)))
-	  {
-	    TRACE("(sv=%p)\n",lpSV);
-	    IShellView_SelectItem(lpSV, This->apidl[0],
-              SVSI_DESELECTOTHERS|SVSI_EDIT|SVSI_ENSUREVISIBLE|SVSI_FOCUSED|SVSI_SELECT);
-	    IShellView_Release(lpSV);
-	  }
-	}
-}
-
-/**************************************************************************
  * DoDelete
  *
  * deletes the currently selected items
@@ -479,9 +456,25 @@ static HRESULT WINAPI ISvItemCm_fnInvokeCommand(
             DoOpenExplore(This, lpcmi->hwnd, "open");
             break;
         case FCIDM_SHVIEW_RENAME:
-            TRACE("Verb FCIDM_SHVIEW_RENAME\n");
-            DoRename(This, lpcmi->hwnd);
+        {
+            IShellBrowser *browser;
+
+            /* get the active IShellView */
+            browser = (IShellBrowser*)SendMessageA(lpcmi->hwnd, CWM_GETISHELLBROWSER, 0, 0);
+            if (browser)
+            {
+                IShellView *view;
+
+                if(SUCCEEDED(IShellBrowser_QueryActiveShellView(browser, &view)))
+                {
+                    TRACE("(shellview=%p)\n", view);
+                    IShellView_SelectItem(view, This->apidl[0],
+                         SVSI_DESELECTOTHERS|SVSI_EDIT|SVSI_ENSUREVISIBLE|SVSI_FOCUSED|SVSI_SELECT);
+                    IShellView_Release(view);
+                }
+            }
             break;
+        }
         case FCIDM_SHVIEW_DELETE:
             TRACE("Verb FCIDM_SHVIEW_DELETE\n");
             DoDelete(This);
-- 
1.5.6.5


