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

Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Hugh McMaster 2017-01-03 12:33:48 +00:00 committed by Alexandre Julliard
parent abfa87dabf
commit 1e1bfba1c4
2 changed files with 8 additions and 1 deletions

View File

@ -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:

View File

@ -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);
}