mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 06:55:44 +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:
parent
d675ad4eb0
commit
b9f016c611
1 changed files with 12 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue