Source file: /~heha/secret/dknack.zip/SRC/VDONGLE.PAS

unit VDongle;
{Interface-Unit zum Ansprechen von VDONGLE.386. Unter Windows95 wird
 das VxD ggf. dynamisch ge- und entladen, ohne Zutun im Hauptprogramm}
interface
const
 VDongle_Device_ID=$3B48;
{You have been assigned a device ID of 3B48h for your VELGNOD.386 virtual
 device.  This number is uniquely assigned to this device.}
var
 VDongleEntry: Pointer;
const
 VxDName:array[0..11]of Char='VDONGLE.386'#0;
implementation

var
 VXDLDR_Entry:Pointer;
 OldExit:Pointer;
procedure NewExit; far; assembler;
 asm
	db	$66
	mov	ax,word ptr [OldExit]
	db	$66
	mov	word ptr [ExitProc],ax
	mov	ax,$0002	{Unload_VxD}
	mov	bx,VDongle_Device_ID
	call	[VXDLDR_Entry]
 end;

procedure GetVDongleEntry; assembler;
 asm	xor	di,di
	mov	es,di
	mov	bx,VDongle_Device_ID
	mov	ax,$1684	{Get Device API Entry Point}
	int	$2F
	mov	ax,es
	mov	word ptr [VDongleEntry],di
	mov	word ptr [VDongleEntry+2],ax
 end;

begin
 asm	call	GetVDongleEntry
	or	ax,ax		{<>0?}
	jnz	@@e		{ja, statisch geladen!}
	mov	bx,$0027	{VXDLDR-Device-ID}
	mov	ax,$1684
	int	$2F
	mov	ax,es
	or	ax,ax		{<>0?}
	jz	@@e		{nein, wohl kein Windows95?}
	mov	word ptr [VXDLDR_Entry],di
	mov	word ptr [VXDLDR_Entry+2],ax
	mov	dx,offset VxDName
	mov	ax,$0001	{Load_VxD}
	call	[VXDLDR_Entry]
	jc	@@e		{Fehler!}
	push	cs
	push	offset NewExit
	db	$66
	pop	ax
	db	$66
	xchg	word ptr [ExitProc],ax
	db	$66
	mov	word ptr [OldExit],ax
	call	GetVDongleEntry	{Zweiter Versuch}
@@e: end;
end.
Detected encoding: ASCII (7 bit)2