i saw long time ago someone posts a code (its was FASM i think) and he imported "rand" function from crtdll.dll he didnt even had .lib file just the dll, i was wondering how can i do this in MASM i think his code went something like:

library kernel,'KERNEL32.DLL',\

import rand,'rand'

Thank in advacned,

Posted on 2003-07-27 01:22:56 by Jond
Posted on 2003-07-27 03:39:42 by Vortex
cool thanks :) , maybe you can also tell me if i can import a function from a DLL without having the .lib file (in MASM not FASM)
Posted on 2003-07-27 03:56:51 by Jond
The alternative method is to use LoadLibrary&GetProcAddress;but the best is to use
import libraries.

.model flat, stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib

caption db 'Hello!',0
message db 'LoadLibrary example',0
user32 db 'user32.dll',0
msgbox db 'MessageBoxA',0
hModule dd ?
invoke LoadLibrary,ADDR user32
mov hModule,eax
invoke GetProcAddress,eax,ADDR msgbox
push MB_OK
push OFFSET caption
push OFFSET message
push 0
call eax
invoke FreeLibrary,hModule
invoke ExitProcess,0
end start
Posted on 2003-07-27 05:35:00 by Vortex
Thank alot Vortex i appreciate your help :)
Posted on 2003-07-27 11:09:12 by Jond