This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Apr 7th, 2012  |  syntax: None  |  size: 1.57 KB  |  views: 81  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include "luai.h"
  2. #include <windows.h>
  3. #include "detours.h"
  4.  
  5. #pragma comment(lib, "detours.lib")
  6.  
  7. DWORD WINAPI MyThread(LPVOID);
  8. DWORD g_threadID;
  9. HMODULE g_hModule;
  10. HANDLE Console = GetStdHandle(STD_INPUT_HANDLE);
  11. luai luaObj;
  12.  
  13. int (__stdcall* PauseGame)();
  14. int (__stdcall* ResumeGame)();
  15.  
  16. static int MyPauseGame()
  17. {
  18.         luaObj.PrintConsole("Game paused");
  19.         return PauseGame();
  20. }
  21. static int MyPauseGame2(lua_State *L) { MyPauseGame(); return 0; }
  22.  
  23.  
  24. static int MyResumeGame()
  25. {
  26.         luaObj.PrintConsole("Game resumed");
  27.         ResumeGame();
  28.         return 0;
  29. }
  30. static int MyResumeGame2(lua_State *L) { MyResumeGame(); return 0; }
  31.  
  32. INT APIENTRY DllMain(HMODULE hDLL, DWORD Reason, LPVOID Reserved)
  33. {
  34.         switch(Reason)
  35.         {
  36.         case DLL_PROCESS_ATTACH:
  37.                 PauseGame = (int (__stdcall*)())DetourFunction((PBYTE)0x0100341C, (PBYTE)MyPauseGame);
  38.                 ResumeGame = (int (__stdcall*)())DetourFunction((PBYTE)0x0100344C, (PBYTE)MyResumeGame);
  39.                
  40.                 g_hModule = hDLL;
  41.                 DisableThreadLibraryCalls(hDLL);
  42.  
  43.                 CreateThread(NULL, NULL, &MyThread, NULL, NULL, &g_threadID);
  44.  
  45.                 luaObj.CreateConsole();
  46.                 luaObj.LoadLua();
  47.  
  48.                 lua_register(luai::L,"PauseGame",MyPauseGame2);
  49.                 lua_register(luai::L,"PauseGame",MyResumeGame2);
  50.  
  51.         break;
  52.        
  53.         case DLL_THREAD_ATTACH:
  54.        
  55.         case DLL_PROCESS_DETACH:
  56.                 //DetourRemove((PBYTE)0x009C630C, (PBYTE)a_chatclear);
  57.         case DLL_THREAD_DETACH:
  58.                 break;
  59.         }
  60.         return TRUE;
  61. }
  62.  
  63.  
  64. DWORD WINAPI MyThread(LPVOID)
  65. {
  66.         while(true)
  67.         {
  68.                 if(luaObj.isLoaded)
  69.                 {
  70.                         luaObj.RunLuaScript("Thread()");
  71.                 }
  72.         }
  73.         FreeLibraryAndExitThread(g_hModule, 0);
  74.         return 0;
  75. }
clone this paste RAW Paste Data