Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ItemFiltering.h"
- #include <detours.h>
- typedef LPSTR (WINAPI * tGetCommandLineA)();
- tGetCommandLineA oGetCommandLineA;
- bool bIsPatched = false;
- LPSTR WINAPI hGetCommandLineA()
- {
- char buf[20];
- DWORD oldProtect, dummy;
- MessageBoxA(NULL,"1","",NULL);
- VirtualProtect((void*)0x00F11DFC, 10, PAGE_EXECUTE_READWRITE, &oldProtect);
- MessageBoxA(NULL,"2","",NULL);
- memcpy( buf, (void*)0x00F11DFC, 10 );
- MessageBoxA(NULL,"3","",NULL);
- buf[9] = '\0';
- if( strstr( buf, "OnStage" ) && !bIsPatched )
- {
- MessageBoxA(NULL,"UNPACKED","",NULL);
- bIsPatched = true;
- Set1337Filter();
- }
- MessageBoxA(NULL,"4","",NULL);
- VirtualProtect((void*)0x00F11DFC, 10, oldProtect, &dummy);
- MessageBoxA(NULL,"5","",NULL);
- return oGetCommandLineA();
- }
- BOOL APIENTRY DllMain(HMODULE hDLL, DWORD Reason, LPVOID Reserved)
- {
- switch(Reason)
- {
- case DLL_PROCESS_ATTACH:
- oGetCommandLineA = (tGetCommandLineA)DetourFunction((PBYTE)GetCommandLineA, (PBYTE)hGetCommandLineA);
- break;
- case DLL_PROCESS_DETACH:
- break;
- case DLL_THREAD_ATTACH:
- break;
- case DLL_THREAD_DETACH:
- break;
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement