void InstallD3D8Hook() { if(!m_pfnDirect3DCreate8) { m_pfnDirect3DCreate8 = (Direct3DCreate8_t)DetourFunction(DetourFindFunction("d3d8.dll", "Direct3DCreate8"), (PBYTE)Direct3DCreate8); } if(!m_pfnDirectInput8Create) { m_pfnDirectInput8Create = (DirectInput8Create_t)DetourFunction(DetourFindFunction("dinput8.dll", "DirectInput8Create"), (PBYTE)DirectInput8Create); } }
bool CDirectInput8Hook::Install() { if(!m_bInstalled) { m_pXInputGetState = (XInputGetState_t) DetourFunction( DetourFindFunction( "xinput1_3.dll", "XInputGetState" ), (PBYTE)XInputGetState__Hook ); m_pDirectInput8Create = ( DirectInput8Create_t ) DetourFunction( DetourFindFunction( "dinput8.dll", "DirectInput8Create" ), (PBYTE)DirectInput8Create__Hook ); m_pDirectInputCreateEx = ( DirectInputCreateEx_t ) DetourFunction( DetourFindFunction( "dinput.dll", "DirectInputCreateEx" ), (PBYTE)DirectInputCreateEx__Hook ); m_bInstalled = true; return true; } return false; }
BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) { switch(fdwReason) { case DLL_PROCESS_ATTACH: { set_score=(int (__stdcall*)(int))DetourFunction((PBYTE)0x01013C89, (PBYTE)SetCustomScore); break; } case DLL_PROCESS_DETACH: { DetourRemove((PBYTE)0x01013C89, (PBYTE)set_score); break; } case DLL_THREAD_ATTACH: { break; } case DLL_THREAD_DETACH: { break; } } /* Return TRUE on success, FALSE on failure */ return TRUE; }
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { DisableThreadLibraryCalls((HMODULE)hinstDLL); if (fdwReason == DLL_PROCESS_ATTACH) { // Apply hooks Original_glBegin = (Type_glBegin)(DetourFunction((unsigned char*)GetProcAddress(LoadLibrary("opengl32.dll"), "glBegin"),(unsigned char*)Hooked_glBegin)); } else if (fdwReason == DLL_PROCESS_DETACH) { // Remove hooks Original_glBegin = (Type_glBegin)(DetourFunction((unsigned char*)GetProcAddress(LoadLibrary("opengl32.dll"), "glBegin"),(unsigned char*)Original_glBegin)); } return true; }
void HookDInput() { LoadRealLibrary(); PBYTE offset = (PBYTE)GetProcAddress(g_directInput, "DirectInput8Create"); DirectInput8Create_r = (DirectInput8Create_t)DetourFunction(offset, (PBYTE)&DirectInput8Create_c); }
void HookWinAPI() { LoadRealUser32Library(); PBYTE offset = (PBYTE)GetProcAddress(g_user32, "GetActiveWindow"); GetActiveWindow_r = (GetActiveWindow_t)DetourFunction(offset, (PBYTE)&GetActiveWindow_c); }
void DoTasks() { HMODULE hModule; FARPROC targetFunction; //We can't determine exactly which runtime they use so try em all hModule = GetModuleHandle(L"MSVCR100.dll"); if (hModule == NULL) hModule = GetModuleHandle(L"MSVCR110.dll"); if (hModule == NULL) hModule = GetModuleHandle(L"MSVCR120.dll"); if (hModule ==NULL) MessageBox(NULL, L"Failed to Find MSVCR For CT String Crypt", L"Compile Time String XOR Failed", MB_OK); //Get Project Directory _wgetcwd(WorkingDirectory, MAX_PATH); std::wstringstream ssTempDirPath; ssTempDirPath << WorkingDirectory << L"\\Temp"; if (!DirectoryExists(ssTempDirPath.str().c_str())) { CreateDirectory(ssTempDirPath.str().c_str(), NULL); } targetFunction = GetProcAddress(hModule, "_wsopen_s"); owsopen_s = (twsopen_s)DetourFunction((PBYTE)targetFunction, (PBYTE)hkwsopen_s); }
bool CDirect3D9Hook::Install() { if(!m_bHookInstalled) { CLogger::Debugf("Installing Direct3D9 Hook.."); m_pfnDirect3DCreate9 = reinterpret_cast<Direct3DCreate9_t>(DetourFunction(DetourFindFunction ("D3D9.DLL", "Direct3DCreate9"), reinterpret_cast<PBYTE>(Direct3DCreate9_Hook))); m_pfnDirect3DCreate9Ex = reinterpret_cast<Direct3DCreate9Ex_t>(DetourFunction(DetourFindFunction ("D3D9.DLL", "Direct3DCreate9Ex"), reinterpret_cast<PBYTE>(Direct3DCreate9Ex_Hook))); CLogger::Debugf("Direct3D9 Hook applied!"); m_bHookInstalled = true; return true; } return false; }
// HarddiskSerialNo VOID Detour__CreateFileW() { static decltype(&CreateFileW) _CreateFileW = CreateFileW; decltype(&CreateFileW) CreateFileW__Hook = []( _In_ LPCWSTR lpFileName, _In_ DWORD dwDesiredAccess, _In_ DWORD dwShareMode, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _In_ DWORD dwCreationDisposition, _In_ DWORD dwFlagsAndAttributes, _In_opt_ HANDLE hTemplateFile ) -> HANDLE { if (wcsstr(lpFileName, L"\\\\.\\PhysicalDrive") != NULL) { return INVALID_HANDLE_VALUE; } return _CreateFileW(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); }; DetourFunction(TRUE, reinterpret_cast<LPVOID*>(&_CreateFileW), CreateFileW__Hook); }
DWORD WINAPI VTableRepatch() { while(true) { std::this_thread::sleep_for(std::chrono::milliseconds(100)); DetourFunction(reinterpret_cast<std::uint8_t*>(o_EndScene), reinterpret_cast<std::uint8_t*>(&DXI_EndScene), 5); } return 0; }
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { switch (fdwReason) { case DLL_PROCESS_ATTACH: { // ------------------------------------------------------------------------ // Load up the antihack for the first time (its a singleton) // ------------------------------------------------------------------------ try { CAntiCheat::Get(); } catch (std::exception e) { MessageBoxA(0, e.what(), "Anticheat", MB_ICONERROR | MB_OK); return FALSE; } // ------------------------------------------------------------------------ // Hook all the relevant API calls // ------------------------------------------------------------------------ orig_LoadLibrary = (LoadLibrary_t)DetourFunction((LPBYTE) LoadLibraryA, (LPBYTE) hook_LoadLibrary ); orig_Module32Next = (Module32Next_t)DetourFunction((LPBYTE) Module32Next, (LPBYTE) hook_Module32Next ); //orig_send = (send_t)DetourFunction((LPBYTE) send, (LPBYTE) hook_send ); //orig_recv = (recv_t)DetourFunction((LPBYTE) recv, (LPBYTE) hook_recv ); //orig_socket = (socket_t)DetourFunction((LPBYTE) socket, (LPBYTE) hook_socket ); //orig_closesocket = (closesocket_t)DetourFunction((LPBYTE) closesocket, (LPBYTE) hook_closesocket ); break; } case DLL_PROCESS_DETACH: { // Nah, this baby isnt supposed to get unloaded // Destructor of AntiCheat takes care of all cleanup break; } } return TRUE; }
bool CDirect3D9Hook::Install() { if(!m_bHookInstalled) { m_pfnDirect3DCreate9 = reinterpret_cast<Direct3DCreate9_t>(DetourFunction(DetourFindFunction ("D3D9.DLL", "Direct3DCreate9"), reinterpret_cast<PBYTE>(Direct3DCreate9_Hook))); m_bHookInstalled = true; return true; } return false; }
extern "C" __declspec(dllexport) BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { if (ul_reason_for_call == DLL_PROCESS_ATTACH) { DisableThreadLibraryCalls(hModule); s_realCreateD3D9IfFcn = (CreateD3D9DevFcn) DetourFunction( (PBYTE) Direct3DCreate9, (PBYTE) Mine_Direct3DCreate9); } return true; }
bool CDirectInput8Hook::Install( ) { // Is the proxy already installed? if( m_bInstalled ) return false; // Install the detour patch m_pDirectInput8Create = ( DirectInput8Create_t ) DetourFunction( DetourFindFunction( "dinput8.dll", "DirectInput8Create" ), (PBYTE)DirectInput8Create__Hook ); // Mark as installed m_bInstalled = true; return true; }
void CDirect3DHook::Install() { if(!m_bHookInstalled) { HMODULE hModule = NULL; char buffer[MAX_PATH]; // Getting path to system dir and to d3d8.dll ::GetSystemDirectory(buffer,MAX_PATH); // Append dll name strcat(buffer,"\\d3d9.dll"); LoadLibrary(buffer); while( !hModule ) { hModule = GetModuleHandleA(buffer); Sleep(100); } DWORD* VTableStart = 0; DWORD DevicePointer = dwFindPattern((DWORD)hModule, 0x128000, (PBYTE)"\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x00\x00\x89\x86", "xx????xx????xx"); memcpy(&VTableStart, (void*)(DevicePointer+2), 4); dwReset = (DWORD)VTableStart[16]; dwEndScene = (DWORD)VTableStart[42]; m_pReset = (Reset_t)DetourFunction((PBYTE)dwReset,(PBYTE)hkReset); m_pEndScene = (EndScene_t)DetourFunction((PBYTE)dwEndScene,(PBYTE)hkEndScene); CLogFile::Printf("Hooked 'Direct3D Reset and EndScene"); m_bHookInstalled = true; } }
// MacAddress VOID Detour__GetAdaptersInfo() { static decltype(&GetAdaptersInfo) _GetAdaptersInfo = GetAdaptersInfo; decltype(&GetAdaptersInfo) GetAdaptersInfo__Hook = []( _Out_writes_bytes_opt_(*SizePointer) PIP_ADAPTER_INFO AdapterInfo, _Inout_ PULONG SizePointer ) -> ULONG { if (AdapterInfo == NULL) return 0; // not ERROR_BUFFER_OVERFLOW return _GetAdaptersInfo(AdapterInfo, SizePointer); }; DetourFunction(TRUE, reinterpret_cast<LPVOID*>(&_GetAdaptersInfo), GetAdaptersInfo__Hook); }
bool InitialiseHooks() { while(!GetModuleHandle("d3d9.dll")) { std::this_thread::sleep_for(std::chrono::milliseconds(100)); } DWORD* VTable = nullptr; std::this_thread::sleep_for(std::chrono::milliseconds(100)); static std::uint8_t bMask[] = {0xC7, 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, 0x86, 0x00, 0x00, 0x00, 0x00, 0x89, 0x86}; DWORD Address = FindPattern(reinterpret_cast<DWORD>(GetModuleHandle("d3d9.dll")), 0x128000, bMask, "xx????xx????xx"); memcpy(&VTable, reinterpret_cast<void*>(Address + 2), 4); o_EndScene = reinterpret_cast<EndScene_t>(VTable[42]); DetourFunction(reinterpret_cast<std::uint8_t*>(o_EndScene), reinterpret_cast<std::uint8_t*>(&DXI_EndScene), 5); std::thread([&] {VTableRepatch();}).detach(); return VTable != nullptr; }
bool __stdcall DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { switch (fdwReason) { case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls(hinstDLL); o_LoadLibrary = (LoadLibrary_t) GetProcAddress(GetModuleHandleW(L"Kernel32.dll"), "LoadLibraryA"); DetourFunction(o_LoadLibrary, DXI_LoadLibrary); return true; case DLL_PROCESS_DETACH: break; default: break; } return true; }
VOID Detour_o_o() { static decltype(&VirtualAlloc) _VirtualAlloc = VirtualAlloc; decltype(&VirtualAlloc) VirtualAlloc__Hook = []( _In_opt_ LPVOID lpAddress, _In_ SIZE_T dwSize, _In_ DWORD flAllocationType, _In_ DWORD flProtect) -> LPVOID { if (dwSize == 0x84D00) { //MessageBoxA(NULL, "", "", MB_OK); } return _VirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect); }; DetourFunction(TRUE, reinterpret_cast<LPVOID*>(&_VirtualAlloc), VirtualAlloc__Hook); }
bool HookDInput() { LPSTR DllName = "DINPUT8.DLL"; LoadLibraryA(DllName); PBYTE tmp = (PBYTE )DetourFindFunction(DllName, "DirectInput8Create"); _TRACE(("HookDInput(), tmp = %p\n"), tmp); if (tmp == NULL) return false; Real_DirectInput8Create = (DirectInput8Create_t ) DetourFunction( (PBYTE )tmp, (PBYTE )MyDirectInput8Create); _TRACE( ("HookDInput(), Real_DirectInput8Create = %p, MyDirectInput8Create = %p\n"), tmp, &MyDirectInput8Create); return true; }
bool CDirect3DHook9::ApplyHook ( ) { if ( UsingAltD3DSetup() ) return true; // Hook Direct3DCreate9. if ( !m_pfnDirect3DCreate9 ) { m_pfnDirect3DCreate9 = reinterpret_cast < pDirect3DCreate > ( DetourFunction ( DetourFindFunction ( "D3D9.DLL", "Direct3DCreate9" ), reinterpret_cast < PBYTE > ( API_Direct3DCreate9 ) ) ); WriteDebugEvent ( SString( "Direct3D9 hook applied %08x", m_pfnDirect3DCreate9 ) ); } else { WriteDebugEvent ( "Direct3D9 hook resumed." ); m_bDirect3DCreate9Suspended = false; } return true; }
int WINAPI DllThread() { HMODULE hd3d9 = NULL; MODULEINFO Info; DWORD EndScene_Addr = NULL; DWORD* vtbl = 0; DWORD table = FindPattern((DWORD)GetModuleHandle("d3d9.dll"), 0x128000, (PBYTE)"\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x00\x00\x89\x86", "xx????xx????xx"); memcpy(&vtbl, (void*)(table+2), 4); DWORD EndSceneaddy = vtbl[42]; while(hd3d9 == NULL) { hd3d9 = GetModuleHandle("d3d9.dll"); } /*GetModuleInformation(GetCurrentProcess(), hd3d9, &Info, sizeof(MODULEINFO)); EndScene_Addr = (DWORD)GetModuleHandle("d3d9.dll") + 0x01CE09; // Adicionar um Pettern para achar o offset oEndScene = (EndScene)DetourFunction((PBYTE)EndScene_Addr, (PBYTE)mEndScene);*/ oEndScene = (EndScene)DetourFunction((PBYTE)EndSceneaddy, (PBYTE)mEndScene); return 0; }
// Initialize the main routines void D3D8_Init() { // Hook us as D3D unit m_pfnDirect3DCreate8 = (pfnDirect3DCreate8)DetourFunction( DetourFindFunction("D3D8.DLL", "Direct3DCreate8"), (PBYTE)Hook_Direct3DCreate8); }
/*----------------------------------------------------------------------------- mvee_refresh_hook_lists -----------------------------------------------------------------------------*/ void mvee_refresh_hook_lists() { // printf("refresh hook lists begin\n"); mvee_check_init(); // mvee_is_interposer_region(1); int pending_hooks = 0; pthread_mutex_lock(&hook_mutex); hook_info* prev = pending_list; hook_info* next_info; for (hook_info* info = pending_list->next_hook_info; info; info = next_info) { next_info = info->next_hook_info; pending_hooks++; // check if the target library has been loaded yet... no_recurse = 1; void* lib_handle = !strcmp(info->target_library, "*") ? RTLD_NEXT : dlopen(info->target_library, RTLD_NOLOAD); no_recurse = 0; if (lib_handle) { // printf("LAZY HOOKER: found lib: %s\n", info->target_library); // find the symbol void* sym = dlsym(lib_handle, info->target_func); if (!sym && info->use_debug_syms && info->target_library[0] != '*') syscall(MVEE_RESOLVE_SYMBOL, info->target_func, info->target_library, &sym); if (sym) { int success; if (info->use_trampoline) success = (DetourFunctionWithTrampoline(sym, info->hook_func, info->trampoline_func) == 0); else success = (DetourFunction(sym, info->hook_func) == 0); if (success) { info->hook_installed = 1; pending_hooks--; // printf("LAZY HOOKER: successfully hooked symbol: %s in lib: %s (handle: 0x%08x)\n", // info->target_func, info->target_library, lib_handle); // move to installed list if (info->hook_once) { prev->next_hook_info = info->next_hook_info; info->next_hook_info = installed_list->next_hook_info; installed_list->next_hook_info = info; } } else { printf("LAZY HOOKER: failed to patch func: %s\n", info->target_func); prev = info; } if (info->callback_func) info->callback_func(info->target_func, sym); continue; } } prev = info; } pthread_mutex_unlock(&hook_mutex); // mvee_is_interposer_region(0); // printf("refresh hook lists end\n"); }
void InitHooks() { DetourTransactionBegin(); //General DetourMemberFunction(Tramp_CBaldurChitin_Construct, DETOUR_CBaldurChitin::DETOUR_Construct); DetourMemberFunction(Tramp_CRuleTables_Construct, DETOUR_CRuleTables::DETOUR_Construct); DetourMemberFunction(Tramp_CRuleTables_Deconstruct, DETOUR_CRuleTables::DETOUR_Deconstruct); //Action if (pGameOptionsEx->GetOption("Action_ExpandedActions")) { DetourMemberFunction(Tramp_CInfGame_InitGame, DETOUR_CInfGame::DETOUR_InitGame); DetourMemberFunction(Tramp_CGameSprite_QueueActions, DETOUR_CGameSprite::DETOUR_QueueActions); DetourMemberFunction(Tramp_CGameSprite_ClearAllActions, DETOUR_CGameSprite::DETOUR_ClearAllActions); DetourMemberFunction(Tramp_CGameSprite_ExecuteAction, DETOUR_CGameSprite::DETOUR_ExecuteAction); DetourMemberFunction(Tramp_CCreatureObject_ExecuteAction, DETOUR_CCreatureObject::DETOUR_ExecuteAction); } //Debug DetourFunction(Tramp_CloseLogAndErr, DETOUR_CloseLogAndErr); if (pGameOptionsEx->GetOption("Debug_ExpandedLUAConsole")) { DetourFunction(Tramp_IElua_init, DETOUR_IElua_init); DetourMemberFunction(Tramp_CLUAConsole_StartStore, DETOUR_CLUAConsole::DETOUR_StartStore); } if (pGameOptionsEx->GetOption("Debug_ExternalLogging")) DetourFunction(Tramp_WriteToFile, DETOUR_WriteToFile); if (pGameOptionsEx->GetOption("Debug_LogDialogueBar")) { DetourMemberFunction(Tramp_CScreenWorld_PrintToConsole6, DETOUR_CScreenWorld::DETOUR_PrintToConsoleColor) DetourMemberFunction(Tramp_CScreenWorld_PrintToConsole4, DETOUR_CScreenWorld::DETOUR_PrintToConsole) } if (pGameOptionsEx->GetOption("Debug_LogFailures")) DetourFunction(Tramp_AssertFailedQuit, DETOUR_AssertFailedQuit); if (pGameOptionsEx->GetOption("Debug_LogWarnings")) DetourFunction(Tramp_AssertFailedContinue, DETOUR_AssertFailedContinue); if (pGameOptionsEx->GetOption("Debug_LogNetworkErrors")) DetourMemberFunction(Tramp_CNetwork_PrintNetworkError, DETOUR_CNetwork::DETOUR_PrintNetworkError); //Effect DetourMemberFunction(Tramp_CEffect_DecodeEffect, DETOUR_CEffect::DETOUR_DecodeEffect); DetourMemberFunction(Tramp_CEffect_ApplyTiming, DETOUR_CEffect::DETOUR_ApplyTiming); DetourMemberFunction(Tramp_CEffect_CheckNotSaved, DETOUR_CEffect::DETOUR_CheckNotSaved); DetourMemberFunction(Tramp_CDerivedStats_OpAdd, DETOUR_CDerivedStats::DETOUR_OpAdd); DetourMemberFunction(Tramp_CEffectDamage_ApplyEffect, DETOUR_CEffectDamage::DETOUR_ApplyEffect); DetourMemberFunction(Tramp_CItem_GetAbilityEffect, DETOUR_CItem::DETOUR_GetAbilityEffect); DetourMemberFunction(Tramp_ResSplFile_GetAbilityEffect, DETOUR_ResSplFile::DETOUR_GetAbilityEffect); if (pGameOptionsEx->GetOption("Eff_ApplyEffItemtypeFix") || pGameOptionsEx->GetOption("Eff_ApplyEffItemFix")) { DetourMemberFunction(Tramp_CItem_Equip, DETOUR_CItem::DETOUR_Equip); } if (pGameOptionsEx->GetOption("Eff_AttacksPerRoundFix")) { DetourMemberFunction(Tramp_CEffectAttacksPerRoundMod_ApplyEffect, DETOUR_CEffectAttacksPerRoundMod::DETOUR_ApplyEffect); } if (pGameOptionsEx->GetOption("Eff_CharismaModFix")) DetourMemberFunction(Tramp_CEffectCharismaMod_ApplyEffect, DETOUR_CEffectCharismaMod::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_ConstitutionModFix")) DetourMemberFunction(Tramp_CEffectConstitutionMod_ApplyEffect, DETOUR_CEffectConstitutionMod::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_BlindnessFix") || pGameOptionsEx->GetOption("Eff_BlindnessAsSpellDesc")) DetourMemberFunction(Tramp_CEffectBlindness_ApplyEffect, DETOUR_CEffectBlindness::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_ButtonFXMod") && pGameOptionsEx->GetOption("Engine_ExpandedStats")) { DetourMemberFunction(Tramp_CEffectDisableButton_ApplyEffect, DETOUR_CEffectDisableButton::DETOUR_ApplyEffect); DetourMemberFunction(Tramp_CEffectEnableButton_ApplyEffect, DETOUR_CEffectEnableButton::DETOUR_ApplyEffect); DetourMemberFunction(Tramp_CButtonArray_CheckButtonEnabled, DETOUR_CButtonArray::DETOUR_CheckButtonEnabled); } if (pGameOptionsEx->GetOption("Eff_CastSpellConditionMod")) { DetourMemberFunction(Tramp_CEffectCastSpellOnCondition_ApplyEffect, DETOUR_CEffectCastSpellOnCondition::DETOUR_ApplyEffect); DetourMemberFunction(Tramp_CConditionalSpellList_EvaluateTriggers, DETOUR_CConditionalSpellList::DETOUR_EvaluateTriggers); } if (pGameOptionsEx->GetOption("Eff_CutScene2Mod")) DetourMemberFunction(Tramp_CEffectCutScene2_ApplyEffect, DETOUR_CEffectCutScene2::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_DexterityMod")) DetourMemberFunction(Tramp_CEffectDexterityMod_ApplyEffect, DETOUR_CEffectDexterityMod::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_DiseaseFix")) DetourMemberFunction(Tramp_CEffectDisease_ApplyEffect, DETOUR_CEffectDisease::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_DisintegrateFix")) DetourMemberFunction(Tramp_CEffectDisintegrate_ApplyEffect, DETOUR_CEffectDisintegrate::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_DispelFix")) { DetourMemberFunction(Tramp_CEffectList_TryDispel, DETOUR_CEffectList::DETOUR_TryDispel); } if (pGameOptionsEx->GetOption("Eff_DispelMagicalItemConfig")) DetourMemberFunction(Tramp_CEffectDispel_ApplyEffect, DETOUR_CEffectDispel::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_FatigueModFix")) DetourMemberFunction(Tramp_CEffectFatigueMod_ApplyEffect, DETOUR_CEffectFatigueMod::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_FindTrapsModFix")) DetourMemberFunction(Tramp_CEffectFindTrapsMod_ApplyEffect, DETOUR_CEffectFindTrapsMod::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_IntelligenceModFix")) DetourMemberFunction(Tramp_CEffectIntelligenceMod_ApplyEffect, DETOUR_CEffectIntelligenceMod::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_IntoxicationModFix")) DetourMemberFunction(Tramp_CEffectIntoxicationMod_ApplyEffect, DETOUR_CEffectIntoxicationMod::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_LearnSpellMod")) DetourMemberFunction(Tramp_CEffectLearnSpell_ApplyEffect, DETOUR_CEffectLearnSpell::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_LevelModFix")) DetourMemberFunction(Tramp_CEffectLevelMod_ApplyEffect, DETOUR_CEffectLevelMod::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_LoreModFix")) DetourMemberFunction(Tramp_CEffectLoreMod_ApplyEffect, DETOUR_CEffectLoreMod::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_LuckMod")) DetourMemberFunction(Tramp_CEffectLuckMod_ApplyEffect, DETOUR_CEffectLuckMod::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_MageMemSpellMod")) DetourMemberFunction(Tramp_CEffectMageMemSpellMod_ApplyEffect, DETOUR_CEffectMageMemSpellMod::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_MagicResistModFix")) DetourMemberFunction(Tramp_CEffectMagicResistMod_ApplyEffect, DETOUR_CEffectMagicResistMod::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_MoraleBreakModFix")) DetourMemberFunction(Tramp_CEffectMoraleBreakMod_ApplyEffect, DETOUR_CEffectMoraleBreakMod::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_OpenLocksModFix")) DetourMemberFunction(Tramp_CEffectOpenLocksMod_ApplyEffect, DETOUR_CEffectOpenLocksMod::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_PickPocketsModFix")) DetourMemberFunction(Tramp_CEffectPickPocketsMod_ApplyEffect, DETOUR_CEffectPickPocketsMod::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_PoisonFix")) DetourMemberFunction(Tramp_CEffectPoison_ApplyEffect, DETOUR_CEffectPoison::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_PoisonResistMod")) DetourMemberFunction(Tramp_CEffectPoisonResistMod_ApplyEffect, DETOUR_CEffectPoisonResistMod::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_ProficiencyModMod")) { DetourMemberFunction(Tramp_CEffectProficiencyMod_ApplyEffect, DETOUR_CEffectProficiencyMod::DETOUR_ApplyEffect); DetourMemberFunction(Tramp_CDerivedStats_LimitStats, DETOUR_CDerivedStats::DETOUR_LimitStats); } if (pGameOptionsEx->GetOption("Eff_PriestMemSpellMod")) DetourMemberFunction(Tramp_CEffectPriestMemSpellMod_ApplyEffect, DETOUR_CEffectPriestMemSpellMod::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_RegenerationFix")) DetourMemberFunction(Tramp_CEffectRegeneration_ApplyEffect, DETOUR_CEffectRegeneration::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_RemoveProjectileMod")) DetourMemberFunction(Tramp_CEffectRemoveProjectile_ApplyEffect, DETOUR_CEffectRemoveProjectile::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_RepeatingEffFix")) { DetourMemberFunction(Tramp_CEffectRepeatingEff_Construct5, DETOUR_CEffectRepeatingEff::DETOUR_Construct); DetourMemberFunction(Tramp_CEffectRepeatingEff_ApplyEffect, DETOUR_CEffectRepeatingEff::DETOUR_ApplyEffect); } if (pGameOptionsEx->GetOption("Eff_ReputationModFix")) DetourMemberFunction(Tramp_CEffectReputationMod_ApplyEffect, DETOUR_CEffectReputationMod::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_SaveVsBreathMod")) DetourMemberFunction(Tramp_CEffectSaveVsBreathMod_ApplyEffect, DETOUR_CEffectSaveVsBreathMod::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_SaveVsDeathMod")) DetourMemberFunction(Tramp_CEffectSaveVsDeathMod_ApplyEffect, DETOUR_CEffectSaveVsDeathMod::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_SaveVsPolyMod")) DetourMemberFunction(Tramp_CEffectSaveVsPolyMod_ApplyEffect, DETOUR_CEffectSaveVsPolyMod::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_SaveVsSpellMod")) DetourMemberFunction(Tramp_CEffectSaveVsSpellMod_ApplyEffect, DETOUR_CEffectSaveVsSpellMod::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_SaveVsWandsMod")) DetourMemberFunction(Tramp_CEffectSaveVsWandsMod_ApplyEffect, DETOUR_CEffectSaveVsWandsMod::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_StealthModFix")) DetourMemberFunction(Tramp_CEffectStealthMod_ApplyEffect, DETOUR_CEffectStealthMod::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_StrengthExModFix")) DetourMemberFunction(Tramp_CEffectStrengthExMod_ApplyEffect, DETOUR_CEffectStrengthExMod::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_StrengthMod")) DetourMemberFunction(Tramp_CEffectStrengthMod_ApplyEffect, DETOUR_CEffectStrengthMod::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_TrackingModFix")) DetourMemberFunction(Tramp_CEffectTrackingMod_ApplyEffect, DETOUR_CEffectTrackingMod::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_UseEFFFileFix")) DetourMemberFunction(Tramp_CEffectUseEFFFile_ApplyEffect, DETOUR_CEffectUseEFFFile::DETOUR_ApplyEffect); if (pGameOptionsEx->GetOption("Eff_WisdomModFix")) DetourMemberFunction(Tramp_CEffectWisdomMod_ApplyEffect, DETOUR_CEffectWisdomMod::DETOUR_ApplyEffect); //Engine if (pGameOptionsEx->GetOption("Engine_CloneCreatureFix")) DetourMemberFunction(Tramp_CCreatureObject_ActionJumpToAreaEntranceMove, DETOUR_CCreatureObject::DETOUR_ActionJumpToAreaEntranceMove); if (pGameOptionsEx->GetOption("Engine_DisableInvPauseSP")) DetourMemberFunction(Tramp_CScreenInventory_Init, DETOUR_CScreenInventory::DETOUR_Init); if (pGameOptionsEx->GetOption("Engine_DisableEndPlayer1Dead")) DetourMemberFunction(Tramp_CInfGame_SetLoseCutscene, DETOUR_CInfGame::DETOUR_SetLoseCutscene); if (pGameOptionsEx->GetOption("Engine_ExpandedStats")) { DetourMemberFunction(Tramp_CEffectAid_ApplyEffect, DETOUR_CEffectAid::DETOUR_ApplyEffect); DetourMemberFunction(Tramp_CEffectBless_ApplyEffect, DETOUR_CEffectBless::DETOUR_ApplyEffect); DetourMemberFunction(Tramp_CEffectChant_ApplyEffect, DETOUR_CEffectChant::DETOUR_ApplyEffect); DetourMemberFunction(Tramp_CEffectHolyMight_ApplyEffect, DETOUR_CEffectHolyMight::DETOUR_ApplyEffect); DetourMemberFunction(Tramp_CEffectChantBad_ApplyEffect, DETOUR_CEffectChantBad::DETOUR_ApplyEffect); DetourMemberFunction(Tramp_CEffectDisableSpelltype_ApplyEffect, DETOUR_CEffectDisableSpelltype::DETOUR_ApplyEffect); DetourMemberFunction(Tramp_CEffectWingBuffet_ApplyEffect, DETOUR_CEffectWingBuffet::DETOUR_ApplyEffect); DetourMemberFunction(Tramp_CEffectAnimationRemoval_ApplyEffect, DETOUR_CEffectAnimationRemoval::DETOUR_ApplyEffect); DetourMemberFunction(Tramp_CDerivedStats_Construct3, DETOUR_CDerivedStats::DETOUR_Construct3); DetourMemberFunction(Tramp_CDerivedStats_Construct0, DETOUR_CDerivedStats::DETOUR_Construct0); DetourMemberFunction(Tramp_CDerivedStats_Init, DETOUR_CDerivedStats::DETOUR_Init); DetourMemberFunction(Tramp_CDerivedStats_OpAssign, DETOUR_CDerivedStats::DETOUR_OpAssign); DetourMemberFunction(Tramp_CDerivedStats_ClearStats, DETOUR_CDerivedStats::DETOUR_ClearStats); DetourMemberFunction(Tramp_CDerivedStats_GetStat, DETOUR_CDerivedStats::DETOUR_GetStat); DetourMemberFunction(Tramp_CDerivedStats_MarshalTemplate, DETOUR_CDerivedStats::DETOUR_MarshalTemplate); DetourMemberFunction(Tramp_CDerivedStats_UnmarshalTemplate, DETOUR_CDerivedStats::DETOUR_UnmarshalTemplate); DetourMemberFunction(Tramp_CDerivedStats_Deconstruct, DETOUR_CDerivedStats::DETOUR_Deconstruct); } if (pGameOptionsEx->GetOption("Engine_ExternHPTables")) DetourMemberFunction(Tramp_CRuleTables_CalculateNewHPSubclass, DETOUR_CRuleTables::DETOUR_CalculateNewHPSubclass); if (pGameOptionsEx->GetOption("Engine_ExternClassRaceRestrictions")) { DetourFunction(Tramp_CAnimation_IsPlayableAnimation, DETOUR_CAnimation::DETOUR_IsPlayableAnimation); DetourMemberFunction(Tramp_CAnimation5000_Construct, DETOUR_CAnimation5000::DETOUR_Construct); DetourMemberFunction(Tramp_CRuleTables_IsMageSchoolAllowed, DETOUR_CRuleTables::DETOUR_IsMageSchoolAllowed); DetourMemberFunction(Tramp_CScreenCharGen_ClassPanelOnUpdate, DETOUR_CScreenCharGen::DETOUR_ClassPanelOnUpdate); DetourMemberFunction(Tramp_CScreenCharGen_MulticlassPanelOnUpdate, DETOUR_CScreenCharGen::DETOUR_MulticlassPanelOnUpdate); DetourMemberFunction(Tramp_CScreenCharGen_MageSchoolPanelOnUpdate, DETOUR_CScreenCharGen::DETOUR_MageSchoolPanelOnUpdate); } if (pGameOptionsEx->GetOption("Engine_LauncherProficiencyFix")) DetourMemberFunction(Tramp_CCreatureObject_GetProficiencyInItem, DETOUR_CCreatureObject::DETOUR_GetProficiencyInItem); if (pGameOptionsEx->GetOption("Engine_ProficiencyRestrictions")) DetourMemberFunction(Tramp_CRuleTables_GetWeapProfMax, DETOUR_CRuleTables::DETOUR_GetWeapProfMax); if (pGameOptionsEx->GetOption("Engine_FakeTalkFix")) DetourMemberFunction(Tramp_CCreatureObject_UpdateFaceTalkerTimer, DETOUR_CCreatureObject::DETOUR_UpdateFaceTalkerTimer); if (pGameOptionsEx->GetOption("Engine_OptimiseVarCode")) { DetourMemberFunction(Tramp_CVariableMap_Add, DETOUR_CVariableMap::DETOUR_Add); DetourMemberFunction(Tramp_CVariableMap_Find, DETOUR_CVariableMap::DETOUR_Find); DetourMemberFunction(Tramp_CVariableMap_GetHash, DETOUR_CVariableMap::DETOUR_GetHash); } if (pGameOptionsEx->GetOption("Engine_MoveAreasFix")) DetourMemberFunction(Tramp_CMoveAreasList_MoveAllTo, DETOUR_CMoveAreasList::DETOUR_MoveAllTo); if (pGameOptionsEx->GetOption("Engine_SpellTurningFix")) DetourMemberFunction(Tramp_CCreatureObject_Construct10, DETOUR_CCreatureObject::DETOUR_Construct); //Items if (pGameOptionsEx->GetOption("Items_UseAnimPercentThrowingWeapons")) DetourMemberFunction(Tramp_CCreatureObject_ValidateAttackSequence, DETOUR_CCreatureObject::DETOUR_ValidateAttackSequence); //Music if (pGameOptionsEx->GetOption("Music_SonglistExtend")) { DetourMemberFunction(Tramp_CSoundMixer_InitSonglist, DETOUR_CSoundMixer::DETOUR_InitSonglist); DetourMemberFunction(Tramp_CArea_GetSong, DETOUR_CArea::DETOUR_GetSong); } //Sound if (pGameOptionsEx->GetOption("Sound_AnimAttackSounds")) DetourMemberFunction(Tramp_CAnimation_PlayCurrentSequenceSound, DETOUR_CAnimation::DETOUR_PlayCurrentSequenceSound); if (pGameOptionsEx->GetOption("Sound_ExternWalkSounds")) { DetourMemberFunction(Tramp_CAnimation_GetWalkingSound, DETOUR_CAnimation::DETOUR_GetWalkingSound); DetourMemberFunction(Tramp_CAnimation1000_GetWalkingSound, DETOUR_CAnimation1000::DETOUR_GetWalkingSound); DetourMemberFunction(Tramp_CAnimation1200_GetWalkingSound, DETOUR_CAnimation1200::DETOUR_GetWalkingSound); DetourMemberFunction(Tramp_CAnimation1300_GetWalkingSound, DETOUR_CAnimation1300::DETOUR_GetWalkingSound); DetourMemberFunction(Tramp_CAnimation2000_GetWalkingSound, DETOUR_CAnimation2000::DETOUR_GetWalkingSound); DetourMemberFunction(Tramp_CAnimation5000_GetWalkingSound, DETOUR_CAnimation5000::DETOUR_GetWalkingSound); DetourMemberFunction(Tramp_CAnimation6400_GetWalkingSound, DETOUR_CAnimation6400::DETOUR_GetWalkingSound); DetourMemberFunction(Tramp_CAnimation7000_GetWalkingSound, DETOUR_CAnimation7000::DETOUR_GetWalkingSound); DetourMemberFunction(Tramp_CAnimation7300_GetWalkingSound, DETOUR_CAnimation7300::DETOUR_GetWalkingSound); DetourMemberFunction(Tramp_CAnimation8000_GetWalkingSound, DETOUR_CAnimation8000::DETOUR_GetWalkingSound); DetourMemberFunction(Tramp_CAnimation9000_GetWalkingSound, DETOUR_CAnimation9000::DETOUR_GetWalkingSound); DetourMemberFunction(Tramp_CAnimationA000_GetWalkingSound, DETOUR_CAnimationA000::DETOUR_GetWalkingSound); DetourMemberFunction(Tramp_CAnimationC000_GetWalkingSound, DETOUR_CAnimationC000::DETOUR_GetWalkingSound); DetourMemberFunction(Tramp_CAnimationE000_GetWalkingSound, DETOUR_CAnimationE000::DETOUR_GetWalkingSound); } if (pGameOptionsEx->GetOption("Sound_SoundsetSubtitles")) { DetourMemberFunction(Tramp_CScreenRecord_UpdateCharacter, DETOUR_CScreenRecord::DETOUR_UpdateCharacter); DetourMemberFunction(Tramp_CScreenCharGen_InitSoundset, DETOUR_CScreenCharGen::DETOUR_InitSoundset); } //Trigger DetourMemberFunction(Tramp_CCreatureObject_ActionPickPockets, DETOUR_CCreatureObject::DETOUR_ActionPickPockets); if (pGameOptionsEx->GetOption("Trigger_ExpandedTriggers")) { DetourMemberFunction(Tramp_CScriptBlock_Evaluate, DETOUR_CScriptBlock::DETOUR_Evaluate); DetourMemberFunction(Tramp_CCreatureObject_EvaluateTrigger, DETOUR_CCreatureObject::DETOUR_EvaluateTrigger); DetourMemberFunction(Tramp_CGameSprite_EvaluateTrigger, DETOUR_CGameSprite::DETOUR_EvaluateTrigger); } if (pGameOptionsEx->GetOption("Trigger_OptimiseBagSearch")) { DetourMemberFunction(Tramp_CInfGame_GetNumOfItemInBag, DETOUR_CInfGame::DETOUR_GetNumOfItemInBag); } //UI DetourFunction(Tramp_CreateUIControl, DETOUR_CreateUIControl); //used by bUserExternMageSpellHiding, bEngineExternMageSpellsCap DetourMemberFunction(Tramp_CRuleTables_GetMageSpellRef, DETOUR_CRuleTables::DETOUR_GetMageSpellRef); if (pGameOptionsEx->GetOption("User_ContingencySelectSpell")) { DetourMemberFunction(Tramp_CUICheckButtonMageBookContChoice_Construct2, DETOUR_CUICheckButtonMageBookContChoice::DETOUR_Construct); DetourMemberFunction(Tramp_CUICheckButtonMageBookContChoice_OnLClicked, DETOUR_CUICheckButtonMageBookContChoice::DETOUR_OnLClicked); DetourMemberFunction(Tramp_CUICheckButtonMageBookContSelected_Construct2, DETOUR_CUICheckButtonMageBookContSelected::DETOUR_Construct); DetourMemberFunction(Tramp_CUICheckButtonMageBookContSelected_OnLClicked, DETOUR_CUICheckButtonMageBookContSelected::DETOUR_OnLClicked); DetourMemberFunction(Tramp_CScreenMageBook_ContingencySelectOnLoad, DETOUR_CScreenMageBook::DETOUR_ContingencySelectOnLoad); DetourMemberFunction(Tramp_CScreenMageBook_ContingencySelectOnUpdate, DETOUR_CScreenMageBook::DETOUR_ContingencySelectOnUpdate); DetourMemberFunction(Tramp_CScreenMageBook_ClearContingencySpell, DETOUR_CScreenMageBook::DETOUR_ClearContingencySpell); DetourMemberFunction(Tramp_CScreenMageBook_CreateContingencySpellList, DETOUR_CScreenMageBook::DETOUR_CreateContingencySpellList); } if (pGameOptionsEx->GetOption("User_ExternMageSpellHiding")) DetourMemberFunction(Tramp_CRuleTables_GetMageSpellRefAutoPick, DETOUR_CRuleTables::DETOUR_GetMageSpellRefAutoPick); if (pGameOptionsEx->GetOption("User_ChargenMageSpellScroll")) { DetourMemberFunction(Tramp_CScreenCharGen_MageBookPanelOnUpdate, DETOUR_CScreenCharGen::DETOUR_MageBookPanelOnUpdate); DetourMemberFunction(Tramp_CScreenCharGen_MageBookPanelOnLoad, DETOUR_CScreenCharGen::DETOUR_MageBookPanelOnLoad); } if (pGameOptionsEx->GetOption("User_ChargenKitSelectScroll")) { DetourMemberFunction(Tramp_CScreenCharGen_KitPanelOnUpdate, DETOUR_CScreenCharGen::DETOUR_KitPanelOnUpdate); DetourMemberFunction(Tramp_CScreenCharGen_KitPanelOnLoad, DETOUR_CScreenCharGen::DETOUR_KitPanelOnLoad); DetourMemberFunction(Tramp_CUICheckButtonChargenKit_GetKitId, DETOUR_CUICheckButtonChargenKit::DETOUR_GetKitId); DetourMemberFunction(Tramp_CUICheckButtonChargenKit_GetKitHelpText, DETOUR_CUICheckButtonChargenKit::DETOUR_GetKitHelpText); } if (pGameOptionsEx->GetOption("User_RecordMageSpellScroll")) { DetourMemberFunction(Tramp_CScreenRecord_MageBookPanelOnUpdate, DETOUR_CScreenRecord::DETOUR_MageBookPanelOnUpdate); DetourMemberFunction(Tramp_CScreenRecord_MageBookPanelOnLoad, DETOUR_CScreenRecord::DETOUR_MageBookPanelOnLoad); } if (pGameOptionsEx->GetOption("User_MageBookScroll")) { DetourMemberFunction(Tramp_CScreenMageBook_SetLevel, DETOUR_CScreenMageBook::DETOUR_SetLevel); DetourMemberFunction(Tramp_CCreatureObject_GetKnownSpellMage, DETOUR_CCreatureObject::DETOUR_GetKnownSpellMage); DetourMemberFunction(Tramp_CCreatureObject_AddMemSpellMage, DETOUR_CCreatureObject::DETOUR_AddMemSpellMage); } if (pGameOptionsEx->GetOption("User_PriestBookScroll")) { DetourMemberFunction(Tramp_CScreenPriestBook_SetLevel, DETOUR_CScreenPriestBook::DETOUR_SetLevel); DetourMemberFunction(Tramp_CCreatureObject_GetKnownSpellPriest, DETOUR_CCreatureObject::DETOUR_GetKnownSpellPriest); DetourMemberFunction(Tramp_CCreatureObject_AddMemSpellPriest, DETOUR_CCreatureObject::DETOUR_AddMemSpellPriest); } DetourTransactionCommit(); return; }
void CSetCursorPosHook::ApplyHook ( void ) { // Hook SetCursorPos m_pfnSetCursorPos = reinterpret_cast < pSetCursorPos > ( DetourFunction ( DetourFindFunction ( "User32.dll", "SetCursorPos" ), reinterpret_cast <PBYTE> ( API_SetCursorPos ) ) ); }