}
goto def;
case WM_DESTROY:
+ DestroyTreeView();
+ DestroyListView(pChildWnd->hListWnd);
+ DestroyMainMenu();
HeapFree(GetProcessHeap(), 0, pChildWnd);
pChildWnd = NULL;
PostQuitMessage(0);
return NULL;
}
+void DestroyListView(HWND hwndLV) {
+ INT count, i;
+ LVITEM item;
+
+ if (g_valueName)
+ HeapFree(GetProcessHeap(), 0, g_valueName);
+
+ count = ListView_GetItemCount(hwndLV);
+ for (i = 0; i < count; i++) {
+ item.mask = LVIF_PARAM;
+ item.iItem = i;
+ ListView_GetItem(hwndLV, &item);
+ free(((LINE_INFO*)item.lParam)->name);
+ HeapFree(GetProcessHeap(), 0, (void*)item.lParam);
+ }
+
+}
+
BOOL RefreshListView(HWND hwndLV, HKEY hKey, LPCTSTR keyPath)
{
DWORD max_sub_key_len;
/******************************************************************************/
+/* we need to destroy the main menu before destroying the main window
+ to avoid a memory leak */
+
+void DestroyMainMenu() {
+ DestroyMenu(hMenuFrame);
+}
+
+/******************************************************************************/
+
void ExitInstance(HINSTANCE hInstance)
{
UnregisterHexEditorClass(hInstance);
- DestroyMenu(hMenuFrame);
+
DestroyMenu(hPopupMenus);
UnloadAclUiDll();
}
extern HWND StartKeyRename(HWND hwndTV);
extern BOOL CreateNewKey(HWND hwndTV, HTREEITEM hItem);
extern BOOL SelectNode(HWND hwndTV, LPCTSTR keyPath);
+extern void DestroyTreeView( void );
+extern void DestroyListView( HWND hwndLV );
+extern void DestroyMainMenu( void );
/* edit.c */
extern BOOL ModifyValue(HWND hwnd, HKEY hKey, LPCTSTR valueName, BOOL EditBin);
if (maxLen == -1) return NULL;
if (!hItem) hItem = TreeView_GetSelection(hwndTV);
if (!hItem) return NULL;
- if (!get_item_path(hwndTV, hItem, phRootKey, &pathBuffer, &pathLen, &maxLen)) return NULL;
+ if (!get_item_path(hwndTV, hItem, phRootKey, &pathBuffer, &pathLen, &maxLen)) {
+ return NULL;
+ }
return pathBuffer;
}
return hwndTV;
}
+void DestroyTreeView() {
+ if (pathBuffer)
+ HeapFree(GetProcessHeap(), 0, pathBuffer);
+}
+
BOOL SelectNode(HWND hwndTV, LPCTSTR keyPath)
{
HTREEITEM hRoot, hItem;