Cancel rename if value to rename to already exists.

This commit is contained in:
Robert Shearman 2004-02-06 05:16:56 +00:00 committed by Alexandre Julliard
parent 436145e975
commit b99cb051ed
1 changed files with 3 additions and 0 deletions

View File

@ -296,6 +296,9 @@ BOOL RenameValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR oldName, LPC
lRet = RegOpenKeyEx(hKeyRoot, keyPath, 0, KEY_READ | KEY_SET_VALUE, &hKey);
if (lRet != ERROR_SUCCESS) return FALSE;
/* check if value already exists */
value = read_value(hwnd, hKey, newName, &type, &len);
if (value) goto done;
value = read_value(hwnd, hKey, oldName, &type, &len);
if(!value) goto done;
lRet = RegSetValueEx(hKey, newName, 0, type, (BYTE*)value, len);