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 › Memory Writing...

Memory Writing...

Posts 1–15 of 38 · Page 1 of 3
LY
Lyoto Machida
Memory Writing...
Well, I Made a simple console, with a int that you can see the value and change it anytime, Then i made a console application to write another value to that int..
But idk what is wrong, it says Memory Written but does not happen nothing, I found the adress with C.E 5.6 and 6 ( I didn reopen the console, so the adress didn changed...) ..Here is my code:

Code:
#include <iostream>
#include <Windows.h>
using namespace std;

int newvalue = 666;

int main() {

	while(true) {
		HWND hWnd = FindWindow(0,L"mhtest");
		if(!hWnd) {
			cout << "Window not found!" << endl;
			system("cls");

		} else {
			cout << "Windows found! Starting the memory hacking process.." << endl; Sleep(2000); system("cls");

			DWORD pID;
			GetWindowThreadProcessId(hWnd, &pID);

			HANDLE pA = OpenProcess(PROCESS_ALL_ACCESS,false, pID);

			if(!pA) {
				cout << "Cant acess the program.." << endl; Sleep(2000);
				system("cls");

			} else {
				int ss = WriteProcessMemory(hWnd,(LPVOID)0x00E79138, &newvalue,(DWORD)sizeof(newvalue),NULL);
				if(!ss) {
					cout << "Failed to write the memory.." << ss << endl; Sleep(2000);
					system("cls");
				} else {
					cout << "Memory written!.." << ss << endl; Sleep(2000);
					system("cls");
				}
			}


		}

	}


}
Possible problems:
Converting the adress to hex (i just 0xADRESS it)..

Please help me..

If my code is wrong, please give me a example..And PS: Idk why but the WriteProcessMemory is returning 0 =( now i see that..
#1 · edited 15y ago · 15y ago
LY
Lyoto Machida
I tryed to clear my code, Waiting for help .. =(
#2 · 15y ago
Auxilium
Auxilium
Help yourself, best way to learn.
#3 · 15y ago
LY
Lyoto Machida
Well if im here, its because i cant help myself -.-

But i think i got the problem..
Is the adress..

The adress must be ME Test.exe(my program) + 19138 ..
But how do i get the ME Test.exe ?
Please help me..
@Virtual Void
#4 · 15y ago
open|Fire
open|Fire
Quote Originally Posted by -Away View Post
[FONT="Georgia"][COLOR="SlateGray"]

Code:
#include <iostream>
#include <Windows.h>
using namespace std;

int newvalue = 666;

int main() {

	while(true) {
		HWND hWnd = FindWindow(0,L"mhtest");
		if(!hWnd) {
			cout << "Window not found!" << endl;
			system("cls");

		} else {
			cout << "Windows found! Starting the memory hacking process.." << endl; Sleep(2000); system("cls");

			DWORD pID;
			GetWindowThreadProcessId(hWnd, &pID);

			HANDLE pA = OpenProcess(PROCESS_ALL_ACCESS,false, pID);

			if(!pA) {
				cout << "Cant acess the program.." << endl; Sleep(2000);
				system("cls");

			} else {
				int ss = WriteProcessMemory(hWnd,(LPVOID)0x00E79138, &newvalue,(DWORD)sizeof(newvalue),NULL);
				if(!ss) {
					cout << "Failed to write the memory.." << ss << endl; Sleep(2000);
					system("cls");
				} else {
					cout << "Memory written!.." << ss << endl; Sleep(2000);
					system("cls");
				}
			}


		}

	}


}
your WriteProcessMemory is wrong, you need use the handle open with OpenProcess to write in a remote process.

right way

WriteProcessMemory(pA,(LPVOID)0x00E79138, &newvalue,(DWORD)sizeof(newvalue),NULL);

and I think this addr 00E79138 is not a VA.
#5 · 15y ago
FO
Fovea
Process Security and Access Rights (Windows)
Windows Server 2003 and Windows XP/2000: The size of the PROCESS_ALL_ACCESS flag increased on Windows Server 2008 and Windows Vista. If an application compiled for Windows Server 2008 and Windows Vista is run on Windows Server 2003 or Windows XP/2000, the PROCESS_ALL_ACCESS flag is too large and the function specifying this flag fails with ERROR_ACCESS_DENIED. To avoid this problem, specify the minimum set of access rights required for the operation. If PROCESS_ALL_ACCESS must be used, set _WIN32_WINNT to the minimum operating system targeted by your application (for example, #define _WIN32_WINNT _WIN32_WINNT_WINXP). For more information, see Using the Windows Headers.
Don't use PROCESS_ALL_ACCESS when you only need PROCESS_VM_WRITE.
#6 · 15y ago
LY
Lyoto Machida
@open|Fire that was the problem, now its solved, reped + thnks...
@Fovea Thanks, just learned something new, reped + thanked.

Now i just need something, The adress is always changing, its "THE PROGRAM + 19138", ou do i get "THE PROGRAM"?

Thanks
#7 · 15y ago
FO
Fovea
EnumProcessModules Function (Windows)
#8 · 15y ago
LY
Lyoto Machida

Edit:

Damm i cant figure it out, someone can explain me how do i get it?
Cause the int address is 19138
But the program address i always changing.. and need to Be PROGRAM ADDRESS + 19138
HOw do i do that?
@whit
@Void

@PROS

plz help me =) =)
#9 · edited 15y ago · 15y ago
Omar the Sandnigger
Omar the Sandnigger
Quote Originally Posted by -Away View Post

Edit:

Damm i cant figure it out, someone can explain me how do i get it?
Cause the int address is 19138
But the program address i always changing.. and need to Be PROGRAM ADDRESS + 19138
HOw do i do that?
@whit
@Void

@PROS

plz help me =) =)
It's a dynamic address, it needs to be a static one.
Oh and you forgot an ';' somewhere in your code.
#10 · 15y ago
Melodia
Melodia
Quote Originally Posted by Little Cookie View Post


It's a dynamic address, it needs to be a static one.
Oh and you forgot an ';' somewhere in your code.
Shut up Cookie.

@-Away
Pointers are your friend ; But Calculating size from moduleList / PEB / w.e as Fovea posted is pretty much the most efficient way to do it externally as you are trying to do (:
#11 · 15y ago
Omar the Sandnigger
Omar the Sandnigger
Quote Originally Posted by Melodia View Post


Shut up Cookie.
Seriously
What is your problem with me? I was trying to help.
#12 · 15y ago
'Bruno
'Bruno
I believe it was said already but...

Get the module base address.
I'm pretty sure there is simpler solution or more effective, but I did this when I was playing around with solitaire at the very beggining.

Code:
	MODULEENTRY32 mEntry32;

	HANDLE hSnapMods = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pId);
	if(Module32First(hSnapMods, &mEntry32) == TRUE)
	{
		do
		{
			if(strcmp(mEntry32.szModule, "solitaire.exe") == 0)
			{
				mAddress = (DWORD)mEntry32.modBaseAddr + appOffSet;
				break;
			}
		}
		while(Module32Next(hSnapMods, &mEntry32) == TRUE);
	}
<pId> is the process id.
<mEntry32.modBaseAddr> will be the module base address.

Now instead of copying it and see that works (or not), try to understand first what is in there.
#13 · edited 15y ago · 15y ago
LY
Lyoto Machida
Why the if(strcmp(mEntry32.szModule
Keep giving error? mEntry blabla not compatible with char * blablaa
#14 · 15y ago
Omar the Sandnigger
Omar the Sandnigger
Quote Originally Posted by -Away View Post
Why the if(strcmp(mEntry32.szModule
Keep giving error? mEntry blabla not compatible with char * blablaa
strcmp() is in the cstring (string.h) header file.
#15 · 15y ago
Posts 1–15 of 38 · Page 1 of 3

Post a Reply

Tags for this Thread

None