Hugh McMaster : regedit: Only allow key renaming via the Edit or Popup menus.

Alexandre Julliard julliard at winehq.org
Mon Jan 9 15:22:29 CST 2017


Module: wine
Branch: master
Commit: 1e1bfba1c459182b3a64c6d70b2a375e9e262390
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1e1bfba1c459182b3a64c6d70b2a375e9e262390

Author: Hugh McMaster <hugh.mcmaster at outlook.com>
Date:   Tue Jan  3 12:33:48 2017 +0000

regedit: Only allow key renaming via the Edit or Popup menus.

Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 programs/regedit/childwnd.c | 8 +++++++-
 programs/regedit/treeview.c | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/programs/regedit/childwnd.c b/programs/regedit/childwnd.c
index 55b11de..08eeec1 100644
--- a/programs/regedit/childwnd.c
+++ b/programs/regedit/childwnd.c
@@ -419,7 +419,12 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
             }
             case TVN_BEGINLABELEDITW: {
                 HKEY hRootKey;
-                LPWSTR path = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hRootKey);
+                LPWSTR path;
+
+                if (!GetWindowLongPtrW(g_pChildWnd->hTreeWnd, GWLP_USERDATA))
+                    return 1;
+
+                path = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hRootKey);
                 if (!path || !*path) return 1;
                 return 0;
             }
@@ -440,6 +445,7 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
                     HeapFree(GetProcessHeap(), 0, fullPath);
 		}
                 HeapFree(GetProcessHeap(), 0, path);
+                SetWindowLongPtrW(g_pChildWnd->hTreeWnd, GWLP_USERDATA, 0);
 		return res;
 	    }
             default:
diff --git a/programs/regedit/treeview.c b/programs/regedit/treeview.c
index 7afc7bf..07e9b41 100644
--- a/programs/regedit/treeview.c
+++ b/programs/regedit/treeview.c
@@ -529,6 +529,7 @@ HWND StartKeyRename(HWND hwndTV)
     HTREEITEM hItem;
 
     if(!(hItem = (HTREEITEM)SendMessageW(hwndTV, TVM_GETNEXTITEM, TVGN_CARET, 0))) return 0;
+    SetWindowLongPtrW(hwndTV, GWLP_USERDATA, 1);
     return (HWND)SendMessageW(hwndTV, TVM_EDITLABELW, 0, (LPARAM)hItem);
 }
 




More information about the wine-cvs mailing list