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 › I hate errors

I hate errors

Posts 1–15 of 31 · Page 1 of 3
Void
Void
I hate errors
Hello, I'm trying to scan memory here but I keep getting an error. Here's the code.
Code:
#include <windows.h>
#include <conio.h>
#include <iostream>

using namespace std;

DWORD pid;
HWND hwnd;
HANDLE handle;

DWORD base = 0x0000000;
DWORD end = 0x7FFFFFFF;
DWORD bSize = 0x5D1745D;
LPBYTE buffer = new byte[bSize];
int value = 10;

int main()
{
    hwnd = FindWindow(0,"Minesweeper");
    if(!hwnd)
    {
             cout <<"Window not found!";
             getch();
             return 0;
    }
    
    GetWindowThreadProcessId(hwnd,&pid);
    handle = OpenProcess(PROCESS_ALL_ACCESS,0,pid);
    if(!handle)
    {
               cout <<"Could not get window handle!";
               getch();
               return 0;
    }
    
    while ( base != end)
    {
          ReadProcessMemory(handle,(LPVOID)base,buffer,bSize,0);
          

          if( (end-base) > bSize)
          {
              base += bSize;
          } else if( (end-base) < bSize)
          {
                 base += (end-base);
          }
          delete[] buffer;
    }
    cout <<"Done";
    getch();
}
It compiles and it does what it's suposed to, but when I add:
Code:
for(int i = 0; i < bSize; i++ )
          {
                  if(buffer[i] == 10)
                  {
                               cout << hex << base + i << endl;
                  }
          }
To check if any of the bytes are equal to 10 I just get an error. Here's the full code.
Code:
#include <windows.h>
#include <conio.h>
#include <iostream>

using namespace std;

DWORD pid;
HWND hwnd;
HANDLE handle;

DWORD base = 0x0000000;
DWORD end = 0x7FFFFFFF;
DWORD bSize = 0x5D1745D;
LPBYTE buffer = new byte[bSize];
int value = 10;

int main()
{
    hwnd = FindWindow(0,"Minesweeper");
    if(!hwnd)
    {
             cout <<"Window not found!";
             getch();
             return 0;
    }
    
    GetWindowThreadProcessId(hwnd,&pid);
    handle = OpenProcess(PROCESS_ALL_ACCESS,0,pid);
    if(!handle)
    {
               cout <<"Could not get window handle!";
               getch();
               return 0;
    }
    
    while ( base != end)
    {
          ReadProcessMemory(handle,(LPVOID)base,buffer,bSize,0);
          for(int i = 0; i < bSize; i++ )
          {
                  if(buffer[i] == value)
                  {
                               cout << hex << base + i << endl;
                  }
          } 

          if( (end-base) > bSize)
          {
              base += bSize;
          } else if( (end-base) < bSize)
          {
                 base += (end-base);
          }
          delete[] buffer;
    }
    cout <<"Done";
    getch();
}
It tells me i'm getting an unhandled win32 exception.
Thanks.
#1 · 16y ago
ZE
zeco
Hmm The problem seems to be that even thought you used readprocessmemory, you are still getting an access violation. I've never actually gotten the read and write process memory functions to work thought. I'm quite intrigued by this though. I'll play around and see what happens
#2 · 16y ago
Void
Void
I fixed it. I deleted the buffer after the while loop and it doesn't give me that error. But now it doesn't find any addresses with the value of 10.

I keep running into new problems.
#3 · 16y ago
Matrix_NEO006
Matrix_NEO006
DMA u mean?
#4 · 16y ago
Void
Void
It's not DMA.

Starting the search at 0x0000 doesn't work. I have to find the base address I think. Not sure if there's any function for that but if there is, let me know. Thanks.

If anyone would be kind enough to guide me through this little memory scan project of mine, PM me.

Thank you.
#5 · 16y ago
why06
why06
Hmmmm.... I wish BA was here. I'm not familiar with the Windows API. =/
#6 · 16y ago
crushed
crushed
If it wasn't for errors, there'd be no one to correct you and tell you where you went wrong. :P Just saying, LOL. Can't be any help since I'm starting C++. >.>
#7 · 16y ago
Void
Void
Does it really matter if i started scanning at an address that has no memory? Or does it affect the scan in some way? Cause right now, I have no idea what to do. I'm completely stuck.
#8 · 16y ago
Lolland
Lolland
Quote Originally Posted by why06 View Post
Hmmmm.... I wish BA was here. I'm not familiar with the Windows API. =/
Where's BA? Is he dead? Do I get to go to his funeral? Will there be cookies?
#9 · 16y ago
crushed
crushed
Quote Originally Posted by lolland View Post
Where's BA? Is he dead? Do I get to go to his funeral? Will there be cookies?
You'll get flowers and pretty dresses. Frolicking in the sunflower fields. Doesn't that sound exciting?
#10 · 16y ago
Void
Void
Who's BA?
Is he some sort of programming God?
#11 · 16y ago
B1ackAnge1
B1ackAnge1
I Don't know.. must be some crazy guy...

Anyway.. going off your latest posted code (so I didn't do a full rewrite the way I would do it )
a) First off you have a buffer that's oh... 93mb in size.. let's not do that and
knock bSize down to something a bit more sensible like 0xFFFF; (64kb)

b) You then proceed to delete that buffer INSIDE a reading loop, so the 2nd time it hits you're trying to write data to a garbage location => Crash

c) YOu should check the returned 'bytes read' from the ReadProcessMemory incase you don't read the full size, which would throw up as well if that were to happen

Here's a snippet that'll get you going:
Code:
DWORD bSize = 0xFFFF; 
DWORD* buffer = new DWORD[bSize];

..... bla bla bla ...

while ( base != end)
	{
		ULONG bytesRead = 0;
		if(ReadProcessMemory(handle,(LPVOID)base,buffer,bSize,&bytesRead) != 0)
		{
			for(DWORD i = 0; i < bytesRead; i++ )
			{
				if(buffer[i] == value)
				{
					cout << hex << base + i << endl;
				}
			} 
		}
		if( (end-base) > bSize)
		{
			base += bSize;
		} else if( (end-base) < bSize)
		{
			base += (end-base);
		}
		
	}
	delete[] buffer;
#12 · edited 16y ago · 16y ago
Void
Void
I love you.
I was right, programming God for sure.

Thanks so much. Although i'm almost 100% sure I will run into another problem concerning this topic.

Quick question, is it comparing each single byte to 10? If so, how do I compare 4 bytes to 10?

Sorry, noob question.
#13 · 16y ago
ZE
zeco
BA You are absolutely awesome =).
#14 · 16y ago
Void
Void
He is indeed, but like I said, I was almost 100% sure I would run into another problem, and I did.

I scanned using cheat engine and found about 400 addresses and when I used this method i got over 1600.

Was there a reason you changed byte to dword? I have no idea if this even affects the scan at all. But I don't think i'm getting the results i'm looking for with this scanner.

Thanks.
#15 · 16y ago
Posts 1–15 of 31 · Page 1 of 3

Post a Reply

Similar Threads

  • I hate errors.By Kyren in CrossFire Help
    3Last post 15y ago
  • [Opinion]I Hate VS Compiler ErrorsBy why06 in Coders Lounge
    13Last post 15y ago
  • Hellbreath Int Error?By RebornAce in General
    10Last post 17y ago
  • God hates sweden???? :SBy gunot in General
    9Last post 20y ago

Tags for this Thread

#errors#hate