From 65f86a236fdeadccc0b94c1f97386ddba7bb7b9e Mon Sep 17 00:00:00 2001 From: Valentin Radu Date: Tue, 4 Jan 2022 02:02:33 +0200 Subject: [PATCH] Display GDI and USER object counts when dumping memory leaks --- ExplorerPatcher/dllmain.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ExplorerPatcher/dllmain.c b/ExplorerPatcher/dllmain.c index 7d503ed..ecf56c5 100644 --- a/ExplorerPatcher/dllmain.c +++ b/ExplorerPatcher/dllmain.c @@ -4066,6 +4066,13 @@ void WINAPI LoadSettings(LPARAM lParam) _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDOUT); _CrtDumpMemoryLeaks(); printf("[Memcheck] Memory leak dump complete.\n"); + printf( + "[Memcheck] Objects in use:\nGDI\tGDIp\tUSER\tUSERp\n%d\t%d\t%d\t%d\n", + GetGuiResources(GetCurrentProcess(), GR_GDIOBJECTS), + GetGuiResources(GetCurrentProcess(), GR_GDIOBJECTS_PEAK), + GetGuiResources(GetCurrentProcess(), GR_USEROBJECTS), + GetGuiResources(GetCurrentProcess(), GR_USEROBJECTS_PEAK) + ); #endif dwTemp = 0; RegSetValueExW(