Author: tfaber
Date: Mon Dec 31 17:10:15 2012
New Revision: 58069
URL:
http://svn.reactos.org/svn/reactos?rev=58069&view=rev
Log:
[REGEDIT]
- Fix a handle leak. Patch by Edijs Kolesnikovičs.
CORE-6853 #resolve
Modified:
trunk/reactos/base/applications/regedit/settings.c
Modified: trunk/reactos/base/applications/regedit/settings.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/…
==============================================================================
--- trunk/reactos/base/applications/regedit/settings.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/regedit/settings.c [iso-8859-1] Mon Dec 31 17:10:15
2012
@@ -116,49 +116,45 @@
if (RegCreateKeyW(HKEY_CURRENT_USER, g_szGeneralRegKey, &hKey) == ERROR_SUCCESS)
{
- if (RegOpenKeyW(HKEY_CURRENT_USER, g_szGeneralRegKey, &hKey) ==
ERROR_SUCCESS)
+ RegistryBinaryConfig tConfig;
+ DWORD iBufferSize = sizeof(tConfig);
+ WCHAR szBuffer[MAX_PATH];
+ LPCWSTR keyPath, rootName;
+ HKEY hRootKey;
+
+ /* Save key position */
+ keyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hRootKey);
+ if (keyPath)
{
- RegistryBinaryConfig tConfig;
- DWORD iBufferSize = sizeof(tConfig);
- WCHAR szBuffer[MAX_PATH];
- LPCWSTR keyPath, rootName;
- HKEY hRootKey;
+ rootName = get_root_key_name(hRootKey);
- /* Save key position */
- keyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hRootKey);
- if (keyPath)
- {
- rootName = get_root_key_name(hRootKey);
+ /* Load "My Computer" string and complete it */
+ LoadStringW(hInst, IDS_MY_COMPUTER, szBuffer, COUNT_OF(szBuffer));
+ wcscat(szBuffer, L"\\"); wcscat(szBuffer, rootName);
+ wcscat(szBuffer, L"\\"); wcscat(szBuffer, keyPath);
- /* Load "My Computer" string and complete it */
- LoadStringW(hInst, IDS_MY_COMPUTER, szBuffer, COUNT_OF(szBuffer));
- wcscat(szBuffer, L"\\"); wcscat(szBuffer, rootName);
- wcscat(szBuffer, L"\\"); wcscat(szBuffer, keyPath);
+ RegSetValueExW(hKey, L"LastKey", 0, REG_SZ, (LPBYTE)szBuffer,
(DWORD)wcslen(szBuffer) * sizeof(WCHAR));
+ }
- RegSetValueExW(hKey, L"LastKey", 0, REG_SZ, (LPBYTE)szBuffer,
(DWORD)wcslen(szBuffer) * sizeof(WCHAR));
- }
+ /* Get statusbar settings */
+ tConfig.StatusBarVisible = ((GetMenuState(GetSubMenu(hMenuFrame, ID_VIEW_MENU),
ID_VIEW_STATUSBAR, MF_BYCOMMAND) & MF_CHECKED) ? 1 : 0);
- /* Get statusbar settings */
- tConfig.StatusBarVisible = ((GetMenuState(GetSubMenu(hMenuFrame,
ID_VIEW_MENU), ID_VIEW_STATUSBAR, MF_BYCOMMAND) & MF_CHECKED) ? 1 : 0);
+ /* Get splitter position */
+ tConfig.TreeViewSize = g_pChildWnd->nSplitPos;
- /* Get splitter position */
- tConfig.TreeViewSize = g_pChildWnd->nSplitPos;
+ /* Get list view column width*/
+ tConfig.NameColumnSize = ListView_GetColumnWidth(g_pChildWnd->hListWnd, 0);
+ tConfig.TypeColumnSize = ListView_GetColumnWidth(g_pChildWnd->hListWnd, 1);
+ tConfig.DataColumnSize = ListView_GetColumnWidth(g_pChildWnd->hListWnd, 2);
- /* Get list view column width*/
- tConfig.NameColumnSize = ListView_GetColumnWidth(g_pChildWnd->hListWnd,
0);
- tConfig.TypeColumnSize = ListView_GetColumnWidth(g_pChildWnd->hListWnd,
1);
- tConfig.DataColumnSize = ListView_GetColumnWidth(g_pChildWnd->hListWnd,
2);
+ /* Get program window settings */
+ tConfig.tPlacement.length = sizeof(WINDOWPLACEMENT);
+ GetWindowPlacement(hFrameWnd , &tConfig.tPlacement);
- /* Get program window settings */
- tConfig.tPlacement.length = sizeof(WINDOWPLACEMENT);
- GetWindowPlacement(hFrameWnd , &tConfig.tPlacement);
+ /* Save all the data */
+ RegSetValueExW(hKey, L"View", 0, REG_BINARY, (LPBYTE)&tConfig,
iBufferSize);
- /* Save all the data */
- RegSetValueExW(hKey, L"View", 0, REG_BINARY, (LPBYTE)&tConfig,
iBufferSize);
-
- RegCloseKey(hKey);
- }
+ RegCloseKey(hKey);
}
}
-
/* EOF */