Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com>
---
programs/regedit/edit.c | 10 +---------
programs/regedit/framewnd.c | 18 ++++++++++--------
programs/regedit/main.h | 2 +-
programs/regedit/regedit.rc | 2 +-
4 files changed, 13 insertions(+), 19 deletions(-)
diff --git a/programs/regedit/edit.c b/programs/regedit/edit.c
index 1459624883..89a5ec04ad 100644
--- a/programs/regedit/edit.c
+++ b/programs/regedit/edit.c
@@ -408,24 +408,16 @@ done:
return result;
}
-BOOL DeleteValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName, BOOL showMessageBox)
+BOOL DeleteValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName)
{
BOOL result = FALSE;
LONG lRet;
HKEY hKey;
- LPCWSTR visibleValueName = valueName ? valueName : g_pszDefaultValueName;
WCHAR empty = 0;
lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_READ | KEY_SET_VALUE, &hKey);
if (lRet) return FALSE;
- if (showMessageBox)
- {
- if (messagebox(hwnd, MB_YESNO | MB_ICONEXCLAMATION, IDS_DELETE_VALUE_TITLE, IDS_DELETE_VALUE_TEXT,
- visibleValueName) != IDYES)
- goto done;
- }
-
lRet = RegDeleteValueW(hKey, valueName ? valueName : &empty);
if (lRet && valueName) {
error_code_messagebox(hwnd, IDS_BAD_VALUE, valueName);
diff --git a/programs/regedit/framewnd.c b/programs/regedit/framewnd.c
index a6777fade4..ed0c5bbfc8 100644
--- a/programs/regedit/framewnd.c
+++ b/programs/regedit/framewnd.c
@@ -803,15 +803,17 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
unsigned int num_selected, index, focus_idx;
WCHAR *keyPath;
- if (!(num_selected = SendMessageW(g_pChildWnd->hListWnd, LVM_GETSELECTEDCOUNT, 0, 0L)))
+ num_selected = SendMessageW(g_pChildWnd->hListWnd, LVM_GETSELECTEDCOUNT, 0, 0L);
+
+ if (!num_selected)
break;
+ else if (num_selected == 1)
+ index = IDS_DELETE_VALUE_TEXT;
+ else
+ index = IDS_DELETE_VALUE_TEXT_MULTIPLE;
- if (num_selected > 1)
- {
- if (messagebox(hWnd, MB_YESNO | MB_ICONEXCLAMATION, IDS_DELETE_VALUE_TITLE,
- IDS_DELETE_VALUE_TEXT_MULTIPLE) != IDYES)
- break;
- }
+ if (messagebox(hWnd, MB_YESNO | MB_ICONEXCLAMATION, IDS_DELETE_VALUE_TITLE, index) != IDYES)
+ break;
keyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot);
@@ -821,7 +823,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
while (index != -1)
{
WCHAR *valueName = GetItemText(g_pChildWnd->hListWnd, index);
- if (!DeleteValue(hWnd, hKeyRoot, keyPath, valueName, num_selected == 1))
+ if (!DeleteValue(hWnd, hKeyRoot, keyPath, valueName))
{
heap_free(valueName);
break;
diff --git a/programs/regedit/main.h b/programs/regedit/main.h
index 6e901b3ac2..55317be338 100644
--- a/programs/regedit/main.h
+++ b/programs/regedit/main.h
@@ -129,7 +129,7 @@ BOOL CreateKey(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPWSTR newKeyName);
BOOL CreateValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, DWORD valueType, LPWSTR valueName);
BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName);
BOOL DeleteKey(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath);
-BOOL DeleteValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName, BOOL showMessageBox);
+BOOL DeleteValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName);
BOOL RenameValue(HWND hwnd, HKEY hRootKey, LPCWSTR keyPath, LPCWSTR oldName, LPCWSTR newName);
BOOL RenameKey(HWND hwnd, HKEY hRootKey, LPCWSTR keyPath, LPCWSTR newName);
int WINAPIV messagebox(HWND hwnd, int buttons, int titleId, int resId, ...);
diff --git a/programs/regedit/regedit.rc b/programs/regedit/regedit.rc
index a3e0a01c20..4e629b7d87 100644
--- a/programs/regedit/regedit.rc
+++ b/programs/regedit/regedit.rc
@@ -206,7 +206,7 @@ BEGIN
IDS_UNSUPPORTED_TYPE "Unable to edit registry keys of this type (%1!u!)."
IDS_TOO_BIG_VALUE "The value is too big (%1!u!)."
IDS_DELETE_VALUE_TITLE "Confirm Value Delete"
- IDS_DELETE_VALUE_TEXT "Are you sure you want to delete the registry value '%1'?"
+ IDS_DELETE_VALUE_TEXT "Are you sure you want to delete the selected registry value?"
IDS_DELETE_VALUE_TEXT_MULTIPLE "Are you sure you want to delete these values?"
IDS_DELETE_KEY_TITLE "Confirm Key Delete"
IDS_DELETE_KEY_TEXT "Are you sure you want to delete this registry key and all of its subkeys?"
--
2.17.0