| View previous topic :: View next topic |
| Author |
Message |
Mapleblitzer Master Cheater
Reputation: 0
Joined: 08 Apr 2007 Posts: 254
|
Posted: Tue Aug 11, 2009 4:01 pm Post subject: Calling In Game Function |
|
|
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 |
|
 |
smartz993 I post too much
Reputation: 2
Joined: 20 Jun 2006 Posts: 2013 Location: USA
|
Posted: Tue Aug 11, 2009 4:18 pm Post subject: |
|
|
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 |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Tue Aug 11, 2009 4:20 pm Post subject: |
|
|
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 |
|
 |
Mapleblitzer Master Cheater
Reputation: 0
Joined: 08 Apr 2007 Posts: 254
|
Posted: Tue Aug 11, 2009 6:45 pm Post subject: |
|
|
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 |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Wed Aug 12, 2009 1:34 am Post subject: |
|
|
| 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 |
|
 |
|