flat assembler
Message board for the users of flat assembler.

Index > Windows > is it wrong for me to create eg: inside a PROC?

Author
Thread Post new topic Reply to topic
vbVeryBeginner



Joined: 15 Aug 2004
Posts: 884
Location: \\world\asia\malaysia
vbVeryBeginner
i tried the following.

Code:
format PE console
entry start

include '%fasminc%\win32a.inc'

section '.code' code readable executable
start:
                xor  eax,eax
stdcall mytest,1,2,3,4
invoke  ExitProcess,0

proc mytest hwnd,msg,wparam,lparam
                mov  eax,1
call    t1
call    t3
                ret

t1:
call    t2
                mov  eax,2
                ret

t2:
                mov  eax,3
                ret

t3:
                mov  eax,4
                ret
endp

section '.idata' import data readable
        library kernel32,'KERNEL32.DLL',\
                        user32,  'USER32.DLL',\
                        gdi32,   'GDI32.DLL'

        include '%fasminc%\apia\Kernel32.inc'
        include '%fasminc%\apia\User32.inc'
        include '%fasminc%\apia\Gdi32.inc'
    

after "call mytest", the EAX value is 3.
Post 13 Apr 2006, 22:48
View user's profile Send private message Visit poster's website Reply with quote
UCM



Joined: 25 Feb 2005
Posts: 285
Location: Canada
UCM
well, the stack would be waaay imbalanced by then, proc macro redefines `ret' so each ret becomes ret 16 (in your case)
Post 14 Apr 2006, 01:18
View user's profile Send private message Reply with quote
vbVeryBeginner



Joined: 15 Aug 2004
Posts: 884
Location: \\world\asia\malaysia
vbVeryBeginner
thanks ucm,
saw from olly too, retn 0x10
guess this is intended effect.

gonna take my t1: out from the proc Razz

[add]
just figured out, that i could

retn 0 (near)
ret 0
Post 14 Apr 2006, 01:39
View user's profile Send private message Visit poster's website 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. Also on YouTube, Twitter.

Website powered by rwasa.