flat assembler
Message board for the users of flat assembler.

Index > Windows > Strings - confused again

Author
Thread Post new topic Reply to topic
denial



Joined: 12 Sep 2004
Posts: 98
denial 24 Jan 2005, 16:47
This question is about understanding something about strings. I know I could use macros to do this better than it is possible with my humble assembly knowledge, but I want to learn. I would be glad about answers.

So when I try to invoke a correctly imported function like MessageBox (through macros, though Wink), I'd like to push the arguments at my own without invoke. I tried:

Code:
push MB_OK

push _string2
jmp @f
_string2 db "Caption",0
@@:

push _string1
jmp @f
_string1 db "My Text Smile",0
@@:

push dword 0

call [MessageBox]
    


This code works. But if I try to reserve bytes and define the strings before I push them, it doesn't work anymore. I personally wonder, why? The Box shows up but Caption and Text seem to be empty. I thought the reason could be, that I didn't declare a binary 0 at the end of the string. But the WIN API Helpfile says, that wsprintf adds a binary 0 automatically.

Code:
push MB_OK

cinvoke wsprintf,_string2,'%s',"Caption"
push _string2
jmp @f
_string2 rb 20
@@:

(... same for string 1...)

push dword 0

call [MessageBox]
    
Post 24 Jan 2005, 16:47
View user's profile Send private message 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.