From 77bc654d9be44369524c149215e8b8c42706637f Mon Sep 17 00:00:00 2001 From: Valentin Radu Date: Wed, 10 Nov 2021 21:22:19 +0200 Subject: [PATCH] Small fixes in Start menu injection --- ExplorerPatcher/StartMenu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ExplorerPatcher/StartMenu.c b/ExplorerPatcher/StartMenu.c index 5e20027..17882d8 100644 --- a/ExplorerPatcher/StartMenu.c +++ b/ExplorerPatcher/StartMenu.c @@ -253,6 +253,7 @@ DWORD WINAPI HookStartMenu(HookStartMenuParams* params) if (!hProcess) { printf("Unable to open handle to StartMenuExperienceHost.exe.\n"); + CloseHandle(hSnapshot); Sleep(params->dwTimeout); continue; } @@ -276,7 +277,10 @@ DWORD WINAPI HookStartMenu(HookStartMenuParams* params) } } while (Process32Next(hSnapshot, &pe32) == TRUE); } - CloseHandle(hSnapshot); + if (hSnapshot) + { + CloseHandle(hSnapshot); + } if (hProcess) { break; @@ -293,7 +297,7 @@ DWORD WINAPI HookStartMenu(HookStartMenuParams* params) hProcess, NULL, MAX_PATH, - MEM_COMMIT, + MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE ); if (!lpRemotePath)