Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[C++] Allocating memory, using it, and making breakpoints?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
`unknown
Grandmaster Cheater
Reputation: 0

Joined: 20 Nov 2006
Posts: 658
Location: You lost the game.

PostPosted: Thu Feb 19, 2009 6:17 pm    Post subject: [C++] Allocating memory, using it, and making breakpoints? Reply with quote

Okay, so basically I am trying to learn some C++ to achieve some memory edits, to make a trainer. I was wondering if someone could link me to some good tutorials or post some snippets that would assist me in recreating this in C++









I know the variables can be defined as int's, but how would they be referenced?

If you need anymore information, let me know.
Back to top
View user's profile Send private message MSN Messenger
BanMe
Master Cheater
Reputation: 0

Joined: 29 Nov 2005
Posts: 375
Location: Farmington NH, USA

PostPosted: Thu Feb 19, 2009 6:27 pm    Post subject: Reply with quote

you cannot depend on the same location in memory always being there..

int shouldn't be used unsigned long or DWORD's should..

will your trainer be a plugin to CE?

i definitly need more info to understand what your doing..

Regards BanMe
Back to top
View user's profile Send private message MSN Messenger
`unknown
Grandmaster Cheater
Reputation: 0

Joined: 20 Nov 2006
Posts: 658
Location: You lost the game.

PostPosted: Thu Feb 19, 2009 6:30 pm    Post subject: Reply with quote

BanMe wrote:
you cannot depend on the same location in memory always being there..

Why not? I've already established it's a static address.

BanMe wrote:
int shouldn't be used unsigned long or DWORD's should..

Alright, will remember that when coding.

BanMe wrote:
will your trainer be a plugin to CE?

No it will be a DLL I will inject into the game.

Anything else you need to know?
Back to top
View user's profile Send private message MSN Messenger
BanMe
Master Cheater
Reputation: 0

Joined: 29 Nov 2005
Posts: 375
Location: Farmington NH, USA

PostPosted: Thu Feb 19, 2009 6:39 pm    Post subject: Reply with quote

the address maybe static but the allocated memory that you use to store the data will not always be in the same place, because it may be used by the game or another dll or w/e

also if your injecting a Dll
this is how you could hook that static address..

Code:

LPVOID HookCode = VirtualAlloc(PAGE_EXECUTE_READWRITE,...);
LPVOID HookData = VirtualAlloc(PAGE_READWRITE,...);
//write Opcodes to hookCode using HookData to store the data
DWORD sAddr = 0x6b1276;
*(BYTE*)sAddr = 0xe9
sAddr++;
*(DWORD*)sAddr = HookCode;


hope this clears up some things..
Back to top
View user's profile Send private message MSN Messenger
`unknown
Grandmaster Cheater
Reputation: 0

Joined: 20 Nov 2006
Posts: 658
Location: You lost the game.

PostPosted: Thu Feb 19, 2009 6:43 pm    Post subject: Reply with quote

Oh yeah, I know the allocated memory won't be static. But thanks for the info. Only thing is that won't work because the game has a CRC. I need to make a breakpoint I believe.
Back to top
View user's profile Send private message MSN Messenger
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Thu Feb 19, 2009 6:51 pm    Post subject: Reply with quote

Hes trying to make a debugger to get hardware breakpoints to work.

1. Research SetThreadContext and GetThreadCOntext. (You will need this)
2. Make your self a driver to copy the kernel and rehook the NtSetContextTHread and NtGetContextThread so they work while gameguard is running.
3. Look at CE's source. Dark byte has a working Debugger. You could learn from that.
Back to top
View user's profile Send private message
BanMe
Master Cheater
Reputation: 0

Joined: 29 Nov 2005
Posts: 375
Location: Farmington NH, USA

PostPosted: Thu Feb 19, 2009 6:55 pm    Post subject: Reply with quote

if it has a CRC your dll injection will be detected..i doubt it has a runtime CRC.. and if it does i would load it in Olly and break on TLS..
Back to top
View user's profile Send private message MSN Messenger
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Thu Feb 19, 2009 7:24 pm    Post subject: Reply with quote

Im sorry. I looked at it again. And maplestory private servers do not have crc checks. SO! all you have to do is rewrite your jump over the address instead of setting the eip. No GameGuard=No CRC Detection.
Back to top
View user's profile Send private message
wassssup34579
How do I cheat?
Reputation: 0

Joined: 13 Jul 2008
Posts: 3

PostPosted: Thu Feb 19, 2009 8:30 pm    Post subject: Re: [C++] Allocating memory, using it, and making breakpoint Reply with quote

i suggest you learn more about SEH (Structured Exception Handling). use the SetUnhandledExceptionFilter and SetThreadContext API's to create a memory breakpoint so you will be able to set any of the debug registers. (Including EIP!)

also, you wont need to allocate any memory... but if you ever need to, use the VirtualAlloc API.
Back to top
View user's profile Send private message AIM Address MSN Messenger
BanMe
Master Cheater
Reputation: 0

Joined: 29 Nov 2005
Posts: 375
Location: Farmington NH, USA

PostPosted: Thu Feb 19, 2009 8:43 pm    Post subject: Reply with quote

fs:[0] = Exception dispatch chain..

EIP != Debug register..

if(size(HeapAlloc())>PageGranularity)
use VirtualAlloc

i suggest looking into y0da's SEHCall it should Still be on the NET somewhere..

you are restricted from modifying EIP with SetThreadContext..

and if no CRC or no GG then.. my method will work no problem.. Smile

regards BanMe
Back to top
View user's profile Send private message MSN Messenger
`unknown
Grandmaster Cheater
Reputation: 0

Joined: 20 Nov 2006
Posts: 658
Location: You lost the game.

PostPosted: Thu Feb 19, 2009 9:03 pm    Post subject: Reply with quote

I'm making it for GMS, not a private server. The CRC doesn't detect DLL injection, there are already several working DLLs. So I do need to bypass a CRC. Will wassup's method work for doing so?
Back to top
View user's profile Send private message MSN Messenger
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Thu Feb 19, 2009 9:06 pm    Post subject: Reply with quote

If your trying to program a gms crc bypass then give up.

You can look at CE's source...


Last edited by dnsi0 on Fri Feb 20, 2009 2:41 pm; edited 1 time in total
Back to top
View user's profile Send private message
`unknown
Grandmaster Cheater
Reputation: 0

Joined: 20 Nov 2006
Posts: 658
Location: You lost the game.

PostPosted: Thu Feb 19, 2009 9:10 pm    Post subject: Reply with quote

No I'm not trying to make a CRC Bypass Razz
I'm trying to read HP/MP values from a call stack by hooking the function and making a code cave to copy the values.
Back to top
View user's profile Send private message MSN Messenger
Zerith
Master Cheater
Reputation: 1

Joined: 07 Oct 2007
Posts: 468

PostPosted: Fri Feb 20, 2009 1:48 am    Post subject: Reply with quote

I did this a while ago, but in a diffrent way, I got the values after they've been decrypted because I found the decryption function easily. Smile

`unknown wrote:
I'm making it for GMS, not a private server. The CRC doesn't detect DLL injection, there are already several working DLLs. So I do need to bypass a CRC. Will wassup's method work for doing so?

No, because his method is using memory breakpoints, which is patched.
There is another way, but it won't always work, I once made an Item Vac by hooking PtInRect and returned true if the looting function called it, I simply changed the IAT and instead of PtInRect address I changed it to my hook address. The CRC doesn't check the IAT, or at least it didn't back then.
What you can do is see if there are any calls of the form call dword ptr ds:[address] anywhere near the place you want to hook and check if the values are in the stack while it's being called, if so then make your hook there. I did this with another hack.

By the way, this is not my account, I'm just using my friend's account.
Back to top
View user's profile Send private message MSN Messenger
sponge
I'm a spammer
Reputation: 1

Joined: 07 Nov 2006
Posts: 6009

PostPosted: Fri Feb 20, 2009 4:05 am    Post subject: Reply with quote

"IAT" hooks will work. (Secondary IAT for MS. You'll see it become populated as MS loads.)
_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites