9,6 → 9,8 |
|
format MS COFF |
|
API_VERSION equ 0 ;debug |
|
include 'proc32.inc' |
include 'imports.inc' |
|
39,6 → 41,8 |
DRV_EXIT equ -1 |
STRIDE equ 4 ;size of row in devices table |
|
SRV_GETVERSION equ 0 |
|
section '.flat' code readable align 16 |
|
proc START stdcall, state:dword |
70,11 → 74,21 |
align 4 |
proc service_proc stdcall, ioctl:dword |
|
; mov edi, [ioctl] |
; mov eax, [edi+io_code] |
mov ebx, [ioctl] |
mov eax, [ebx+io_code] |
cmp eax, SRV_GETVERSION |
jne @F |
|
mov eax, [ebx+output] |
cmp [ebx+out_size], 4 |
jne .fail |
mov [eax], dword API_VERSION |
xor eax, eax |
ret |
@@: |
.fail: |
or eax, -1 |
ret |
endp |
|
restore handle |
116,10 → 130,11 |
|
cmp eax, ebx |
je .found |
|
add edi, STRIDE |
jmp @B |
|
.next: inc [devfn] |
.next: |
inc [devfn] |
cmp [devfn], 256 |
jb .next_dev |
mov eax, [bus] |
138,11 → 153,10 |
ret |
endp |
|
DEVICE_ID equ 1234; pci device id |
VENDOR_ID equ 5678; device vendor id |
|
;DEVICE_ID equ ; pci device id |
;VENDOR_ID equ ; device vendor id |
|
|
;all initialized data place here |
|
align 4 |
149,7 → 163,7 |
devices dd (DEVICE_ID shl 16)+VENDOR_ID |
dd 0 ;terminator |
|
version dd 0x00030003 |
version dd (5 shl 16) or (API_VERSION and 0xFFFF) |
|
my_service db 'MY_SERVICE',0 ;max 16 chars include zero |
|