[PATCH 1/2] regedit: Only allow key renaming via the Edit or Popup menus
Hugh McMaster
hugh.mcmaster at outlook.com
Wed Dec 28 05:47:43 CST 2016
Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
---
programs/regedit/childwnd.c | 5 +++++
programs/regedit/treeview.c | 6 +++++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/programs/regedit/childwnd.c b/programs/regedit/childwnd.c
index 55b11de..59cb600 100644
--- a/programs/regedit/childwnd.c
+++ b/programs/regedit/childwnd.c
@@ -428,6 +428,8 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
LPNMTVDISPINFOW dispInfo = (LPNMTVDISPINFOW)lParam;
LPWSTR path = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hRootKey);
BOOL res = RenameKey(hWnd, hRootKey, path, dispInfo->item.pszText);
+ LONG_PTR style;
+
if (res) {
TVITEMEXW item;
LPWSTR fullPath = GetPathFullPath(g_pChildWnd->hTreeWnd,
@@ -440,6 +442,9 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
HeapFree(GetProcessHeap(), 0, fullPath);
}
HeapFree(GetProcessHeap(), 0, path);
+ style = GetWindowLongPtrW(g_pChildWnd->hTreeWnd, GWL_STYLE);
+ style &= ~TVS_EDITLABELS;
+ SetWindowLongPtrW(g_pChildWnd->hTreeWnd, GWL_STYLE, style);
return res;
}
default:
diff --git a/programs/regedit/treeview.c b/programs/regedit/treeview.c
index 7afc7bf..9893ffb 100644
--- a/programs/regedit/treeview.c
+++ b/programs/regedit/treeview.c
@@ -527,8 +527,12 @@ HTREEITEM InsertNode(HWND hwndTV, HTREEITEM hItem, LPWSTR name)
HWND StartKeyRename(HWND hwndTV)
{
HTREEITEM hItem;
+ LONG_PTR style;
if(!(hItem = (HTREEITEM)SendMessageW(hwndTV, TVM_GETNEXTITEM, TVGN_CARET, 0))) return 0;
+ style = GetWindowLongPtrW(hwndTV, GWL_STYLE);
+ style |= TVS_EDITLABELS;
+ SetWindowLongPtrW(hwndTV, GWL_STYLE, style);
return (HWND)SendMessageW(hwndTV, TVM_EDITLABELW, 0, (LPARAM)hItem);
}
@@ -695,7 +699,7 @@ HWND CreateTreeView(HWND hwndParent, LPWSTR pHostName, UINT id)
/* Get the dimensions of the parent window's client area, and create the tree view control. */
GetClientRect(hwndParent, &rcClient);
hwndTV = CreateWindowExW(WS_EX_CLIENTEDGE, WC_TREEVIEWW, TreeView,
- WS_VISIBLE | WS_CHILD | WS_TABSTOP | TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT | TVS_EDITLABELS,
+ WS_VISIBLE | WS_CHILD | WS_TABSTOP | TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT,
0, 0, rcClient.right, rcClient.bottom,
hwndParent, ULongToHandle(id), hInst, NULL);
SendMessageW(hwndTV, TVM_SETUNICODEFORMAT, TRUE, 0);
--
2.7.4
More information about the wine-patches
mailing list