#include "vcall0.h"
void far *VCall0_Entry;
/* Routine im Kernel-Mode rufen, sofern VCALL0.386 geladen, sonst direkt */
unsigned Call0(unsigned far (*routine)(void)){
asm{ mov ax,word ptr VCall0_Entry[0]
or ax,word ptr VCall0_Entry[2]
jz lbl1 /* NULL? */
les bx,[routine]
mov ah,1 /* Funktionsnummer */
call [VCall0_Entry]
jmp lbl2
}lbl1: asm{
call [routine]
}
lbl2:
return _AX;
}
unsigned GetVCall0Ver(void){
asm{ mov ax,word ptr VCall0_Entry[0]
or ax,word ptr VCall0_Entry[2]
jz lbl1 /* NULL? */
xor ah,ah
call [VCall0_Entry]
}
lbl1:
return _AX;
}
char high_freq(long hz, void far (*routine)(void)) {
// liefert TRUE oder FALSE
asm{ mov cx,word ptr VCall0_Entry[2]
stc
jcxz hf1 // NIL?
db 0x66; mov dx,word ptr [hz]
les bx,[routine]
mov ah,2 // Funktionsnummer
call [VCall0_Entry]
}hf1: asm{
mov al,0
jc hf2
inc al
}hf2: return _AL;
}
void far *VXDLDR_Entry;
char VxDName[]="VCALL0.386";
/* Initialisierung: Pointer ermitteln und setzen */
unsigned Get_VCall0_Entry(void){
asm{ mov bx,VCall0_Device_ID
xor di,di
mov es,di /* also mit Null laden */
mov ax,0x1684
int 0x2f
mov ax,es
mov word ptr [VCall0_Entry],di
mov word ptr [VCall0_Entry+2],ax /* Einsprungadresse zum VxD */
}
return _AX;
}
void VCall0_Init(void){
if (!Get_VCall0_Entry()) {
asm{ mov bx,0x0027 // VXDLDR-Device-ID
mov ax,0x1684
int 0x2F
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,0x0001 // Load_VxD
call [VXDLDR_Entry]
jc e // Fehler!
}
}
Get_VCall0_Entry(); // Zweiter Versuch
e:
}
void VCall0_Exit(void) {
asm{ mov ax,0x0002 // Unload_VxD
mov bx,VCall0_Device_ID
call [VXDLDR_Entry]
}
}
Vorgefundene Kodierung: UTF-8 | 0
|