[REGEDIT]

- 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
This commit is contained in:
Hermès Bélusca-Maïto 2013-01-01 16:06:02 +00:00
parent f4019db7f8
commit 408db391be
4 changed files with 18 additions and 19 deletions

View file

@ -1344,7 +1344,7 @@ static LONG CopyKey(HKEY hDestKey, LPCWSTR lpDestSubKey, HKEY hSrcKey, LPCWSTR l
} }
/* create the destination subkey */ /* 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); &hDestSubKey, &dwDisposition);
if (lResult) if (lResult)
goto done; goto done;
@ -1399,9 +1399,9 @@ static LONG MoveKey(HKEY hDestKey, LPCWSTR lpDestSubKey, HKEY hSrcKey, LPCWSTR l
if (!lpSrcSubKey) if (!lpSrcSubKey)
return ERROR_INVALID_FUNCTION; return ERROR_INVALID_FUNCTION;
if (wcscmp(lpDestSubKey, lpSrcSubKey) == 0) if (_wcsicmp(lpDestSubKey, lpSrcSubKey) == 0)
{ {
/* destination name equals source name */ /* Destination name equals source name */
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }

View file

@ -586,7 +586,7 @@ static void SetFindFlags(DWORD dwFlags)
DWORD dwDisposition; DWORD dwDisposition;
DWORD dwData; 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; dwData = (dwFlags >> 0) & 0x0000FFFF;
RegSetValueExW(hKey, s_szFindFlags, 0, REG_DWORD, (const BYTE *) &dwData, sizeof(dwData)); RegSetValueExW(hKey, s_szFindFlags, 0, REG_DWORD, (const BYTE *) &dwData, sizeof(dwData));

View file

@ -458,8 +458,7 @@ static LONG openKeyW(WCHAR* stdInput)
if (!parseKeyName(stdInput, &keyClass, &keyPath)) if (!parseKeyName(stdInput, &keyClass, &keyPath))
return ERROR_INVALID_PARAMETER; return ERROR_INVALID_PARAMETER;
res = RegCreateKeyExW( res = RegCreateKeyExW(keyClass, /* Class */
keyClass, /* Class */
keyPath, /* Sub Key */ keyPath, /* Sub Key */
0, /* MUST BE 0 */ 0, /* MUST BE 0 */
NULL, /* object type */ NULL, /* object type */

View file

@ -593,7 +593,7 @@ BOOL CreateNewKey(HWND hwndTV, HTREEITEM hItem)
do do
{ {
wsprintf(szNewKey, szNewKeyFormat, iIndex++); 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) if (hNewKey && dwDisposition == REG_OPENED_EXISTING_KEY)
{ {
RegCloseKey(hNewKey); RegCloseKey(hNewKey);