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 › ReadProcessMemory

ReadProcessMemory

Posts 1–15 of 18 · Page 1 of 2
Void
Void
ReadProcessMemory
Hello, i'm getting an error i havn't seen before. Any help would be appriciated.

Code:
HANDLE handle;

DWORD base = 0x00400000;
DWORD end = 0x7FFFFFFF;
long bSize = (end-base);

LPBYTE buffer = new byte[bSize];



void Read(DWORD value)
{
             ReadProcessMemory(handle,(LPVOID)base,buffer,bSize,0);
             for(int i = 0; i < bSize; i++ )
             {
                     if(buffer[i] == value)
                     {
                                  cout << hex << base + i << endl;
                     }
             }
             
           
     cout << "Done";
     getch();
}
Everytime i run the program it the console outputs:
"Application has requested the runtime to terminate it in an unusual way"

I have no idea why this is happening T.T

Thanks in advance.
#1 · 16y ago
ZE
zeco
Un autre canadienne. But anyway. That is really strange. I've never gotten console output as an error before. What IDE are you using, And what operating system?

That said, that's a quite a cool program your writing! Essentially it searches the memory for values and displays those addresses, right?.

However, even if you fix this bug i think you will run into access violations. and isn't the first parameter of the read process memory function supposed to be a handle to the process you are reading the memory of?
#2 · edited 16y ago · 16y ago
Void
Void
I'm using Dev C++ on Windows XP.

I got the handle from another part of the code, I made sure it wasn't that causing the problem. I've used readprocessmemory() before but not like this.

Maybe this will help but I think it might be the buffer size. I tryed making a buffer size of 3 bytes and scanned the value of addresses I got off cheatengine and it worked well. It out of the 3 addresses it scans, it outputed the right address.
#3 · 16y ago
ZE
zeco
Quote Originally Posted by Davidm44 View Post
I'm using Dev C++ on Windows XP.

I got the handle from another part of the code, I made sure it wasn't that causing the problem. I've used readprocessmemory() before but not like this.

Maybe this will help but I think it might be the buffer size. I tryed making a buffer size of 3 bytes and scanned the value of addresses I got off cheatengine and it worked well. It out of the 3 addresses it scans, it outputed the right address.
Maybe... Those are in fact a lot of bytes you are allocating. In fact, if a byte takes up a byte of memory, and you are trying to make an array of bytes the size of your available memory, i can see how that would be a problem :/
#4 · 16y ago
Void
Void
Do you think I could make the buffer size smaller, read that many bytes, then just add to the base address and scan again?

I don't know if that will work. >.>
#5 · 16y ago
ZE
zeco
Well maybe you could scan in parts?
Instead of having one big MASSIVE array. Have a relatively small array, search from there, delete it, then make another array for the next segment.

Oh, that's basically what you said. >_<. Except you already formed a way of doing it in your head. Kudos. So how is the handle part working? I thought you needed to have the handle to the process of the address space upon which you are intruding. But apparently you found someway to dance around that?
#6 · edited 16y ago · 16y ago
Void
Void
Having a small buffer size completely defeats the purpose of what i'm trying to do. Sorry, I didn't tell you what i was expecting this program to do. I'm trying to make a memory scanner, and at first tryed using ReadProcessMemory for each address which was extremely slow.

I'm still going to try your idea though, trying right now.
Thanks for your replies.
#7 · 16y ago
ZE
zeco
No problem I've got nothing to do. And i kinda figured you were doing a memory scanner. Why would a small buffer size be a problem? Well besides speed. I'm not exactly sure how much slower it would be.
#8 · 16y ago
Void
Void
Well I made a smaller buffer size and it scans, but I don't know what address to start scanning from.

You were right about smaller buffer sizes, it's pretty fast. Thanks
#9 · 16y ago
ZE
zeco
Your welcome. Your project seems interesting. If you have any more concerns feel free to ask so i can Fail at answering you =D
#10 · 16y ago
why06
why06
Wow. Haha. took me about 20min to figure this out xD.

Ok. so Im guessing you only set the buffer to the size of the value your scanning for. For instance if your scanning for a char value or bool set the buffer to 1byte. Or if your scanning for a int set it to 4bytes. Correct? or maybe it depends on what LPBYTE is? A long pointer to a byte? so basically long char* and your assigning it a value of a single byte.... Im confused again. :l
#11 · 16y ago
Void
Void
Thanks, I actually ran into a few more problems but i'm going to take a rest for today.

Good night.
#12 · 16y ago
ZE
zeco
Quote Originally Posted by why06 View Post
Wow. Haha. took me about 20min to figure this out xD.

Ok. so Im guessing you only set the buffer to the size of the value your scanning for. For instance if your scanning for a char value or bool set the buffer to 1byte. Or if your scanning for a int set it to 4bytes. Correct? or maybe it depends on what LPBYTE is? A long pointer to a byte? so basically long char* and your assigning it a value of a single byte.... Im confused again. :l
Not quite why =D. He is scanning his entire memory space for a certain value. Like what is done in mhs/ce and the like. except kinda better in the way that it can be easily integrated into a program you write.
#13 · 16y ago
cnttuchme
cnttuchme
Code:
Variable  Size(bytes)  Accuracy   Range
Short: 2 bytes  Exact  -32768 to 32767
int: 4 bytes   Exact  -2,147,483,648 to 2,147,483,647
long: 4 bytes   Exact -2,147,483,648 to 2,147,483,647
long long int: 8 bytes   Exact  -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
float: 4 bytes  7 digits   +-3.4028 x 10+- 38
double:8 bytes  16 digits  +-1.7977 x 10 308
long double: 12 bytes  19 digits  +- 1.1897 x 10+-4932
i don't know if this helps but ill post it anyway.
#14 · edited 16y ago · 16y ago
rwkeith
rwkeith
Quote Originally Posted by cnttuchme View Post
Code:
Variable  Size(bytes)  Accuracy   Range
Short: 2 bytes  Exact  -32768 to 32767
int: 4 bytes   Exact  -2,147,483,648 to 2,147,483,647
long: 4 bytes   Exact -2,147,483,648 to 2,147,483,647
long long int: 8 bytes   Exact  -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
float: 4 bytes  7 digits   +-3.4028 x 10+- 38
double:8 bytes  16 digits  +-1.7977 x 10 308
long double: 12 bytes  19 digits  +- 1.1897 x 10+-4932
i don't know if this helps but ill post it anyway.
Sizes are different from every OS. This looks like windows if I am correct....
#15 · 16y ago
Posts 1–15 of 18 · Page 1 of 2

Post a Reply

Similar Threads

  • ReadProcessMemoryBy aanthonyz in C++/C Programming
    27Last post 10y ago
  • Write/ReadProcessMemory errorsBy Dragonion in General Game Hacking
    0Last post 18y ago
  • C# WriteProcessMemory/ReadProcessMemoryBy Kantanomo in C# Programming
    10Last post 14y ago
  • ReadProcessMemory - Read 8 byte [solved]By pyton789 in Visual Basic Programming
    7Last post 14y ago

Tags for this Thread

#readprocessmemory