|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Tobilo How do I cheat? Reputation: 0
Joined: 19 Jan 2018 Posts: 8
|
Posted: Mon Feb 19, 2018 5:58 am Post subject: C++ ReadProcessMemory (Memory Access Violation) |
|
|
Code: |
DWORD read;
MEMORY_BASIC_INFORMATION mbi;
char* chunk = 0;
if (!VirtualQueryEx(readhandle, chunk, &mbi, sizeof(mbi))) {
return GetLastError();
}
char buffer[mbi.RegionSize];
ReadProcessMemory(readhandle, mbi.BaseAddress, &buffer, mbi.RegionSize, &read);
|
I have a problem, because the Memory Region (Size:7864320) I want to read is actually resulting in a memory access violation, since the array is too big. Is there a way to avoid that?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25295 Location: The netherlands
|
Posted: Mon Feb 19, 2018 6:37 am Post subject: |
|
|
instead of &buffer give buffer, else you're giving the address of the buffer pointer in the stack
(Also, instead of allocating buffer in the stack, you may wish to allocate it separately. The stack might be big enough)
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
Tobilo How do I cheat? Reputation: 0
Joined: 19 Jan 2018 Posts: 8
|
Posted: Mon Feb 19, 2018 9:32 am Post subject: |
|
|
Dark Byte wrote: | instead of &buffer give buffer, else you're giving the address of the buffer pointer in the stack
(Also, instead of allocating buffer in the stack, you may wish to allocate it separately. The stack might be big enough) |
Thank you, I am relatively new to c++, by allocating the buffer separately and by giving the buffer directly it worked. But the main problem was that I did not wrote Code: | char *buffer = new char[mbi.RegionSize]; | since this statement was in a loop...
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|