View previous topic :: View next topic |
Author |
Message |
comm3451 How do I cheat? Reputation: 0
Joined: 28 Jul 2021 Posts: 8
|
Posted: Wed Jul 28, 2021 8:20 pm Post subject: How to make readmem in c++ |
|
|
I made a CRC bypass and I want to make it in C++.
Alloc(CRC1Copy,2048)
CRC1Copy:
Readmem(CRC1,2048)
so I use memcpy but not work, how?
|
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8517 Location: 127.0.0.1
|
Posted: Wed Jul 28, 2021 10:49 pm Post subject: |
|
|
Show the code you are trying to do in C++, just saying you tried memcpy isn't really showing what you have tried to do or if you're just using things wrong.
_________________
- Retired. |
|
Back to top |
|
|
comm3451 How do I cheat? Reputation: 0
Joined: 28 Jul 2021 Posts: 8
|
Posted: Wed Jul 28, 2021 10:53 pm Post subject: |
|
|
void* CRC1Copy = new void*;
memcpy(CRC1Copy,(void*)baseoffect + CRCOffset,sizeof(void*) * 2048)
|
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8517 Location: 127.0.0.1
|
Posted: Wed Jul 28, 2021 11:12 pm Post subject: |
|
|
If you know the size that you plan to copy, there is no reason to ever use 'new'. (You should basically never be using it in C++ anymore unless you are absolutely sure you need to and understand what you're doing.)
You are also using 'new' wrong and creating an invalid pointer/type for what you're trying to do. You are also going to land up overwriting invalid memory creating a heap corruption. Using 'new void*' is only creating a single void* object which is 4 bytes long.
Instead, you should just make a buffer with the size you want, such as:
Code: |
uint8_t buffer[2048]{};
std::memcpy(&buffer, (void*)SomeAddress, 2048);
|
Where SomeAddress is the addr you want to read from.
Keep in mind, memcpy only works when you're injected into the target process. You must be within the same process memory space for it to work. Otherwise, you need to use ReadProcessMemory, or other remote process calls that deal with reading memory.
_________________
- Retired. |
|
Back to top |
|
|
comm3451 How do I cheat? Reputation: 0
Joined: 28 Jul 2021 Posts: 8
|
Posted: Thu Jul 29, 2021 8:58 pm Post subject: |
|
|
Crashes when I using memcpy so I try ReadProcessMemory
DWORD CRCADD= moduleBase + 0x013F87B6;
uint8_t CRC[2048]{};
ReadProcessMemory(GetModuleHandle(NULL), (LPCVOID)CRCADD,&CRC, (SIZE_T)2048,0);
like this
but When I find Memory Address
add [eax],al
add [eax],al
add [eax],al
add [eax],al
it's wrong And after a while the crashes
How to fix it?
I'm making dll
|
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8517 Location: 127.0.0.1
|
Posted: Fri Jul 30, 2021 1:53 pm Post subject: |
|
|
If your DLL is injected into the remote process, you don't need to use ReadProcessMemory. Just stick to using memcpy. As for the crash you need to debug to find out why it is crashing. In most cases, it's probably because you have an invalid address you are trying to read from. That can be due to just a bad address in general or bad casting.
A common cause is due to how you are handling the additions from a module base and any offset. Such as:
Code: | DWORD CRCADD= moduleBase + 0x013F87B6; |
Depending on what type moduleBase is, you can be creating an invalid/incorrect address. Try casting it first to a DWORD as well such as:
Code: | DWORD CRCADD= (DWORD)moduleBase + 0x013F87B6; |
_________________
- Retired. |
|
Back to top |
|
|
comm3451 How do I cheat? Reputation: 0
Joined: 28 Jul 2021 Posts: 8
|
Posted: Fri Jul 30, 2021 9:42 pm Post subject: :( |
|
|
Hmm... Sometimes it crashes and sometimes it doesn't crash. Is this game weird?
|
|
Back to top |
|
|
STN I post too much Reputation: 42
Joined: 09 Nov 2005 Posts: 2672
|
Posted: Fri Aug 13, 2021 9:01 am Post subject: Re: :( |
|
|
comm3451 wrote: | Hmm... Sometimes it crashes and sometimes it doesn't crash. Is this game weird? |
Probably not, we can't say until we see the rest of your code and learn the game's name.
_________________
|
|
Back to top |
|
|
|