flat assembler
Message board for the users of flat assembler.

Index > Windows > how to use fasm to write "Forworders function"?

Author
Thread Post new topic Reply to topic
nayan007



Joined: 05 Dec 2015
Posts: 1
nayan007
in masm ,it would be something like this:

EXPORTS
SomeFunc=DllWork.SomeFunc

i wrote such code like this,it can compile correctly, but can't be loaded by api LoadLibrary,getlasterror 126.

who can give me some advice,3Q.
Code:
; DLL creation example
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

section '.idata' import data readable writeable
  library kernel,'KERNEL32.DLL'

  import kernel,\
         LZStart,'LZStart'
         
section '.edata' export data readable 

  export 'MYLZ32.DLL',\
         LZStart,'LZStart'

section '.reloc' fixups data readable discardable
    
[/b]
Post 05 Dec 2015, 09:25
View user's profile Send private message Reply with quote
l_inc



Joined: 23 Oct 2009
Posts: 881
l_inc
nayan007
You should not import the function you forward. Just put the forwarder string into the export directory:
Code:
section '.edata' export data readable 

  export 'MYLZ32.DLL',\
         LZStart,'LZStart'

  LZStart db 'kernel32.LZStart',0    

_________________
Faith is a superposition of knowledge and fallacy
Post 05 Dec 2015, 14:13
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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.