[SNDVOL32] Add the small line dialog
[reactos.git] / base / applications / regedit / framewnd.c
index 3818673..a16019e 100644 (file)
@@ -178,10 +178,10 @@ void SetupStatusBar(HWND hWnd, BOOL bResize)
 
 void UpdateStatusBar(void)
 {
-    NMHDR nmhdr;
-    ZeroMemory(&nmhdr, sizeof(NMHDR));
-    nmhdr.code = TVN_SELCHANGED;
-    SendMessageW(g_pChildWnd->hWnd, WM_NOTIFY, (WPARAM)TREE_WINDOW, (LPARAM)&nmhdr);
+    HKEY hKeyRoot;
+    LPCWSTR pszKeyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot);
+
+    SendMessageW(hStatusBar, SB_SETTEXTW, 0, (LPARAM)pszKeyPath);
 }
 
 static void toggle_child(HWND hWnd, UINT cmd, HWND hchild)
@@ -587,7 +587,7 @@ BOOL ExportRegistryFile(HWND hWnd)
 {
     BOOL bRet = FALSE;
     OPENFILENAME ofn;
-    WCHAR ExportKeyPath[_MAX_PATH];
+    WCHAR ExportKeyPath[_MAX_PATH] = {0};
     WCHAR Caption[128], szTitle[512], szText[512];
     HKEY hKeyRoot;
     LPCWSTR pszKeyPath;
@@ -774,7 +774,7 @@ static void ChooseFavorite(LPCWSTR pszFavorite)
     if (RegOpenKeyExW(HKEY_CURRENT_USER, s_szFavoritesRegKey, 0, KEY_QUERY_VALUE, &hKey) != ERROR_SUCCESS)
         goto done;
 
-    cbData = (sizeof(szFavoritePath) / sizeof(szFavoritePath[0])) - 1;
+    cbData = sizeof(szFavoritePath);
     memset(szFavoritePath, 0, sizeof(szFavoritePath));
     if (RegQueryValueExW(hKey, pszFavorite, NULL, &dwType, (LPBYTE) szFavoritePath, &cbData) != ERROR_SUCCESS)
         goto done;
@@ -1033,7 +1033,6 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
     LPCWSTR valueName;
     BOOL result = TRUE;
     REGSAM regsam = KEY_READ;
-    LONG lRet;
     int item;
 
     UNREFERENCED_PARAMETER(lParam);
@@ -1127,8 +1126,8 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
     valueName = GetValueName(g_pChildWnd->hListWnd, -1);
     if (keyPath)
     {
-        lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, regsam, &hKey);
-        if (lRet != ERROR_SUCCESS) hKey = 0;
+        if (RegOpenKeyExW(hKeyRoot, keyPath, 0, regsam, &hKey) != ERROR_SUCCESS)
+            hKey = 0;
     }
 
     switch (LOWORD(wParam))
@@ -1163,7 +1162,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
         break;
     case ID_EDIT_DELETE:
     {
-        if (GetFocus() == g_pChildWnd->hListWnd)
+        if (GetFocus() == g_pChildWnd->hListWnd && hKey)
         {
             UINT nSelected = ListView_GetSelectedCount(g_pChildWnd->hListWnd);
             if(nSelected >= 1)
@@ -1199,7 +1198,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
         }
         else if (GetFocus() == g_pChildWnd->hTreeWnd)
         {
-            if (keyPath == 0 || *keyPath == 0)
+            if (keyPath == NULL || *keyPath == UNICODE_NULL)
             {
                 MessageBeep(MB_ICONHAND);
             }
@@ -1316,7 +1315,7 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
             return DefWindowProcW(hWnd, message, wParam, lParam);
         break;
     case WM_ACTIVATE:
-        if (LOWORD(hWnd))
+        if (LOWORD(hWnd) && g_pChildWnd)
             SetFocus(g_pChildWnd->hWnd);
         break;
     case WM_SIZE: