Advertisement
Guest User

Untitled

a guest
Oct 29th, 2016
461
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.44 KB | None | 0 0
  1. #include "main.h"
  2.  
  3. IVEngineClient* g_pEngine = nullptr;
  4. IBaseClientDLL* g_pClient = nullptr;
  5. IEngineSound* g_pSound = nullptr;
  6. ISurface* g_pSurface = nullptr;
  7. IPanel* g_pPanel = nullptr;
  8. IPlayerInfoManager* g_pPlayerInfoManager = nullptr;
  9. CGlobalVarsBase* g_pGlobalVarsBase = nullptr;
  10. IClientMode* g_pClientMode = nullptr;
  11. IClientEntityList* g_pClientEntList = nullptr;
  12. IVModelInfoClient* g_pModelInfo = nullptr;
  13. IGameEventManager2* g_pGameEventMgr = nullptr;
  14. IModelRender* g_pModelRender = nullptr;
  15. IRenderView* g_pRenderView = nullptr;
  16. IMaterialSystem* g_pMaterialSystem = nullptr;
  17. CInput* g_pInput = nullptr;
  18.  
  19. cHookTable EngineTable;
  20. cHookTable ClientTable;
  21. cHookTable SoundTable;
  22. cHookTable SurfaceTable;
  23. cHookTable PanelTable;
  24. cHookTable ClientModeTable;
  25. cHookTable GameEventTable;
  26. cHookTable ModelRenderTable;
  27.  
  28. PCHAR BaseDir;
  29.  
  30. DWORD WINAPI CheatThread( PVOID ThreadParameter )
  31. {
  32. BYTE bCounterFind = 0;
  33.  
  34. while ( !offset.ModuleLoad() )
  35. {
  36. if ( bCounterFind == 100 )
  37. {
  38. MessageBoxA( 0 , ERROR_TITLE , ERROR_TEXT , MB_OK | MB_ICONERROR );
  39. return 0;
  40. }
  41.  
  42. Sleep( 150 );
  43. bCounterFind++;
  44. }
  45.  
  46. CreateInterfaceFn EngineFactory = offset.CaptureFactory( ENGINE_DLL );
  47. CreateInterfaceFn ClientFactory = offset.CaptureFactory( CLIENT_DLL );
  48.  
  49. CreateInterfaceFn VguiMatFactory = offset.CaptureFactory( VGUIMT_DLL );
  50. CreateInterfaceFn Vgui2Factory = offset.CaptureFactory( VGUI2_DLL );
  51. CreateInterfaceFn ServerFactory = offset.CaptureFactory( SERVER_DLL );
  52. CreateInterfaceFn MaterialFactory = offset.CaptureFactory( MATERIAL_DLL );
  53.  
  54. g_pEngine = (IVEngineClient*)( offset.CaptureInterface( EngineFactory , VENGINE_CLIENT_INTERFACE_VERSION ) );
  55. g_pClient = (IBaseClientDLL*)( offset.CaptureInterface( ClientFactory , CLIENT_DLL_INTERFACE_VERSION ) );
  56. g_pSound = (IEngineSound*)offset.CaptureInterface( EngineFactory , IENGINESOUND_CLIENT_INTERFACE_VERSION );
  57. g_pSurface = (ISurface*)( offset.CaptureInterface( VguiMatFactory , VGUI_SURFACE_INTERFACE_VERSION ) );
  58. g_pPanel = (IPanel*)( offset.CaptureInterface( Vgui2Factory , VGUI_PANEL_INTERFACE_VERSION ) );
  59. g_pPlayerInfoManager = (IPlayerInfoManager*)( offset.CaptureInterface( ServerFactory , INTERFACEVERSION_PLAYERINFOMANAGER ) );
  60.  
  61. if ( g_pPlayerInfoManager )
  62. g_pGlobalVarsBase = g_pPlayerInfoManager->GetGlobalVars();
  63. else
  64. return 0;
  65.  
  66. g_pClientMode = (IClientMode*)( *(PDWORD)FindPattern( ICLIENT_MODE_PATTERN , ICLIENT_MODE_MASK ,
  67. (DWORD)offset.dwClientModule ,
  68. (DWORD)offset.dwClientModule + offset.dwClientModuleSize , 1 ) );
  69.  
  70. g_pClientEntList = (IClientEntityList*)( offset.CaptureInterface( ClientFactory , VCLIENTENTITYLIST_INTERFACE_VERSION ) );
  71. g_pModelInfo = (IVModelInfoClient*)( offset.CaptureInterface( EngineFactory , VMODELINFO_CLIENT_INTERACE_VERSION ) );
  72. g_pGameEventMgr = (IGameEventManager2*)( offset.CaptureInterface( EngineFactory , GAMEEVENTMANAGER_INTERFACE_VERSION ) );
  73. g_pModelRender = (IModelRender*)( offset.CaptureInterface( EngineFactory , VENGINE_HUDMODEL_INTERFACE_VERSION ) );
  74. g_pRenderView = (IRenderView*)( offset.CaptureInterface( EngineFactory , VENGINE_RENDERVIEW_INTERFACE_VERSION ) );
  75. g_pMaterialSystem = (IMaterialSystem*)( offset.CaptureInterface( MaterialFactory , MATERIAL_SYSTEM_INTERFACE_VERSION ) );
  76.  
  77. if ( !EngineTable.HookTable( (DWORD)g_pEngine ) )
  78. return 0;
  79.  
  80. if ( !ClientTable.HookTable( (DWORD)g_pClient ) )
  81. return 0;
  82.  
  83. if( !SoundTable.HookTable( (DWORD)g_pSound ) )
  84. return 0;
  85.  
  86. if ( !SurfaceTable.HookTable( (DWORD)g_pSurface ) )
  87. return 0;
  88.  
  89. if ( !PanelTable.HookTable( (DWORD)g_pPanel ) )
  90. return 0;
  91.  
  92. if ( !ClientModeTable.HookTable( (DWORD)g_pClientMode ) )
  93. return 0;
  94.  
  95. if ( !GameEventTable.HookTable( (DWORD)g_pGameEventMgr ) )
  96. return 0;
  97.  
  98. if ( !ModelRenderTable.HookTable( (DWORD)g_pModelRender ) )
  99. return 0;
  100.  
  101. auto g_pClientVFTable = *(PDWORD*)g_pClient;
  102. g_pInput = *(CInput**)( g_pClientVFTable[15] + 0x01 );
  103.  
  104. HookFunction();
  105.  
  106. return 1;
  107. }
  108.  
  109. #include <Shlobj.h>
  110.  
  111. BOOL WINAPI DllMain( HINSTANCE hinstDLL , DWORD fdwReason , LPVOID lpReserved )
  112. {
  113. if ( fdwReason == DLL_PROCESS_ATTACH )
  114. {
  115. DisableThreadLibraryCalls( hinstDLL );
  116. BaseDir = AllocChar( MAX_PATH );
  117.  
  118. SHGetFolderPathA( NULL , CSIDL_PROFILE , NULL , 0 , BaseDir );
  119. strcat( BaseDir , XorStr( "\\AppData\\Roaming\\" ) );
  120.  
  121. CreateThread( NULL , 0 , CheatThread , 0 , 0 , NULL );
  122.  
  123. return TRUE;
  124. }
  125.  
  126. return TRUE;
  127. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement