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

Dmitry Kozliuk dmitry.kozliuk at gmail.com
Wed Dec 17 05:44:58 CST 2014


Try 2: Changed strings to be different from those in native regedit.exe 
per advice from Hugh McMaster 
(https://www.winehq.org/pipermail/wine-devel/2014-December/106065.html).

Fixes https://bugs.winehq.org/show_bug.cgi?id=18631.

---
  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..13c2d05 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_KEY, IDS_KEY_ALREADY_EXISTS, srcSubKey, newName);
+        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..7309ed8 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_KEY  "Error Renaming Key"
+    IDS_KEY_ALREADY_EXISTS  "Unable to rename %s to %s, because the latter already exists. Please note that key names are case-insensitive."
 END
 
 STRINGTABLE
diff --git a/programs/regedit/resource.h b/programs/regedit/resource.h
index 020765e..f772fda 100644
--- a/programs/regedit/resource.h
+++ b/programs/regedit/resource.h
@@ -125,6 +125,8 @@
 #define IDS_DELETE_BOX_TEXT		32841
 #define IDS_NOTFOUND    		32842
 #define IDS_DELETE_BOX_TEXT_MULTIPLE	32843
+#define IDS_ERROR_RENAMING_KEY  32844
+#define IDS_KEY_ALREADY_EXISTS  32845
 #define IDD_EDIT_DWORD			32850
 #define IDC_DWORD_BASE			32852
 #define IDC_DWORD_HEX			32853



More information about the wine-patches mailing list