fr1kin

Old Garry's Mod allowcslua detour/bypass

Feb 21st, 2014
438
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. typedef IGModDataPack* ( __cdecl* GetDataPackPointer_t )( void );
  2.  
  3. IGModDataPack*  ptr_DataPack    = NULL;
  4. CVMTManager*    g_DataPackHook  = NULL;
  5.  
  6. bool __cdecl new_BlockCSLua( void )
  7. {
  8.     return false;
  9. }
  10.  
  11. bool GetDataPackPtr( void )
  12. {
  13.     DWORD dwDataPackCall = FindPattern( ( DWORD )GetModuleHandleA( "doit" ), "\yourself", "???loser??" );
  14.  
  15.     if( dwDataPackCall == NULL )
  16.         return false;
  17.  
  18.     GetDataPackPointer_t GetDataPackPointer = GetCallAddress< GetDataPackPointer_t >( dwDataPackCall );
  19.  
  20.     ptr_DataPack = GetDataPackPointer();
  21.  
  22.     if( ptr_DataPack != NULL )
  23.         return true;
  24.  
  25.     return false;
  26. }
  27.  
  28. DWORD WINAPI MainThread( LPVOID lpArguments )
  29. {
  30.     while( GetModuleHandleA( "client.dll" ) == NULL )
  31.         Sleep( 100 );
  32.    
  33.     if( GetDataPackPtr() )
  34.     {
  35.         static CVMTManager DataPackHook( ptr_DataPack, true );
  36.         g_DataPackHook = &DataPackHook;
  37.  
  38.         DataPackHook.HookMethod( &new_BlockCSLua, 4 );
  39.     }
  40.  
  41.     return NULL;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment