Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › C++/C Programming › WriteProcessMemory() on keystroke?

WriteProcessMemory() on keystroke?

Posts 1–5 of 5 · Page 1 of 1
AR
archey
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);	
}
#1 · 16y ago
Invidus
Invidus
WTF? WOOT FIRST POST. And. the anwer to that question is... ASK SOMEONE ELSE!
#2 · 16y ago
Retoxified
Retoxified
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...
#3 · 16y ago
Mr.Magicman
Mr.Magicman
C&P -.-'' you guys never learn
#4 · 16y ago
why06
why06
It's called a loop. C++ 101.
#5 · 16y ago
Posts 1–5 of 5 · Page 1 of 1

Post a Reply

Similar Threads

  • Writeprocessmemory syntaxBy djtrickdog in C++/C Programming
    11Last post 18y ago
  • WriteProcessMemory(); helpBy hileci555 in C++/C Programming
    2Last post 18y ago
  • [C++] WriteProcessMemory WorkSpaceBy Toymaker in C++/C Programming
    1Last post 17y ago
  • writeprocessmemory functionBy qsc in C++/C Programming
    14Last post 17y ago
  • [Request] WriteProcessMemory ExampleBy PlSlYlClHlO in C++/C Programming
    5Last post 17y ago

Tags for this Thread

None