Author: hbelusca
Date: Mon Dec 17 23:22:03 2012
New Revision: 57940
URL:
http://svn.reactos.org/svn/reactos?rev=57940&view=rev
Log:
[REGEDIT]
Update the address bar after creating a registry key.
CORE-6816 #resolve #comment Committed in r57940. Thanks ;)
Modified:
trunk/reactos/base/applications/regedit/childwnd.c
Modified: trunk/reactos/base/applications/regedit/childwnd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/…
==============================================================================
--- trunk/reactos/base/applications/regedit/childwnd.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/regedit/childwnd.c [iso-8859-1] Mon Dec 17 23:22:03
2012
@@ -35,7 +35,7 @@
if (hRootKey == HKEY_CURRENT_CONFIG) return L"HKEY_CURRENT_CONFIG";
if (hRootKey == HKEY_DYN_DATA) return L"HKEY_DYN_DATA";
- return L"UKNOWN HKEY, PLEASE REPORT";
+ return L"UNKNOWN HKEY, PLEASE REPORT";
}
extern void ResizeWnd(int cx, int cy)
@@ -301,6 +301,53 @@
break;
}
return CallWindowProc(oldwndproc, hwnd, uMsg, wParam, lParam);
+}
+
+static VOID
+UpdateAddress(HTREEITEM hItem, HKEY hRootKey, LPCWSTR pszPath)
+{
+ LPCWSTR keyPath, rootName;
+ LPWSTR fullPath;
+
+ if (pszPath == NULL)
+ keyPath = GetItemPath(g_pChildWnd->hTreeWnd, hItem, &hRootKey);
+ else
+ keyPath = pszPath;
+
+ if (keyPath)
+ {
+ RefreshListView(g_pChildWnd->hListWnd, hRootKey, keyPath);
+ rootName = get_root_key_name(hRootKey);
+ fullPath = HeapAlloc(GetProcessHeap(), 0, (wcslen(rootName) + 1 + wcslen(keyPath)
+ 1) * sizeof(WCHAR));
+ if (fullPath)
+ {
+ /* set (correct) the address bar text */
+ if (keyPath[0] != L'\0')
+ swprintf(fullPath, L"%s\\%s", rootName, keyPath);
+ else
+ fullPath = wcscpy(fullPath, rootName);
+ SendMessageW(hStatusBar, SB_SETTEXTW, 0, (LPARAM)fullPath);
+ SendMessageW(g_pChildWnd->hAddressBarWnd, WM_SETTEXT, 0,
(LPARAM)fullPath);
+ HeapFree(GetProcessHeap(), 0, fullPath);
+ /* disable hive manipulation items temporarily (enable only if necessary) */
+ EnableMenuItem(GetSubMenu(hMenuFrame,0), ID_REGISTRY_LOADHIVE, MF_BYCOMMAND |
MF_GRAYED);
+ EnableMenuItem(GetSubMenu(hMenuFrame,0), ID_REGISTRY_UNLOADHIVE, MF_BYCOMMAND
| MF_GRAYED);
+ /* compare the strings to see if we should enable/disable the "Load
Hive" menus accordingly */
+ if (!(wcsicmp(rootName, L"HKEY_LOCAL_MACHINE") &&
+ wcsicmp(rootName, L"HKEY_USERS")))
+ {
+ /*
+ * enable the unload menu item if at the root, otherwise
+ * enable the load menu item if there is no slash in
+ * keyPath (ie. immediate child selected)
+ */
+ if(keyPath[0] == L'\0')
+ EnableMenuItem(GetSubMenu(hMenuFrame,0), ID_REGISTRY_LOADHIVE,
MF_BYCOMMAND | MF_ENABLED);
+ else if(!wcschr(keyPath, L'\\'))
+ EnableMenuItem(GetSubMenu(hMenuFrame,0), ID_REGISTRY_UNLOADHIVE,
MF_BYCOMMAND | MF_ENABLED);
+ }
+ }
+ }
}
/*******************************************************************************
@@ -494,45 +541,8 @@
case TVN_ITEMEXPANDING:
return !OnTreeExpanding(g_pChildWnd->hTreeWnd, (NMTREEVIEW*)lParam);
case TVN_SELCHANGED:
- {
- LPCWSTR keyPath, rootName;
- LPWSTR fullPath;
- HKEY hRootKey;
-
- keyPath = GetItemPath(g_pChildWnd->hTreeWnd,
((NMTREEVIEW*)lParam)->itemNew.hItem, &hRootKey);
- if (keyPath)
- {
- RefreshListView(g_pChildWnd->hListWnd, hRootKey, keyPath);
- rootName = get_root_key_name(hRootKey);
- fullPath = HeapAlloc(GetProcessHeap(), 0, (wcslen(rootName) + 1 +
wcslen(keyPath) + 1) * sizeof(WCHAR));
- if (fullPath)
- {
- /* set (correct) the address bar text */
- if(keyPath[0] != L'\0')
- swprintf(fullPath, L"%s\\%s", rootName, keyPath);
- else
- fullPath = wcscpy(fullPath, rootName);
- SendMessageW(hStatusBar, SB_SETTEXTW, 0, (LPARAM)fullPath);
- SendMessageW(g_pChildWnd->hAddressBarWnd, WM_SETTEXT, 0,
(LPARAM)fullPath);
- HeapFree(GetProcessHeap(), 0, fullPath);
- /* disable hive manipulation items temporarily (enable only if
necessary) */
- EnableMenuItem(GetSubMenu(hMenuFrame,0), ID_REGISTRY_LOADHIVE,
MF_BYCOMMAND | MF_GRAYED);
- EnableMenuItem(GetSubMenu(hMenuFrame,0), ID_REGISTRY_UNLOADHIVE,
MF_BYCOMMAND | MF_GRAYED);
- /* compare the strings to see if we should enable/disable the
"Load Hive" menus accordingly */
- if (!(wcsicmp(rootName, L"HKEY_LOCAL_MACHINE")
&&
- wcsicmp(rootName, L"HKEY_USERS")))
- {
- // enable the unload menu item if at the root
- // otherwise enable the load menu item if there is no slash
in keyPath (ie. immediate child selected)
- if(keyPath[0] == L'\0')
- EnableMenuItem(GetSubMenu(hMenuFrame,0),
ID_REGISTRY_LOADHIVE, MF_BYCOMMAND | MF_ENABLED);
- else if(!wcschr(keyPath, L'\\'))
- EnableMenuItem(GetSubMenu(hMenuFrame,0),
ID_REGISTRY_UNLOADHIVE, MF_BYCOMMAND | MF_ENABLED);
- }
- }
- }
- }
- break;
+ UpdateAddress(((NMTREEVIEW*)lParam)->itemNew.hItem, NULL, NULL);
+ break;
case NM_SETFOCUS:
g_pChildWnd->nFocusPanel = 0;
break;
@@ -571,6 +581,8 @@
{
if (RenameKey(hRootKey, keyPath, ptvdi->item.pszText) !=
ERROR_SUCCESS)
lResult = FALSE;
+ else
+ UpdateAddress(ptvdi->item.hItem, hRootKey, szBuffer);
}
return lResult;
}