mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 23:03:00 +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;
|
LPCTSTR keyPath;
|
||||||
HKEY hRootKey;
|
HKEY hRootKey;
|
||||||
|
HKEY hKey = NULL;
|
||||||
LPNMTVDISPINFO ptvdi;
|
LPNMTVDISPINFO ptvdi;
|
||||||
LONG lResult;
|
LONG lResult;
|
||||||
|
|
||||||
|
@ -517,7 +518,16 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
if (ptvdi->item.pszText)
|
if (ptvdi->item.pszText)
|
||||||
{
|
{
|
||||||
keyPath = GetItemPath(pChildWnd->hTreeWnd, ptvdi->item.hItem, &hRootKey);
|
keyPath = GetItemPath(pChildWnd->hTreeWnd, ptvdi->item.hItem, &hRootKey);
|
||||||
|
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);
|
lResult = RegRenameKey(hRootKey, keyPath, ptvdi->item.pszText);
|
||||||
|
}
|
||||||
return lResult == ERROR_SUCCESS;
|
return lResult == ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue