Source file: /~heha/hsn/maus32.zip/llib/llib.asm

	ideal
	P386
	model	flat
	includelib	"import32"

CHAR		equ	BYTE
HANDLE		equ	DWORD
DELIM_CmdLine	equ	('"' shl 16) or 0800h

DATASEG
msg	db	'Give it at least one DLL filename!',0
txt	db	'LoadLibrary("%s") failed, code=%d',0

UDATASEG
buf	db	300 dup (?)
amsg	dd	6 dup (?)

CODESEG
procdesc GetCommandLineA stdcall
procdesc LoadLibraryA stdcall n:PTR CHAR
procdesc _wsprintfA stdcall
procdesc MessageBoxA stdcall WndParent:HANDLE,Txt:PTR CHAR,Caption:PTR CHAR,TextType:DWORD
;procdesc LoadCursorA stdcall hinst:DWORD,n:PTR CHAR
;procdesc SetCursor stdcall h:DWORD
;procdesc Sleep stdcall t:DWORD
procdesc GetMessageA stdcall m:PTR DWORD,w:DWORD,f1:DWORD,f2:DWORD
procdesc OneItem stdcall s:PTR CHAR,x:DWORD

proc start stdcall
	call	GetCommandLineA
	call	OneItem,eax,DELIM_CmdLine	;Programm-Name übergehen
	cmp	[CHAR eax],0
	jz	@@aua
	mov	bl,0				;Merker für geladene DLLs
@@l:
	mov	esi,eax				;Anfang aufheben
	call	OneItem,eax,DELIM_CmdLine
	push	eax
	 inc	bl
	 call	LoadLibraryA,esi
	 cmp	eax,32
	 ja	@@ok
	 dec	bl
	 lea	edi,[buf]
	 push	eax
	 push	esi
	 push	offset txt
	 push	edi
	 call	_wsprintfA
	 add	esp,4*4
	 call	MessageBoxA,0,edi,0,0
@@ok:	pop	eax
	cmp	[CHAR eax],0
	jnz	@@l
	or	bl,bl
	jz	@@e
@@l2:	xor	eax,eax
	call	GetMessageA,offset msg,eax,eax,eax
	jmp	@@l2
@@aua:
	call	MessageBoxA,0,offset msg,0,0
@@e:
	ret
endp

end	start

program llib32;
uses Windows,parser32;
{$apptype console}
const
 DELIM_CmdLine=ESCAP_DblQuote or DELIM_WhiteSpace;
var
 p1: PChar;
begin
 p1:=OneItem(CmdLine,DELIM_CmdLine);
 OneItem(p1,DELIM_CmdLine);
 write(p1,'=',LoadLibrary(p1));
 readln;
end.
Detected encoding: OEM (CP437)1
Wrong umlauts? - Assume file is ANSI (CP1252) encoded