Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define WINVER 0x0500
- #include <iostream>
- #include <windows.h>
- using namespace std;
- BOOL EnableDebugPrivilege(BOOL bEnable) //gives you debug priv, usually not needed, but it fixed a problem for me
- {
- HANDLE hToken = NULL;
- LUID luid;
- if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken)) return FALSE;
- if (!LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &luid)) return FALSE;
- TOKEN_PRIVILEGES tokenPriv;
- tokenPriv.PrivilegeCount = 1;
- tokenPriv.Privileges[0].Luid = luid;
- tokenPriv.Privileges[0].Attributes = bEnable ? SE_PRIVILEGE_ENABLED : 0;
- if (!AdjustTokenPrivileges(hToken, FALSE, &tokenPriv, sizeof(TOKEN_PRIVILEGES), NULL, NULL)) return FALSE;
- return TRUE;
- }
- int main()
- {
- HWND ava_wind;
- string windowName = "Alliance of Valiant Arms";
- cout << "Waiting for AVA..." << endl;
- while(true){
- ava_wind = FindWindow(NULL, windowName.c_str());
- if(ava_wind != 0){
- break;
- }
- Sleep(1);
- }
- /*TCHAR title[500];
- while(true){
- ava_wind = GetForegroundWindow();
- if(GetWindowText(ava_wind, title, 500)+1 == 25){ //this checks the length of the window name
- break;
- }
- Sleep(1);
- }*/
- EnableDebugPrivilege(true);
- DWORD* process_ID = new DWORD;
- GetWindowThreadProcessId(ava_wind, process_ID);
- HANDLE hProcess = OpenProcess(PROCESS_VM_OPERATION|PROCESS_VM_WRITE|PROCESS_VM_READ, FALSE, *process_ID);
- if(!hProcess){
- cout << GetLastError() << endl;
- cout << "Could not open the process!" << endl;
- }
- else{
- if(VirtualAllocEx(hProcess, NULL, 1, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE) != NULL){}
- else{
- cout << "VirtualAllocEx Failed" << endl;
- cout << GetLastError() << endl; //get what error it returned
- }
- int newdata = 0xC3; //RETN in asm
- DWORD newdatasize = sizeof(newdata);
- if(WriteProcessMemory(hProcess, (LPVOID)0x041000, &newdata, newdatasize, NULL)){ //old address
- cout << "XIGNCode Bypassed" << endl;
- }
- else{
- cout << GetLastError() << endl;
- cout << "Error cannot WriteProcessMemory!" << endl;
- }
- CloseHandle(hProcess);
- }
- Sleep(10000);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement