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; +} +