flat assembler
Message board for the users of flat assembler.

flat assembler > Windows > enter/return problem

Author
Thread Post new topic Reply to topic
mimas



Joined: 21 Jul 2003
Posts: 10
Hi there,
I'm writing a fasm skeleton for PEiD's plugin (DLLs), and I've got problem with macro enter/return

Here is the code of the exported procedure
Code:
proc DoMyJob, hMainDlg, szFname, lpReserved, lpParam
     enter
     invoke MessageBox, [hMainDlg], [szFname], szTitle, MB_ICONWARNING+MB_OK
     mov eax, 2
     return  
    

The plugin makes an error when it returns to the caller. Normaly the stack is "cleaned" in the PEiD code but the enter & leave combo cleans the stack before with a "ret 10" making the EIP to be lose in strange and deeper memory address. So, where is a way to not clean the stack, just a leave & ret not a leave & ret 10 ?

Thanks
Post 14 Jan 2004, 16:54
View user's profile Send private message Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1118
Location: Russian Federation
use cproc, include cdecl.inc

_________________
comrade (comrade64@live.com; http://comrade.ownz.com/)
Post 15 Jan 2004, 01:10
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
Kevin_Zheng



Joined: 04 Jul 2003
Posts: 125
Location: China
It's another method:
using the belowing code to replace the "return" macro instruction.

Code:
leave
ret    
Post 15 Jan 2004, 04:34
View user's profile Send private message MSN Messenger Reply with quote
mimas



Joined: 21 Jul 2003
Posts: 10
Thanks, I had missed the cdecl.inc.
Post 18 Jan 2004, 21:25
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-2018, Tomasz Grysztar.

Powered by rwasa.