flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > fasm 1.72: generates code for empty functions

Author
Thread Post new topic Reply to topic
ShabbyBumblebutt



Joined: 02 Jan 2018
Posts: 5
ShabbyBumblebutt 02 Jan 2018, 01:02
Code:
format PE GUI 4.0 DLL
entry DllEntryPoint

include 'win32a.inc'

section '.text' code readable executable

proc DllEntryPoint hinstDLL,fdwReason,lpvReserved
        mov     eax,TRUE
        ret
endp

proc funcA a,b,c,d
endp
proc funcW a,b,c,d
        xor eax,eax
        ret
endp

section '.edata' export data readable

  export 'FAKE.DLL',\
        funcA, 'funcA', funcW, 'funcW'
    


Code:
funcA:     55                             push        ebp
.0040100D: 89E5                           mov         ebp,esp
funcW:     55                             push        ebp
.00401010: 89E5                           mov         ebp,esp
.00401012: 31C0                           xor         eax,eax
.00401014: C9                             leave
.00401015: C21000                         retn        00010 ;
    


Such crap works in Masm (no code for empty function).
I tried to make two functions with same address, now i did it trough "funcW, 'funcA', funcW, 'funcW'" in export.
Post 02 Jan 2018, 01:02
View user's profile Send private message Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 817
Location: Russian Federation, Sochi
ProMiNick 02 Jan 2018, 08:31
proc is macro that makes code
push ebp
mov ebp,esp
if symbol after proc is used. And yes it is used in edata section.

If you want that proc only declare label you should override proc.

masm is obsolete software and its syntax is obsolete too - use "label funcA at funcW" in fasm & you will no needed to override any macros in your case.
Post 02 Jan 2018, 08:31
View user's profile Send private message Send e-mail 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.