Inline ASM Pointers

Technical Discussions not Related Directly to MHS. For Example, Coding, Hex Editing, General Hacking, Etc.

Moderators: g3nuin3, SpeedWing, WhiteHat

Inline ASM Pointers

Postby tahnsk » Fri Jun 18, 2010 11:24 pm

Alright, what I need to do is write the value 4 to this pointer in c++ inline asm:
[Value of 00400000] + 0x32F8


Can you give me an example what the code should be?
I tried this and it crashed me:

Code: Select all
   _asm {

       mov    eax,0x00400000
       mov    ebx,[eax]
       add    ebx,0x32F8
       mov    eax,[ebx]
       add    dword ptr ds:[eax],0x04
}



I USE THE ADDRESS 00400000 JUST FOR EXAMPLE
tahnsk
I Have A Few Questions
 
Posts: 5
Joined: Wed Jun 16, 2010 1:49 am

Re: Inline ASM Pointers

Postby L. Spiro » Sat Jun 19, 2010 10:13 pm

Why don’t you single-step through it to see which value is wrong and why?


L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Re: Inline ASM Pointers

Postby Felheart » Sat Jun 19, 2010 11:37 pm

if you want to write it to the address then why this:
add dword ptr ds:[eax],0x04

use mov for writing... maybe its just a typo.
Felheart
Acker
 
Posts: 89
Joined: Sun Apr 27, 2008 3:05 am
Location: Germany

Re: Inline ASM Pointers

Postby denispn » Sun Jun 20, 2010 6:47 pm

Hi!

Code: Select all
_asm {

       mov    eax,0x00400000
       mov    ebx,[eax]
       add    ebx,0x32F8
       mov    eax,[ebx]
       add    dword ptr ds:[eax],0x04
}


In line 4 you are doing this: eax = [[Value of 00400000] + 0x32F8], so eax stores the result of this expression, that is an address.
In line 5 you are adding 04h to the value eax points to, so [[[Value of 00400000] + 0x32F8]] = [[[Value of 00400000] + 0x32F8]] + 04h, like value = value + 04h.

Is this really what you want?

Cheers
denispn
Hacker Smacker
 
Posts: 43
Joined: Wed Dec 26, 2007 9:45 am


Return to Technical Unrelated

Who is online

Users browsing this forum: No registered users and 0 guests