flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
okasvi 01 Apr 2006, 23:24
Code: format PE GUI 4.0 entry start include '%fasminc%\win32a.inc' ;______________________________________________________________________________ section '.text' code readable executable start: ;"bob"+"kim" push s0 push s3 push Buffer call [wsprintf] push Buffer push s3 push vA call [wsprintf] push 0 push s2 push vA push 0 call [MessageBox] ;"jim" push s1 push s3 push Buffer call [wsprintf] push Buffer push s3 push vB call [wsprintf] push 0 push s4 push vB push 0 call [MessageBox] ;End push 0 call [ExitProcess] ;______________________________________________________________________________ section '.data' data readable writeable s0 db 'bobkim',0 s1 db 'jim',0 s2 db 'vA',0 s3 db '%s',0 s4 db 'vB',0 Buffer rb 1024 vA rb 1024 vB rb 1024 vA rb 1024 vB rb 1024 ;______________________________________________________________________________ section '.idata' import data readable writeable library kernel32,'kernel32.dll',\ user32,'user32.dll' import kernel32,\ ExitProcess,'ExitProcess' import user32,\ wsprintf,'wsprintfA',\ MessageBox,'MessageBoxA' looks stupid because board uses bigger tab-width... _________________ When We Ride On Our Enemies support reverse smileys |: |
|||
![]() |
|
Killswitch 01 Apr 2006, 23:28
Oh mate! You're a legend! Thanks for this
![]() BTW: You declared vA and vB twice in the data section, I removed the second declaration and it was fine - that was just a mistake right, or am I missing something? |
|||
![]() |
|
okasvi 02 Apr 2006, 01:07
yep, a mistake...
_________________ When We Ride On Our Enemies support reverse smileys |: |
|||
![]() |
|
Vasilev Vjacheslav 02 Apr 2006, 14:27
wsprintf not stdcall, it's cdecl
cinvoke wsprintf,szbuffer,szmask,szfigure |
|||
![]() |
|
Killswitch 02 Apr 2006, 14:28
I don't understand, sorry?
|
|||
![]() |
|
RedGhost 02 Apr 2006, 23:21
Vasilev Vjacheslav wrote: wsprintf not stdcall, it's cdecl Killswitch wrote: I don't understand, sorry? in a stdcall convention procedure the stack is balanced inside the procedure itself with 'retn #', but in cdecl (the default calling convention of the crt library) you must balance the stack after the call (i think this is probably for VARAGS like wsprintfA?) so you would do Code: push dword 2 push dword 1 call [cdecl_procedure] add esp, 8 ;8 bytes passed 'cinvoke' rather than 'invoke' will do the stack balancing for you, so use cinvoke in this case _________________ redghost.ca |
|||
![]() |
|
Vasilev Vjacheslav 03 Apr 2006, 07:07
RedGhost, thanx for help
![]() |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.