void mctf() { if( match_in_progress && !k_matchLess ) return; if ( !isCTF() ) { G_sprint ( self, 2, "Can't do this in non CTF mode\n" ); return; } if ( !cvar("k_ctf_hook") && !cvar("k_ctf_runes") ) { G_sprint ( self, 2, "Already done\n" ); return; } cvar_fset("k_ctf_hook", 0); cvar_fset("k_ctf_runes", 0); G_sprint ( self, 2, "%s turn off: %s\n", getname(self), redtext("hook & runes") ); // In matchless mode, toggling runes and hook normally won't do anything since match is already in progress. Call this to handle this scenario. if (k_matchLess) { // If a player is carrying a rune when runes are disabled, get rid of it if (!cvar("k_ctf_runes")) { gedict_t * p; for (p = world; (p = find_plr(p)); ) { p->ctf_flag -= (p->ctf_flag & (CTF_RUNE_MASK)); p->maxspeed = cvar("sv_maxspeed"); // Reset speed, in case was carrying haste } } SpawnRunes( 0 ); AddHook ( false ); } }
MouseEventTool::MouseEventTool() { pid_ = GetCurrentProcessId(); remapping_ = new AppSignalPairVec[NUM_WM_MESSAGES]; prevMousePoint_.x = -1; prevMousePoint_.y = -1; AddHook(); }
void nohook() { if( match_in_progress && !k_matchLess ) return; if ( !isCTF() ) { G_sprint ( self, 2, "Can't do this in non CTF mode\n" ); return; } cvar_toggle_msg( self, "k_ctf_hook", redtext("hook") ); // In matchless mode, toggling hook normally won't do anything since match is already in progress. Call this to handle this scenario. if (k_matchLess) { if ( cvar("k_ctf_hook") ) { AddHook( true ); } else { AddHook( false ); } } }
BOOL CApiHookMgr::HookImport( PCSTR pszCalleeModName, PCSTR pszFuncName, PROC pfnHook ) { CLockMgr<CCSWrapper> lockMgr(sm_CritSec, TRUE); BOOL bResult = FALSE; PROC pfnOrig = NULL; try { if (!sm_pHookedFunctions->GetHookedFunction( pszCalleeModName, pszFuncName )) { pfnOrig = GetProcAddressWindows( ::GetModuleHandleA(pszCalleeModName), pszFuncName ); // // It's possible that the requested module is not loaded yet // so lets try to load it. // if (NULL == pfnOrig) { HMODULE hmod = ::LoadLibraryA(pszCalleeModName); if (NULL != hmod) pfnOrig = GetProcAddressWindows( ::GetModuleHandleA(pszCalleeModName), pszFuncName ); } // if if (NULL != pfnOrig) bResult = AddHook( pszCalleeModName, pszFuncName, pfnOrig, pfnHook ); } // if } catch(...) { } // try..catch return bResult; }
MouseEventTool::MouseEventTool() { isFullScreen_ = false; // printWindowRefs(); for (int i = 0; i < NUM_WM_MESSAGES; ++i) { buttonMapping_[i] = -1; } prevX_ = -1; prevY_ = -1; windowNumber_ = NULL; AddHook(); }
void SetWin32Handler(HINSTANCE hInstance) { static bool called = false; if (called) return; called = true; s_win32Displayer.SetInstance(hInstance); InfoProviders::Win32ThreadIdInfoProvider::SetMainThreadId(GetCurrentThreadId()); AddInfoProvider(&s_lastErrorInfoProvider); AddHook(&s_lastErrorHook); AddInfoProvider(&s_threadIdInfoProvider); AddInfoProvider(&s_timeInfoProvider); AddInfoProvider(&s_processIdInfoProvider); AddInfoProvider(&s_OSVersionInfoProvider); AddInfoProvider(&s_processorInfoProvider); AddInfoProvider(&s_currentDirectoryInfoProvider); AddInfoProvider(&s_userNameInfoProvider); AddInfoProvider(&s_computerNameInfoProvider); AddInfoProvider(&s_totalMemoryInfoProvider); AddInfoProvider(&s_freeMemoryInfoProvider); // Add a Win32DiskInfoProvider and Win32FreeDiskSpaceInfoProvider // for every drive. for (char drive='a'; drive<='z'; ++drive) { if (UseDrive(drive)) CheckDrive(drive); } // this loop supposes that the number of elements in // s_diskInfoProviders and s_freeDiskSpaceInfoProviders // are the same - adjust if this would no longer be the case! for (size_t idx=0; idx<s_diskInfoProviders.size(); ++idx) { AddInfoProvider(&s_diskInfoProviders[idx]); AddInfoProvider(&s_freeDiskSpaceInfoProviders[idx]); } // add logger after infoproviders, so the information in them // is logged to it AddLogger(&s_win32Trace); }
bool Command::AddPosthook(CommandHook* hook) { return AddHook(hook, &_posthook); }
bool Command::AddPrehook(CommandHook* hook) { return AddHook(hook, &_prehook); }
void child_init() { AddHook(HOOK_PRE_PRIVMSG,&badwords,"badwords",modname); }