Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.16 KB | None | 0 0
  1. #include "ItemFiltering.h"
  2. #include <detours.h>
  3.  
  4. typedef LPSTR (WINAPI * tGetCommandLineA)();
  5. tGetCommandLineA oGetCommandLineA;
  6.  
  7. bool bIsPatched = false;
  8. LPSTR WINAPI hGetCommandLineA()
  9. {
  10.     char buf[20];
  11.     DWORD oldProtect, dummy;
  12.  
  13.     MessageBoxA(NULL,"1","",NULL);
  14.  
  15.     VirtualProtect((void*)0x00F11DFC, 10, PAGE_EXECUTE_READWRITE, &oldProtect);
  16.  
  17.     MessageBoxA(NULL,"2","",NULL);
  18.  
  19.     memcpy( buf, (void*)0x00F11DFC, 10 );
  20.  
  21.     MessageBoxA(NULL,"3","",NULL);
  22.  
  23.     buf[9] = '\0';
  24.  
  25.     if( strstr( buf, "OnStage" ) && !bIsPatched )
  26.     {
  27.         MessageBoxA(NULL,"UNPACKED","",NULL);
  28.         bIsPatched = true;
  29.         Set1337Filter();
  30.     }
  31.  
  32.     MessageBoxA(NULL,"4","",NULL);
  33.  
  34.     VirtualProtect((void*)0x00F11DFC, 10, oldProtect, &dummy);
  35.  
  36.     MessageBoxA(NULL,"5","",NULL);
  37.  
  38.     return oGetCommandLineA();
  39. }
  40.  
  41. BOOL APIENTRY DllMain(HMODULE hDLL, DWORD Reason, LPVOID Reserved)
  42. {
  43.     switch(Reason)
  44.     {
  45.     case DLL_PROCESS_ATTACH:
  46.         oGetCommandLineA = (tGetCommandLineA)DetourFunction((PBYTE)GetCommandLineA, (PBYTE)hGetCommandLineA);
  47.         break;
  48.     case DLL_PROCESS_DETACH:
  49.         break;
  50.     case DLL_THREAD_ATTACH:
  51.         break;
  52.     case DLL_THREAD_DETACH:
  53.         break;
  54.     }
  55.  
  56.     return true;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement