WriteProcessMemory() on keystroke?

Posts 1–5 of 5 · Page 1 of 1
WriteProcessMemory() on keystroke?
Hey guys, again another newb question, search it a ton, but can't find an answer i want to know how to writeprocessmemory() on a keystroke i tried GetAsyncKeyState() from a tutorial here at MPGH.

This is my code:

Code:
#include <iostream>
#include <windows.h>

using namespace std;

DWORD proc_id;
HANDLE hProcess;

int main()

{
     void CALLBACK PollKeys (HWND hWnd,UINT uMsg,UINT idEvent,DWORD dwTime);
   {
      if (GetAsyncKeyState(VK_F4))    // if F12 is down or was down since the last call
      {
         int ammo();      // call the trainer engine
      }
   }


 void CALLBACK PollKeys (HWND hWnd,UINT uMsg,UINT idEvent,DWORD dwTime);
   {
      if (GetAsyncKeyState(VK_F5))    // if F12 is down or was down since the last call
      {
        int health();      // call the trainer engine
      }
   }

}





int ammo()
{
HWND hWnd = FindWindow(0, "Modern Warfare 2");
GetWindowThreadProcessId(hWnd, &proc_id);
hProcess = OpenProcess(PROCESS_ALL_ACCESS|PROCESS_VM_OPERATION|PROCESS_VM_READ|PROCESS_VM_WRITE|PROCESS_QUERY_INFORMATION, FALSE, proc_id);


BYTE Nop[] = {0x90, 0x90, 0x90, 0x90};
WriteProcessMemory(hProcess, (LPVOID*)(DWORD) (0x004C6E0D), &Nop, sizeof(Nop), NULL); //health 0048286b
}


int health()
{
HWND hWnd = FindWindow(0, "Modern Warfare 2");
GetWindowThreadProcessId(hWnd, &proc_id);
hProcess = OpenProcess(PROCESS_ALL_ACCESS|PROCESS_VM_OPERATION|PROCESS_VM_READ|PROCESS_VM_WRITE|PROCESS_QUERY_INFORMATION, FALSE, proc_id);

    
BYTE Nop2[] = {0x90, 0x90, 0x90, 0x90, 0x90};
WriteProcessMemory(hProcess, (LPVOID*)(DWORD) (0x0048286b), &Nop2, sizeof(Nop2), NULL);	
}
WTF? WOOT FIRST POST. And. the anwer to that question is... ASK SOMEONE ELSE!
Code:
#include <iostream>
#include <windows.h>

using namespace std;

DWORD proc_id;
HANDLE hProcess;

int ammo()
{
HWND hWnd = FindWindow(0, "Modern Warfare 2");
GetWindowThreadProcessId(hWnd, &proc_id);
hProcess = OpenProcess(PROCESS_ALL_ACCESS|PROCESS_VM_OPERATION|PROCESS_VM_READ|PROCESS_VM_WRITE|PROCESS_QUERY_INFORMATION, FALSE, proc_id);


BYTE Nop[] = {0x90, 0x90, 0x90, 0x90};
WriteProcessMemory(hProcess, (LPVOID*)(DWORD) (0x004C6E0D), &Nop, sizeof(Nop), NULL); //health 0048286b
}


int health()
{
HWND hWnd = FindWindow(0, "Modern Warfare 2");
GetWindowThreadProcessId(hWnd, &proc_id);
hProcess = OpenProcess(PROCESS_ALL_ACCESS|PROCESS_VM_OPERATION|PROCESS_VM_READ|PROCESS_VM_WRITE|PROCESS_QUERY_INFORMATION, FALSE, proc_id);

    
BYTE Nop2[] = {0x90, 0x90, 0x90, 0x90, 0x90};
WriteProcessMemory(hProcess, (LPVOID*)(DWORD) (0x0048286b), &Nop2, sizeof(Nop2), NULL);	
}

void PollKeys ();
   {
      if (GetAsyncKeyState(VK_F4)&1)
      {
         ammo();      // call the trainer engine
      }
      if (GetAsyncKeyState(VK_F5)&1)    // if F12 is down or was down since the last call
      {
        health();      // call the trainer engine
      }
   }

int main()
{
    while(1)
    {
         PollKeys();
    }
    return 0;
}
Learn to code first...
C&P -.-'' you guys never learn
It's called a loop. C++ 101.
Posts 1–5 of 5 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us