| View previous topic :: View next topic |
| Author |
Message |
Spub How do I cheat?
Reputation: 0
Joined: 10 Jul 2014 Posts: 9
|
Posted: Wed Sep 02, 2015 3:51 pm Post subject: Reading eax register in C++ |
|
|
So I have an instruction that looks like this
eax holds the address of the item I want to change.
How would I go about getting it's value in C++?
Also, is there a library for a simple aobscan in c++ or would I have to write that myself?
Thanks
|
|
| Back to top |
|
 |
deama1234 Master Cheater
Reputation: 3
Joined: 20 Dec 2014 Posts: 328
|
Posted: Wed Sep 02, 2015 4:15 pm Post subject: |
|
|
| It's more fun to learn assembly.
|
|
| Back to top |
|
 |
Spub How do I cheat?
Reputation: 0
Joined: 10 Jul 2014 Posts: 9
|
Posted: Wed Sep 02, 2015 4:23 pm Post subject: |
|
|
| deama1234 wrote: | | It's more fun to learn assembly. |
While that may be true, I want to do this in c++ because there are some special GUI things I would like to do that CE just can't.
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25820 Location: The netherlands
|
Posted: Wed Sep 02, 2015 4:29 pm Post subject: |
|
|
you can always create a CEplugin which launches your gui and then make use of the lua interface
But if you insist, it's going to either require a code injection or a breakpoint.
For code injection:
Find the address to hook (e.g aobscan or modulename+offset)
Allocate some memory somewhere
In that code write the bytes that make up code that will save EAX to a known location and jump back after the instruction
Then write the bytes at the found location to make it jump to your allocated code. (do it in this order as there's a chance the code will execute before the first part is written)
_________________
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 |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
|
| Back to top |
|
 |
Spub How do I cheat?
Reputation: 0
Joined: 10 Jul 2014 Posts: 9
|
Posted: Wed Sep 02, 2015 6:11 pm Post subject: |
|
|
| Dark Byte wrote: | you can always create a CEplugin which launches your gui and then make use of the lua interface
But if you insist, it's going to either require a code injection or a breakpoint.
For code injection:
Find the address to hook (e.g aobscan or modulename+offset)
Allocate some memory somewhere
In that code write the bytes that make up code that will save EAX to a known location and jump back after the instruction
Then write the bytes at the found location to make it jump to your allocated code. (do it in this order as there's a chance the code will execute before the first part is written) |
Okay, seems simple enough. I'm assuming that if I attempt this on a steam game like Dark Souls (even if I'm offline) a vac ban could ensue?
| atom0s wrote: | Take a look at the GetThreadContext API:
Sorry, but you can't post url's yet |
I'm not quite sure what this does. Does it let me view register values?
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Thu Sep 03, 2015 12:33 am Post subject: |
|
|
When a thread is suspended, you can obtain the threads context to view the register data. The context structure you pass as the 2nd parameter is filled with the threads information when you call this API. It will contain the various data you have opened the handle to the thread with.
_________________
- Retired. |
|
| Back to top |
|
 |
Spub How do I cheat?
Reputation: 0
Joined: 10 Jul 2014 Posts: 9
|
Posted: Thu Sep 03, 2015 12:14 pm Post subject: |
|
|
Well, after more access violations than I can count I finally got GetThreadContext() working. I still need some help though
I took a snapshot of all the threads and filtered to only the ones that match my game's process id, but there still a bunch of them. How do I know which one to get the context of?
And secondly, how do I get the context of the thread at the right time? Does that have to do with the breakpoints that Dark Byte mentioned?
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Thu Sep 03, 2015 9:08 pm Post subject: |
|
|
Yes you will need to set a breakpoint and handle it (attach to the process as a debugger).
_________________
- Retired. |
|
| Back to top |
|
 |
|