Advertisement
sweetpeps

Untitled

Mar 27th, 2020
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1.  
  2. #include "framework.h"
  3. #include <Windows.h>
  4. #include <iostream>
  5. #include "MinHook/include/MinHook.h"
  6.  
  7. int DumpBC(int LS, int CN, int Source, int Size)
  8. {
  9. printf("luastate - \n", LS);
  10. printf("Chunk Name - \n", CN);
  11. printf("Source - \n", Source);
  12. printf("Size - \n", Size);
  13. return 1;
  14. }
  15. int main() {
  16. MH_Initialize();
  17. DWORD nOldProtect;
  18. if (!VirtualProtect(FreeConsole, 1, PAGE_EXECUTE_READWRITE, &nOldProtect))
  19. return FALSE;
  20. *(BYTE*)(FreeConsole) = 0xC3;
  21. if (!VirtualProtect(FreeConsole, 1, nOldProtect, &nOldProtect))
  22. return FALSE;
  23. AllocConsole();
  24. freopen("CONOUT$", "w", stdout);
  25. freopen("CONIN$", "r", stdin);
  26. HWND ConsoleHandle = GetConsoleWindow();
  27. SetWindowPos(ConsoleHandle, HWND_TOPMOST, 50, 20, 0, 0, SWP_DRAWFRAME | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
  28. MH_CreateHook((LPVOID)0x8C81B0, (LPVOID)DumpBC, NULL);
  29.  
  30. }
  31.  
  32. BOOL APIENTRY DllMain(HMODULE Module, DWORD Reason, void* Reserved)
  33. {
  34. switch (Reason)
  35. {
  36. case DLL_PROCESS_ATTACH:
  37. DisableThreadLibraryCalls(Module);
  38. CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)main, NULL, NULL, NULL);
  39. break;
  40. case DLL_PROCESS_DETACH:
  41. break;
  42. default: break;
  43. }
  44.  
  45. return TRUE;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement