1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3 ;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
4 ;; Distributed under terms of the GNU General Public License ;;
6 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
10 format PE DLL native
0.05
15 API_VERSION
equ 0 ;debug
17 STRIDE
equ 4 ;size of row in devices table
21 section '.flat' code readable writable executable
25 include 'peimport.inc'
27 proc START c
, state:dword, cmdline:dword
43 invoke RegService
, my_service
, service_proc
51 proc service_proc stdcall
, ioctl:dword
54 mov eax, [ebx+IOCTL.io_code
]
55 cmp eax, SRV_GETVERSION
58 mov eax, [ebx+IOCTL.output
]
59 cmp [ebx+IOCTL.out_size
], 4
61 mov dword [eax], API_VERSION
75 mov eax, [eax+PCIDEV.fd
]
78 mov edx, [eax+PCIDEV.vendor_device_id
]
103 DEVICE_ID
equ 1234; pci device id
104 VENDOR_ID
equ 5678; device vendor id
107 ;all initialized data place here
110 devices
dd (DEVICE_ID
shl 16)+VENDOR_ID
113 my_service
db 'MY_SERVICE',0 ;max 16 chars include zero
115 msgInit
db 'detect hardware...',13,10,0
116 msgFail
db 'device not found',13,10,0