(resend) regedit: Improve error message when recasing a key.

Dmitry Kozliuk dmitry.kozliuk at gmail.com
Tue Dec 16 16:31:53 CST 2014


Fixes #18631.
Native Windows regedit.exe shows custom error message when trying to
rename a key using just different letter case, so do we now.

---
  programs/regedit/edit.c     | 6 ++++--
  programs/regedit/regedit.rc | 2 ++
  programs/regedit/resource.h | 2 ++
  3 files changed, 8 insertions(+), 2 deletions(-)
-------------- next part --------------
diff --git a/programs/regedit/edit.c b/programs/regedit/edit.c
index e211ff8..3fc4ce6 100644
--- a/programs/regedit/edit.c
+++ b/programs/regedit/edit.c
@@ -569,8 +569,10 @@ BOOL RenameKey(HWND hwnd, HKEY hRootKey, LPCWSTR keyPath, LPCWSTR newName)
 
     lRet = RegCreateKeyExW(parentKey, newName, 0, NULL, REG_OPTION_NON_VOLATILE,
         KEY_WRITE, NULL /* FIXME */, &destKey, &disposition);
-    if (disposition == REG_OPENED_EXISTING_KEY)
-        lRet = ERROR_FILE_EXISTS; /* FIXME: we might want a better error message than this */
+    if (disposition == REG_OPENED_EXISTING_KEY) {
+        messagebox(hwnd, MB_OK | MB_ICONERROR, IDS_ERROR_RENAMING_VALUE, IDS_KEY_ALREADY_EXISTS, srcSubKey);
+        goto done;
+    }
     if (lRet != ERROR_SUCCESS) {
         error_code_messagebox(hwnd, lRet);
         goto done;
diff --git a/programs/regedit/regedit.rc b/programs/regedit/regedit.rc
index 2a331c9..ce0053f 100644
--- a/programs/regedit/regedit.rc
+++ b/programs/regedit/regedit.rc
@@ -186,6 +186,8 @@ BEGIN
     IDS_NEWKEY              "New Key #%d"
     IDS_NEWVALUE            "New Value #%d"
     IDS_NOTFOUND            "Search string '%s' not found"
+    IDS_ERROR_RENAMING_VALUE "Error Renaming Value"
+    IDS_KEY_ALREADY_EXISTS   "The Registry Editor cannot rename %s. The specified key name already exists. Type another name and try again."
 END
 
 STRINGTABLE
diff --git a/programs/regedit/resource.h b/programs/regedit/resource.h
index 020765e..1e198df 100644
--- a/programs/regedit/resource.h
+++ b/programs/regedit/resource.h
@@ -124,6 +124,8 @@
 #define IDS_DELETE_BOX_TITLE		32840
 #define IDS_DELETE_BOX_TEXT		32841
 #define IDS_NOTFOUND    		32842
+#define IDS_ERROR_RENAMING_VALUE    32844
+#define IDS_KEY_ALREADY_EXISTS      32845
 #define IDS_DELETE_BOX_TEXT_MULTIPLE	32843
 #define IDD_EDIT_DWORD			32850
 #define IDC_DWORD_BASE			32852



More information about the wine-patches mailing list