[REGEDIT]
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Tue, 1 Jan 2013 16:06:02 +0000 (16:06 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Tue, 1 Jan 2013 16:06:02 +0000 (16:06 +0000)
- Use REG_OPTION_NON_VOLATILE instead of 0 in RegCreateKeyEx.
- Do not rename keys when they have the same name, case-insensitive (as Windows does), fix for r58079 / CORE-6205.

svn path=/trunk/; revision=58087

reactos/base/applications/regedit/edit.c
reactos/base/applications/regedit/find.c
reactos/base/applications/regedit/regproc.c
reactos/base/applications/regedit/treeview.c

index 6ff13f0..f154a11 100644 (file)
@@ -1344,7 +1344,7 @@ static LONG CopyKey(HKEY hDestKey, LPCWSTR lpDestSubKey, HKEY hSrcKey, LPCWSTR l
     }
 
     /* create the destination subkey */
-    lResult = RegCreateKeyExW(hDestKey, lpDestSubKey, 0, NULL, 0, KEY_WRITE, NULL,
+    lResult = RegCreateKeyExW(hDestKey, lpDestSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
                              &hDestSubKey, &dwDisposition);
     if (lResult)
         goto done;
@@ -1399,11 +1399,11 @@ static LONG MoveKey(HKEY hDestKey, LPCWSTR lpDestSubKey, HKEY hSrcKey, LPCWSTR l
     if (!lpSrcSubKey)
         return ERROR_INVALID_FUNCTION;
 
-       if (wcscmp(lpDestSubKey, lpSrcSubKey) == 0)
-       {
-        /* destination name equals source name */
-               return ERROR_SUCCESS;
-       }
+    if (_wcsicmp(lpDestSubKey, lpSrcSubKey) == 0)
+    {
+        /* Destination name equals source name */
+        return ERROR_SUCCESS;
+    }
 
     lResult = CopyKey(hDestKey, lpDestSubKey, hSrcKey, lpSrcSubKey);
     if (lResult == ERROR_SUCCESS)
index 0a15204..c0a1500 100644 (file)
@@ -586,7 +586,7 @@ static void SetFindFlags(DWORD dwFlags)
     DWORD dwDisposition;
     DWORD dwData;
 
-    if (RegCreateKeyExW(HKEY_CURRENT_USER, g_szGeneralRegKey, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hKey, &dwDisposition) == ERROR_SUCCESS)
+    if (RegCreateKeyExW(HKEY_CURRENT_USER, g_szGeneralRegKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dwDisposition) == ERROR_SUCCESS)
     {
         dwData = (dwFlags >> 0) & 0x0000FFFF;
         RegSetValueExW(hKey, s_szFindFlags, 0, REG_DWORD, (const BYTE *) &dwData, sizeof(dwData));
index 69604e8..5ca0850 100644 (file)
@@ -458,17 +458,16 @@ static LONG openKeyW(WCHAR* stdInput)
     if (!parseKeyName(stdInput, &keyClass, &keyPath))
         return ERROR_INVALID_PARAMETER;
 
-    res = RegCreateKeyExW(
-        keyClass,                 /* Class     */
-        keyPath,                  /* Sub Key   */
-        0,                        /* MUST BE 0 */
-        NULL,                     /* object type */
-        REG_OPTION_NON_VOLATILE,  /* option, REG_OPTION_NON_VOLATILE ... */
-        KEY_ALL_ACCESS,           /* access mask, KEY_ALL_ACCESS */
-        NULL,                     /* security attribute */
-        &currentKeyHandle,        /* result */
-        &dwDisp);                 /* disposition, REG_CREATED_NEW_KEY or
-                                                        REG_OPENED_EXISTING_KEY */
+    res = RegCreateKeyExW(keyClass,                 /* Class     */
+                          keyPath,                  /* Sub Key   */
+                          0,                        /* MUST BE 0 */
+                          NULL,                     /* object type */
+                          REG_OPTION_NON_VOLATILE,  /* option, REG_OPTION_NON_VOLATILE ... */
+                          KEY_ALL_ACCESS,           /* access mask, KEY_ALL_ACCESS */
+                          NULL,                     /* security attribute */
+                          &currentKeyHandle,        /* result */
+                          &dwDisp);                 /* disposition, REG_CREATED_NEW_KEY or
+                                                                    REG_OPENED_EXISTING_KEY */
 
     if (res == ERROR_SUCCESS)
         currentKeyName = GetMultiByteString(stdInput);
index cd06e7b..4712947 100644 (file)
@@ -593,7 +593,7 @@ BOOL CreateNewKey(HWND hwndTV, HTREEITEM hItem)
     do
     {
         wsprintf(szNewKey, szNewKeyFormat, iIndex++);
-        nResult = RegCreateKeyExW(hKey, szNewKey, 0, NULL, 0, KEY_WRITE, NULL, &hNewKey, &dwDisposition);
+        nResult = RegCreateKeyExW(hKey, szNewKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hNewKey, &dwDisposition);
         if (hNewKey && dwDisposition == REG_OPENED_EXISTING_KEY)
         {
             RegCloseKey(hNewKey);