flat assembler
Message board for the users of flat assembler.

Index > Windows > Can't get a simple dll to assemble

Author
Thread Post new topic Reply to topic
cdgoldin



Joined: 04 Sep 2019
Posts: 2
cdgoldin 04 Sep 2019, 00:15
I need a dll to "beep" on various error conditions. I wrote a simple assembler language program to do this, and it worked --- as an .exe program. I can't get it to work as a dll. FASM is now complaining that MessageBeep is undefined! Here is my code:

; ringbell.asm DLL

format PE GUI 4.0 DLL
entry DllEntryPoint

include 'win32w.inc'

section '.code' code readable executable

proc DllEntryPoint hinstDLL,fdwReason,lpReserved

invoke MessageBeep,0xffffffff

ret ; Return to caller

endp

I tried including win32a, win32ax and win32w --- all with the same error.
Post 04 Sep 2019, 00:15
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20451
Location: In your JS exploiting you and your system
revolution 04 Sep 2019, 00:19
You appear to be missing the .end.
Code:
format ...

;...

.end    
.end will construct the import section.

But for a DLL to load you will need an export section also. See the example DLL in the fasm download.
Post 04 Sep 2019, 00:19
View user's profile Send private message Visit poster's website Reply with quote
cdgoldin



Joined: 04 Sep 2019
Posts: 2
cdgoldin 04 Sep 2019, 00:45
I looked at the example, but I didn't understand it. Sad
Besides, how would a missing .end statement cause fasmw to complain about an undefined MessageBeep?
Post 04 Sep 2019, 00:45
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20451
Location: In your JS exploiting you and your system
revolution 04 Sep 2019, 02:16
.end is a macro defined by win32a?.inc. It will define all the import labels, which includes MessageBeep, for the import section.
Post 04 Sep 2019, 02:16
View user's profile Send private message Visit poster's website Reply with quote
guignol



Joined: 06 Dec 2008
Posts: 763
guignol 04 Sep 2019, 07:54
Mjolnir needs no imports.
Post 04 Sep 2019, 07:54
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.