static void hookProcessThreadsFunctions(HMODULE hModule, const char *szModule, const char *pszDllName) { hookFunction(hModule, szModule, pszDllName, "CreateProcessA", (LPVOID)MyCreateProcessA); hookFunction(hModule, szModule, pszDllName, "CreateProcessW", (LPVOID)MyCreateProcessW); }
static void hookLibraryLoaderFunctions(HMODULE hModule, const char *szModule, const char *pszDllName) { hookFunction(hModule, szModule, pszDllName, "LoadLibraryA", (LPVOID)MyLoadLibraryA); hookFunction(hModule, szModule, pszDllName, "LoadLibraryW", (LPVOID)MyLoadLibraryW); hookFunction(hModule, szModule, pszDllName, "LoadLibraryExA", (LPVOID)MyLoadLibraryExA); hookFunction(hModule, szModule, pszDllName, "LoadLibraryExW", (LPVOID)MyLoadLibraryExW); hookFunction(hModule, szModule, pszDllName, "GetProcAddress", (LPVOID)MyGetProcAddress); }
void bservOverlayEvent(bool overlayOn, bool isExhibitionMode, int delta, DWORD menuMode) { if (isExhibitionMode) { if (overlayOn) { hookFunction(hk_D3D_Present, bservPresent); setOverlayPageVisible(_myPage, true); TRACE(L"Showing ball selection"); g_presentHooked = true; if (delta==1) ResetIterator(); } else { setOverlayPageVisible(_myPage, false); unhookFunction(hk_D3D_Present, bservPresent); TRACE(L"Hiding ball selection"); g_presentHooked = false; if (delta==-1) ResetIterator(); } } else { if (overlayOn) { hookFunction(hk_D3D_Present, bservPresent); setOverlayPageVisible(_myPage, true); g_presentHooked = true; WORD home,away; GetCurrentTeams(home,away); if (home != _home || away != _away) ResetIterator(); _home = home; _away = away; } else { setOverlayPageVisible(_myPage, false); unhookFunction(hk_D3D_Present, bservPresent); g_presentHooked = false; } } }
EXTERN_C BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { if (dwReason == DLL_PROCESS_ATTACH) { hInst = hInstance; RegisterKModule(THISMOD); if (!checkGameVersion()) { LOG(L"Sorry, your game version isn't supported!"); return false; } CHECK_KLOAD(MAKELONG(3,7)); // we need to do this early so that the overlay pages // appear in the same order as DLLs in config.txt _myPage = addOverlayCallback(bservOverlayEvent,true); LOG1N(L"_myPage = %d", _myPage); copyAdresses(); hookFunction(hk_D3D_CreateDevice, initModule); } else if (dwReason == DLL_PROCESS_DETACH) { } return true; }
EXTERN_C BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { if (dwReason == DLL_PROCESS_ATTACH) { hInst = hInstance; RegisterKModule(THISMOD); ZeroMemory(_fast_bin_table, sizeof(_fast_bin_table)); ZeroMemory(_player_boot_slots, sizeof(_player_boot_slots)); LOG1N(L"sizeof(_fast_bin_table) = %d", sizeof(_fast_bin_table)); if (!checkGameVersion()) { LOG(L"Sorry, your game version isn't supported!"); return false; } CHECK_KLOAD(MAKELONG(4,7)); copyAdresses(); hookFunction(hk_D3D_CreateDevice, initModule); } else if (dwReason == DLL_PROCESS_DETACH) { for (int i=0; i<MAX_BOOTS; i++) if (_fast_bin_table[i]) delete _fast_bin_table[i]; } return true; }
bool VMT::unhookFunction(int index) { if (!isValid()) return false; if (index < m_iCount && index >= 0) { void* OrigFunc = ((void**)m_pOriginalTable)[index]; if (hookFunction(index, OrigFunc)) { m_pbHookedMethods[index] = false; --m_iHookCount; if (m_iHookCount == 0) m_bTableHooked = false; return true; } } return false; }
EXTERN_C BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { if (dwReason == DLL_PROCESS_ATTACH) { hInst = hInstance; RegisterKModule(THISMOD); if (!checkGameVersion()) { LOG(L"Sorry, your game version isn't supported!"); return false; } copyAdresses(); hookFunction(hk_D3D_CreateDevice, initModule); } else if (dwReason == DLL_PROCESS_DETACH) { } return true; }