[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 */
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)

View 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));

View 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);

View 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);