Log in

View Full Version : DLL in NASM


AmAdEuS
June 3rd, 2004, 11:01
sup dudes... I'm stuck @ the end of this little job:
http://home.arcor.de/dj_amadeus/natdll.asm

the source is compile and linked fine without any warnings...
it's a translation from the output of vs.net's C-compiler

the orig DLL compiled by vs.net was injected by my loader just fine.. but the NASM-one somehow can't laoded into the process.... maybe i missed some declaration needed to make it an valid win32-dll or something?
i built it using the following settings:

nasmw -O 42 -f obj natdll.asm
alink -oPE -dll natdll win32.lib

hope anyone can help me...
amadeus

AmAdEuS
June 3rd, 2004, 18:20
ok i found out, that i'm missing the DllMain entry point..
i foudn this info on a dll-skelett on sourforge:
%include "\lab\vasm\inc\nagoa.inc"

global DllMain
global MsgBox
export MsgBox

[segment .code USE32]

proc DllMain,hInstDLL,fdwReason,lpvReserved
mov eax,TRUE
endproc

proc MsgBox,param1,param2
call MessageBoxA,0,[param1],[param2],MB_OK
call ExitProcess,0
endproc

but the thing is that nasmw doesn't accept proc as an valid instruction...
so anyone knows anything about it? finding infos on a win32-related issue for a asm-dialect that is used mainly on *NIX is pretty hard...

djnz
June 4th, 2004, 09:28
Hi,

proc isn't a keyword that's natively supported by nasm,
it's provided as a a macro which is declared in the file c32.mac in the misc directory.
You might want to checkout win32nasm (ftp://ftp.szif.hu/pub/demos/tool/win32nasmbase.zip),
which amongst other things includes an example of a dll.

AmAdEuS
June 4th, 2004, 13:23
thx alot

dELTA
June 5th, 2004, 14:58
AmAdEuS, you are welcome to ask this type of questions here too, but the following forum would probably be much more suitable and likely to give you good and quick answers in the area of pure assembler programming:

http://board.win32asmcommunity.net/

AmAdEuS
June 7th, 2004, 10:40
i know this board... got the things fixed btw, ported everything to masm and have a nice adaptive nocd-laoder for scand bw in all their future versions...