From 5819fba9b471b73abaec30ecb3554cbf0efd06cb Mon Sep 17 00:00:00 2001 From: Sucklead Date: Sun, 7 Mar 2021 20:57:15 +0000 Subject: [PATCH] Add simple loading message box. --- DCoTEHook/DCoTEHook.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/DCoTEHook/DCoTEHook.cpp b/DCoTEHook/DCoTEHook.cpp index 88de278..cba9a95 100644 --- a/DCoTEHook/DCoTEHook.cpp +++ b/DCoTEHook/DCoTEHook.cpp @@ -197,10 +197,13 @@ BOOL InjectHookDll(HANDLE process, const char* dllPath) return true; } +VOID CALLBACK TimerCallback(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) +{ + PostQuitMessage(0); +} int _tmain(int argc, _TCHAR* argv[]) { - STARTUPINFOA startupInfo; PROCESS_INFORMATION processInformation; @@ -211,6 +214,20 @@ int _tmain(int argc, _TCHAR* argv[]) char lpModWorkingDir[MAX_PATH]; char lpBaseWorkingDir[MAX_PATH]; + + int timeout_seconds = 3; + SetTimer(NULL, 1, timeout_seconds * 1000, (TIMERPROC)TimerCallback); + + int result = MessageBox(0, "Red Hooking CoCMainWin32.exe...\n(Hit cancel to abort)", "DCoTEHook Version 0.4 by Sucklead", MB_TOPMOST | MB_OKCANCEL); + + KillTimer(NULL, 1); + + // did user hit cancel? + if (result == 2) + { + return 7; + } + GetCurrentDirectory(MAX_PATH, lpModWorkingDir); //sprintf(message, "Initial working dir is [%s]", lpModWorkingDir);