From 0ab00b83ea2e676ef1b32fd2d646a12730df95f0 Mon Sep 17 00:00:00 2001 From: Valentin Radu Date: Thu, 12 Aug 2021 05:21:21 +0300 Subject: [PATCH] Introduced a bit more delay at startup, also terminate the app after the injection is done. --- ExplorerPatcher/main.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/ExplorerPatcher/main.c b/ExplorerPatcher/main.c index b534167..1bae286 100644 --- a/ExplorerPatcher/main.c +++ b/ExplorerPatcher/main.c @@ -13,12 +13,20 @@ processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") #define APP_NAME TEXT("Windows Explorer") #define NOP 0x90 #define PATCH_OFFSET 0x8cb33 +#define DELAY 5000 HANDLE hProcess = NULL; HMODULE hMod = NULL; LPVOID hInjection = NULL; HWND hWnd = NULL; +DWORD KillAfter(INT64 timeout) +{ + Sleep(timeout); + TerminateProcess(GetCurrentProcess(), 0); + return 0; +} + LRESULT CALLBACK WindowProc( HWND hWnd, UINT uMsg, @@ -302,7 +310,15 @@ int WINAPI wWinMain( szLibPath, L"\\ExplorerPatcherLibrary.dll" ); - Sleep(2000); + Sleep(DELAY); + CreateThread( + 0, + 0, + KillAfter, + 5000, + 0, + 0 + ); return VnInjectAndMonitorProcess( szLibPath, MAX_PATH,