flat assembler
Message board for the users of flat assembler.

Index > Main > Bug

Author
Thread Post new topic Reply to topic
_reckless



Joined: 16 Jul 2006
Posts: 5
_reckless 16 Jul 2006, 20:10
"proc" macro does not wrap stdcall functions properly
Exaple:
proc Handler stdcall uses eax,exception_pointers:DWORD
mov eax,[exception_pointers]
mov eax,dword [eax+4h]

virtual at eax
lpContext CONTEXT
end virtual

mov dword [lpContext.Eip],SafePlace
retn
endp
I've got this:

push ebp
mov ebp,esp
push eax
mov eax,[ebp+08h]
mov eax,[eax+04h]
mov dword ptr [eax+000000B4h],L00401011
retn

which is a stack unalignment.
Post 16 Jul 2006, 20:10
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 16 Jul 2006, 20:26
aaaahh, stack unbalance, use ret instead. I was trying to find an unaligned reference to the stack for a while in your code Razz
Post 16 Jul 2006, 20:26
View user's profile Send private message Reply with quote
_reckless



Joined: 16 Jul 2006
Posts: 5
_reckless 16 Jul 2006, 20:41
thanx, but i still think it should be fixed.
Post 16 Jul 2006, 20:41
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 16 Jul 2006, 20:56
But it's not a bug, you must return from a proc with "ret" which is another macro too defined in proc macro and purged in endp macro. "retn" is just the RETN instruction (unless you had defined a macro with that name).

If you dislike this behavior add "macro retn{ret}" at the beginning of your source (or before any attempt to use it).
Post 16 Jul 2006, 20:56
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-2023, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.