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 


Calling In Game Function

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Mapleblitzer
Master Cheater
Reputation: 0

Joined: 08 Apr 2007
Posts: 254

PostPosted: Tue Aug 11, 2009 4:01 pm    Post subject: Calling In Game Function Reply with quote

Hi,

I'm having some problem with this code. Whenever I press the hotkey, it causes the game to crash, and I'm fairly certain its because of the call to the GetLocalPlayer function. I'm trying to call the address starting 17 bytes after the beginning, because there is a value check there.

Here is the source (code is mostly not mine, from rapion):


Any help is appreciated.

EDIT:

blah, nevermind. Not only did I not count right it messes up the stack. Thanks anyways!


Last edited by Mapleblitzer on Tue Aug 11, 2009 9:59 pm; edited 1 time in total
Back to top
View user's profile Send private message
smartz993
I post too much
Reputation: 2

Joined: 20 Jun 2006
Posts: 2013
Location: USA

PostPosted: Tue Aug 11, 2009 4:18 pm    Post subject: Reply with quote

You can't just call a function 17 bytes in.

You said there is a check, and that's why you do it.

It would make more sense to just hookhop that sequence of bytes in another small function, then jmp to it+17, then call your small function.
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Tue Aug 11, 2009 4:20 pm    Post subject: Reply with quote

man his code is pretty ugly. anyway what i would do is find out where it is crashing first of all probably by message boxes since you can't debug very easily. once you find that out, the rest is easy from there in general

might be worth it to check that dwGetLocalPlayer is not null or something
Back to top
View user's profile Send private message
Mapleblitzer
Master Cheater
Reputation: 0

Joined: 08 Apr 2007
Posts: 254

PostPosted: Tue Aug 11, 2009 6:45 pm    Post subject: Reply with quote

Thanks for your suggestions. I checked already before, using a messagebox and sprintf and dwGetLocalPlayer is returning 0, so I know there must be something wrong with the code when calling the function. Sorry for the messy code, I haven't learned proper coding practices (I'll do that after I finish this, it's been frustrating me for awhile now).

I'm not sure I understand what you mean by hookhop. The check in the beginning isn't like a preamble, its a check to see if I'm calling the function illegally (which this hack does to exploit unlimited potting).

Rapion already bypassed the check by basically recreating the whole call to GetLocalPlayer (its just 2 calls to other functions), but I want to find a different way to bypass it.

This is the whole function, the original function before the patch starts at 0x351858F7 (anything before is the check):

Code:
351858E0 - 8b 44 24 04                - mov eax,[esp+04]
351858E4 - 56                         - push esi
351858E5 - 50                         - push eax
351858E6 - 8b f1                      - mov esi,ecx
351858E8 - ff 15 f8 6f 32 35          - call dword ptr [ccharname_filter::initialize+9a0b8] : 02F818D8
351858EE - 8b c8                      - mov ecx,eax
351858F0 - e8 6b 0d 13 00             - call ccharname_filter::initialize+29720
351858F5 - 8b ce                      - mov ecx,esi
351858F7 - e8 44 ff ff ff             - call cplayer::getfieldinfo
351858FC - 8b c8                      - mov ecx,eax
351858FE - ff 15 a4 66 32 35          - call dword ptr [ccharname_filter::initialize+99764] : FieldInfo::GetLocalPlayer
35185904 - 5e                         - pop esi
35185905 - c2 04 00                   - ret 0004
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Wed Aug 12, 2009 1:34 am    Post subject: Reply with quote

well if dwGetLocalPlayer is 0 then when you call that + 17 then you are calling 0x17 which is non-allocated memory which is why its crashing. so you need to make sure dwGetLocalPlayer is holding the value you are wanting it to..
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
Page 1 of 1

 
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