.386p
.XLIST
include tvmm.inc
include debug.inc
.LIST
locals
IO32_Major_Ver equ 1
IO32_Minor_Ver equ 3
IO32_Ver equ IO32_Major_Ver*256+IO32_Minor_Ver
IO32_Device_ID equ Undefined_Device_ID
Declare_Virtual_Device IO32, IO32_Major_Ver, IO32_Minor_Ver,\
IO32_Control_Proc, IO32_Device_ID,\
Undefined_Init_Order,,
DIOCParams STRUC
Internal1 DD ?
VMHandle DD ?
Internal2 DD ?
dwIoControlCode DD ?
lpvInBuffer DD ?
cbInBuffer DD ?
lpvOutBuffer DD ?
cbOutBuffer DD ?
lpcbBytesReturned DD ?
lpoOverlapped DD ?
hDevice DD ?
tagProcess DD ?
DIOCParams ENDS
;*******************************************
;*** Residente Daten und Code (pageable) ***
;*******************************************
VxD_DATA_SEG
IOCTL_Table dd OFFSET32 Retu ;(-1)
dd OFFSET32 Retu ;(0)
dd OFFSET32 IOCTL_GetVer ;(1)
dd OFFSET32 IOCTL_outb ;(2)
dd OFFSET32 IOCTL_outw ;(3)
dd OFFSET32 IOCTL_inb ;(4)
dd OFFSET32 IOCTL_inw ;(5)
VxD_DATA_ENDS
VxD_CODE_SEG
;VxD-obligatorische Steuer-Prozedur
BeginProc IO32_Control_Proc
int 1 ;Debug...
Control_Dispatch 23h, IO32_IOCTL ;23h=W32_DeviceIOControl
Retu: clc ;Dynamisches Laden ohne Extras!
ret
EndProc IO32_Control_Proc
BeginProc IOCTL_GetVer
cmp [esi.cbInBuffer],2
jc @@e
mov edi,[esi.lpvInBuffer]
mov word ptr [edi],IO32_Ver
xor eax,eax
mov al,2 ;2 Return-Bytes
@@e: ret
EndProc IOCTL_GetVer
BeginProc IOCTL_outb
cmp [esi.cbOutBuffer],3
jc @@e
mov edi,[esi.lpvOutBuffer]
mov dx,[edi]
mov al,[edi+2]
out dx,al
xor eax,eax ;Keine Bytes als Return!
@@e: ret
EndProc IOCTL_outb
BeginProc IOCTL_outw
cmp [esi.cbOutBuffer],4
jc @@e
mov edi,[esi.lpvOutBuffer]
mov dx,[edi]
mov ax,[edi+2]
out dx,ax
xor eax,eax
@@e: ret
EndProc IOCTL_outw
BeginProc IOCTL_inb
cmp [esi.cbOutBuffer],2
jc @@e
cmp [esi.cbInBuffer],1
jc @@e
mov edi,[esi.lpvOutBuffer]
mov dx,[edi]
in al,dx
mov edi,[esi.lpvInBuffer]
mov [edi],al
xor eax,eax
inc eax
@@e: ret
EndProc IOCTL_inb
BeginProc IOCTL_inw
cmp [esi.cbOutBuffer],2
jc @@e
cmp [esi.cbInBuffer],2
jc @@e
mov edi,[esi.lpvOutBuffer]
mov dx,[edi]
in ax,dx
mov edi,[esi.lpvInBuffer]
mov [edi],ax
xor eax,eax
mov al,2
@@e: ret
EndProc IOCTL_inw
BeginProc IO32_IOCTL
inc ecx
cmp ecx,7
jnc @@err
call [IOCTL_Table+ecx*4]
jnc @@ok
@@err: mov eax,32h ;Error_Not_Supported
jmp @@e
@@ok:
mov edi,[esi.lpcbBytesReturned]
or edi,edi
jz @@1
mov [edi],eax
@@1: xor eax,eax ;Null = Fehlercode "OK" (??)
@@e: ret
EndProc IO32_IOCTL
VxD_CODE_ENDS
END
Detected encoding: ASCII (7 bit) | 2
|