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 


Invalid Pointer?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
&Vage
Grandmaster Cheater Supreme
Reputation: 0

Joined: 25 Jul 2008
Posts: 1053

PostPosted: Wed Dec 17, 2008 10:48 am    Post subject: Invalid Pointer? Reply with quote

Code:

DWORD MOBWZ = 0;
printf("Found Mob.wz! Addr: %X | End of Addr: %X08", MOBWZ, MOBWZ+0xC4C3490);

.text:10001252                 push    0C4C3490h
.text:10001257                 push    0  ; <------ Suppose to be MOBWZ
.text:10001259                 push    offset aFoundMob_wzAdd ; "Found Mob.wz! Addr: %X | End of Addr: %"...
.text:1000125E                 call    edi ; __imp__printf



Neutral
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Wed Dec 17, 2008 11:23 am    Post subject: Reply with quote

What the hell?
Back to top
View user's profile Send private message MSN Messenger
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Wed Dec 17, 2008 11:53 am    Post subject: Reply with quote

What the fuck?
Back to top
View user's profile Send private message
Zand
Master Cheater
Reputation: 0

Joined: 21 Jul 2006
Posts: 424

PostPosted: Wed Dec 17, 2008 12:05 pm    Post subject: Re: Invalid Pointer? Reply with quote

_void_ wrote:
Code:

DWORD MOBWZ = 0;
printf("Found Mob.wz! Addr: %X | End of Addr: %X08", MOBWZ, MOBWZ+0xC4C3490);

.text:10001252                 push    0C4C3490h
.text:10001257                 push    0  ; <------ Suppose to be MOBWZ
.text:10001259                 push    offset aFoundMob_wzAdd ; "Found Mob.wz! Addr: %X | End of Addr: %"...
.text:1000125E                 call    edi ; __imp__printf



Neutral


No shit right? MOBWZ = 0 and that's why it says 0 there?
Back to top
View user's profile Send private message
killersamurai
Expert Cheater
Reputation: 0

Joined: 10 Sep 2007
Posts: 197
Location: Colorado

PostPosted: Wed Dec 17, 2008 1:59 pm    Post subject: Reply with quote

Is this inline asm or are you actually compiling the c code? If you're doing it through c code, a compiler would do something like this

Code:

mov eax, dword ptr[MOBWZ]
add eax, 0C4C3490h
push eax
mov eax, dword ptr[MOBWZ]
push eax
push offset format_string
call printf ; not too sure if there is more to it


From the asm you posted, the printf would look like this
Code:

printf("Found Mob.wz! Addr: %X | End of Addr: %X08", 0, 0x0C4C3490);
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Wed Dec 17, 2008 2:11 pm    Post subject: Reply with quote

I think he's asking why there's a "push constant" instruction instead of "push [pointer]"...
The compiler is pretty smart, it treated MOBWZ as constant because nothing used it, reading only...

Try using it? then it should push [ebp+xx], I guess. (still 0 though, you declared MOBWZ = 0, unless you changed it before reading from it)
Back to top
View user's profile Send private message
killersamurai
Expert Cheater
Reputation: 0

Joined: 10 Sep 2007
Posts: 197
Location: Colorado

PostPosted: Wed Dec 17, 2008 3:40 pm    Post subject: Reply with quote

That is true when the compiler is told to optimize the code. If there is no optimization going on, it will replicate that code only if the preprocessor directive #define is used. I was assuming no optimization was going on, which is my fault.
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