| View previous topic :: View next topic |
| Author |
Message |
&Vage Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Jul 2008 Posts: 1053
|
Posted: Wed Dec 17, 2008 10:48 am Post subject: Invalid Pointer? |
|
|
| 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
|
|
|
| Back to top |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Wed Dec 17, 2008 11:23 am Post subject: |
|
|
| What the hell?
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Wed Dec 17, 2008 11:53 am Post subject: |
|
|
| What the fuck?
|
|
| Back to top |
|
 |
Zand Master Cheater
Reputation: 0
Joined: 21 Jul 2006 Posts: 424
|
Posted: Wed Dec 17, 2008 12:05 pm Post subject: Re: Invalid Pointer? |
|
|
| _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
|
 |
No shit right? MOBWZ = 0 and that's why it says 0 there?
|
|
| Back to top |
|
 |
killersamurai Expert Cheater
Reputation: 0
Joined: 10 Sep 2007 Posts: 197 Location: Colorado
|
Posted: Wed Dec 17, 2008 1:59 pm Post subject: |
|
|
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 |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Wed Dec 17, 2008 2:11 pm Post subject: |
|
|
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 |
|
 |
killersamurai Expert Cheater
Reputation: 0
Joined: 10 Sep 2007 Posts: 197 Location: Colorado
|
Posted: Wed Dec 17, 2008 3:40 pm Post subject: |
|
|
| 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 |
|
 |
|