mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 04:13:34 +00:00
fix bug "Regedit will let you create two identical keys."
See issue #2496 for more details. svn path=/trunk/; revision=27994
This commit is contained in:
@@ -510,6 +510,7 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||
{
|
||||
LPCTSTR keyPath;
|
||||
HKEY hRootKey;
|
||||
HKEY hKey = NULL;
|
||||
LPNMTVDISPINFO ptvdi;
|
||||
LONG lResult;
|
||||
|
||||
@@ -517,9 +518,18 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||
if (ptvdi->item.pszText)
|
||||
{
|
||||
keyPath = GetItemPath(pChildWnd->hTreeWnd, ptvdi->item.hItem, &hRootKey);
|
||||
lResult = RegRenameKey(hRootKey, keyPath, ptvdi->item.pszText);
|
||||
if (RegOpenKeyEx(hRootKey, keyPath, 0, KEY_READ, &hKey) == ERROR_SUCCESS)
|
||||
{
|
||||
lResult = REG_OPENED_EXISTING_KEY;
|
||||
RegCloseKey(hKey);
|
||||
(void)TreeView_EditLabel(pChildWnd->hTreeWnd, ptvdi->item.hItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
lResult = RegRenameKey(hRootKey, keyPath, ptvdi->item.pszText);
|
||||
}
|
||||
return lResult == ERROR_SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
default:
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user