flat assembler
Message board for the users of flat assembler.
Index
> Windows > MessageBoxF implementation |
Author |
|
vid 12 Nov 2008, 12:48
in 32 bits, off my head (might need some fixes):
Code: cproc MessageBoxF, hWnd, szFormat, szCaption, uType local szBuffer[1024]:BYTE lea eax, [uType+4] stdcall vsnprintf_s, addr szBuffer, 1024, [szFormat], eax stdcall MessageBox, [hWnd], addr szBuffer, [szCaption], [uType] ret endp |
|||
12 Nov 2008, 12:48 |
|
asmcoder 12 Nov 2008, 13:44
[content deleted]
Last edited by asmcoder on 14 Aug 2009, 14:55; edited 1 time in total |
|||
12 Nov 2008, 13:44 |
|
windwakr 12 Nov 2008, 13:50
According to a simple search, something you are not capable of, its "a MessageBox with printf functionality.".
|
|||
12 Nov 2008, 13:50 |
|
LocoDelAssembly 12 Nov 2008, 13:56
Quote:
http://en.wikipedia.org/wiki/Printf Quote: The class of printf functions (which stands for "print formatted")... |
|||
12 Nov 2008, 13:56 |
|
Alessio 12 Nov 2008, 14:19
I've rewritten in this way
Code: proc MessageBoxF c,hWnd,szFormat,szCaption,uType local szBuffer[1024]:BYTE lea eax,[uType+4] cinvoke _vsnprintf,addr szBuffer,1024,[szFormat],eax invoke MessageBox,[hWnd],addr szBuffer,[szCaption],[uType] ret endp I think that is right to use cinvoke for _vsnprintf and invoke for MessageBox. There's a way to avoid using _vsnprintf and use macros ? Last edited by Alessio on 13 Nov 2008, 15:43; edited 1 time in total |
|||
12 Nov 2008, 14:19 |
|
vid 12 Nov 2008, 22:50
F stands for "format" as on "formatted output".
_vsnprintf is CCALL? Why, it has fixed number of arguments, and all that stdcall shit... but I really am not sure. |
|||
12 Nov 2008, 22:50 |
|
vid 13 Nov 2008, 09:02
Quote: I've rewritten in this way It must be "cproc", not stdcall "proc", because it is vararg. Quote: I think that is right to use cinvoke for _vsnprintf and invoke for MessageBox. Not sure, check the C header. You might be right. Quote: There's a way to avoid using _vsnprintf and use macros ? no |
|||
13 Nov 2008, 09:02 |
|
Alessio 13 Nov 2008, 10:46
Quote:
It is not stdcall proc is Quote:
"c" after MessageBoxF doesn't make difference ? Last edited by Alessio on 13 Nov 2008, 15:42; edited 1 time in total |
|||
13 Nov 2008, 10:46 |
|
LocoDelAssembly 13 Nov 2008, 13:21
Quote:
According to http://flatassembler.net/docs.php?article=win32 it does. Also the doc has no mentions of "cproc" and after including win32axp.inc fasm keeps saying "illegal instruction" |
|||
13 Nov 2008, 13:21 |
|
vid 13 Nov 2008, 15:33
My bad, i thought macro name was "cproc". Wasn't it "cproc" at least some time ago?
|
|||
13 Nov 2008, 15:33 |
|
baldr 13 Nov 2008, 16:05
vid,
You're right, up to 1.60 (AFAIK, 61-63 hole in my archive) there was cproc macro. match definitely supersede separate procs… |
|||
13 Nov 2008, 16:05 |
|
vid 13 Nov 2008, 18:06
btw baldr, i think nicer allowed syntax is more MASMy:
Code: proc Something c arg1,arg2 So it is clear that "c" is not an argument. If I remember correctly, this was allowed by macro (using some ugly nested macro tricks ) |
|||
13 Nov 2008, 18:06 |
|
baldr 13 Nov 2008, 19:06
vid,
Nobody can stop you from adding even more matches to the pile... |
|||
13 Nov 2008, 19:06 |
|
vid 13 Nov 2008, 22:57
Yeah, i liked "cproc" better, anyway.
|
|||
13 Nov 2008, 22:57 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.