From 199f213d9047a3f2d9f1ce0f8b92b3d4c9425c46 Mon Sep 17 00:00:00 2001 From: sidekek Date: Tue, 27 Oct 2020 11:20:49 -0400 Subject: [PATCH] . --- chromewphook.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/chromewphook.cpp b/chromewphook.cpp index 53cdb56..67aeead 100644 --- a/chromewphook.cpp +++ b/chromewphook.cpp @@ -3,13 +3,27 @@ #include #include "hooks.h" -int main() +int runMain() { std::cout << "hello" << std::endl; - std::cout << FindWindow("Chrome_WidgetWin_1", NULL) << std::endl; if (!hooks::setup()) std::cout << "hooking returned false" << std::endl; while (!GetAsyncKeyState(VK_F10)) std::this_thread::sleep_for(std::chrono::milliseconds(20)); std::cout << "done" << std::endl; -} \ No newline at end of file +} + +BOOL APIENTRY DllMain(HMODULE handle, DWORD reason, LPVOID reserved) +{ + switch (reason) + { + case DLL_PROCESS_ATTACH: + CloseHandle(CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)runMain, handle, 0, nullptr)); + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} +