BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID lpReserved ) { if (reason == DLL_PROCESS_ATTACH) { Log::Init(hModule); DEBUGOUT("FiveMP DLL loaded"); if (!GetModuleInformation(GetCurrentProcess(), GetModuleHandle(0), &g_MainModuleInfo, sizeof(g_MainModuleInfo))) { Log::Fatal("Unable to get MODULEINFO from GTA5.exe"); } DEBUGOUT("GTA5 [0x%I64X][0x%X]", g_MainModuleInfo.lpBaseOfDll, g_MainModuleInfo.SizeOfImage); hook.StartConsole(); hook.NoIntro(); hook.Initialize(hModule); } if (reason == DLL_PROCESS_DETACH) { printf("reach end"); scriptUnregister(hModule); printf("reach end 2"); hook.StopConsole(); } return TRUE; }
BOOL APIENTRY DllMain(HMODULE hInstance, DWORD reason, LPVOID lpReserved) { Logger logger(LOGFILE); // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement switch (reason) { case DLL_PROCESS_ATTACH: { scriptRegister(hInstance, ScriptMain); keyboardHandlerRegister(OnKeyboardMessage); logger.Clear(); logger.Write("GTAVManualTransmission v4.1.3"); logger.Write(eGameVersionToString(getGameVersion())); logger.Write("Script loaded"); break; } case DLL_PROCESS_DETACH: { logger.Write("Init shutdown"); bool successI = MemoryPatcher::RestoreInstructions(); if (successI) { logger.Write("Shut down script successfully"); } else { if (!successI) logger.Write("Shut down script with instructions not restored"); } scriptUnregister(hInstance); keyboardHandlerUnregister(OnKeyboardMessage); break; } } return TRUE; }
BOOL APIENTRY DllMain(HMODULE hInstance, DWORD reason, LPVOID lpReserved) { switch (reason) { case DLL_PROCESS_ATTACH: scriptRegister(hInstance, ScriptMain); break; case DLL_PROCESS_DETACH: scriptUnregister(hInstance); break; } return TRUE; }
BOOL APIENTRY DllMain(HMODULE hInstance, DWORD reason, LPVOID lpReserved) { switch (reason) { case DLL_PROCESS_ATTACH: scriptRegister(hInstance, MenuVExampleMain); keyboardHandlerRegister(OnKeyboardMessage); break; case DLL_PROCESS_DETACH: scriptUnregister(hInstance); keyboardHandlerUnregister(OnKeyboardMessage); break; } return TRUE; }
BOOL WINAPI DllMain(HMODULE hModule, DWORD fdwReason, LPVOID lpvReserved) { switch (fdwReason) { case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls(hModule); scriptRegister(hModule, &ScriptMainLoop); keyboardHandlerRegister(&ScriptKeyboardMessage); break; case DLL_PROCESS_DETACH: scriptUnregister(&ScriptMainLoop); keyboardHandlerUnregister(&ScriptKeyboardMessage); break; } return TRUE; }
void ScriptHook::ScriptUnregister(ScriptHook_Callback ptr) { #ifndef GTA_LUA_TEST_EXE scriptUnregister(ptr); #endif }