PortRange - Ports or Range of Ports deliminated by comma or dash
0 - SUCCESS
1 - Syntax or Port > 64k (0xFFF7) Error
207 - Port-Range Error (by Port1-Port2 Port1 > Port2)
255 - Arg Overflow
other than that _GetLastError()
'PortRange' will be transformed to a sequence of data like 'WORD,WORD,WORD-WORD,WORD' if this goes over 254 you get 'Arg Overflow'
ccAllowIO("0x70,0x71,0x73-0x75,100-105")
See
ccAllowIO_Demo.eba
ccSetIOPLto3()
ccIN()
ccOUT()
ccINS()
ccOUTS()
"EB_IO_Driver.dat" is the "EB_IO_Driver.sys" without any compression or simile.
The driver conforms to the absolute minimum requirements a driver has to.
No IOCTL nothing.
Load the driver as "SERVICE_KERNEL_DRIVER" trough the service manager.
The SM creates a registry entry for the service "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\EB_IO_Driver"
You have to create a value "ProcessId" type"REG_DWORD" into this key with _RegSetValueEx() und put _GetCurrentProcessId() in it.
-This how the driver will know, which is the calling process.-
Create another value "PortRange" type "REG_BINARY" and put your port(s) or/and rang(es) in it.
Max length =254
The syntax of the data stream is:
Port01 as WORD,Port02 as WORD,Port03 as WORD…… or
Port01 as WORD-Port02 as WORD……….. or a mixture of the 2
Example:
41002C42002C4300 for Port 0x41,0x42,0x43
41002D5000 for Port 0x41 to 0x50
There are NO syntax NOR boundary checks whatsoever in the driver itself!
The driver takes the first WORD value assumes it is a port takes the next BYTE and continuous the decoding depends on this BYTE is a coma "," or a dash "-".
There are 255 bytes reserved on the stuck for this data stream.
The TSS limit is by 0xFFF7!
Sending greater port # than that to the driver causing a page fault!!!
So you have to take care of the correct parsing.
After filling up this 2 reg value just the driver need to be started.
It will do the rest modifying the I/O Permission Bit Map and exiting with 'STATUS_DEVICE_CONFIGURATION_ERROR', which translates to 'ERROR_INVALID_PARAMETER' at API level.
Because of the error the OP system will unload the driver and delete the reg keys.
However to make sure this really take place '_DeleteService()' should be called.