flat assembler
Message board for the users of flat assembler.

Index > Windows > MessageBox and Registers

Author
Thread Post new topic Reply to topic
RauL



Joined: 17 Feb 2005
Posts: 7
RauL
Hello,

I was just trying this out, but got stuck. I'd be glad if someone can help me out.

Consider that I have 19286300h in eax. The MessageBox function needs the address to a memory location from which it can read a null-terminated string. Now I'd like to pass the content of the eax register, as in above (the 4 bytes) as the string. Thus I assume I'd get a 3 letter word shown up (considering the fourth byte to be a null-terminator). But I'm a bit confused on how to do this. Because with whatever I tried, Windows tries to read the memory address located in eax and tries to reference it, which it fails to. I want to treat the value in eax itself as a string.
Post 15 Jul 2007, 07:51
View user's profile Send private message Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
It's not possible to do it the way you want, you'd have to define the data somewhere then reference the data label. Like:
Code:
lstring dd 0x19286300
...
mov     eax, lstring    
Post 15 Jul 2007, 08:00
View user's profile Send private message Reply with quote
SFeLi



Joined: 03 Nov 2004
Posts: 140
Location: Severodvinsk, Russia
SFeLi
Code:
start:  mov     eax,0x00434241
        ;...
        push    eax
        mov     edx,esp
        stdcall [MessageBox],NULL,edx,NULL,MB_ICONINFORMATION
        pop     eax
        retn
    
Post 15 Jul 2007, 11:47
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
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


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.