How map IO Adress into Userspace in a NT driver

For faster access of an IO address ( parallel port in my case) i need to map the address into the user address space,
thus avoiding NT-Security checks.
How can I do this in a NT4.0 driver, using the MS DDK ?
um3814Asked:
Who is Participating?
 
agreenConnect With a Mentor Commented:
As jkr said you CAN'T map the I/O space into user mode address space. But you can disable the I/O trapping for your user mode application. Just use the GIVEIO.SYS driver by Dale Roberts (http://www.ddj.com/ftp/1996/1996.05/directio.zip) or use the NTIOSUPP.DLL by Andy Green that allows you to load and start the GIVEIO.SYS driver by one simple function call. (http://www.warmcat.com/ntiosupp.zip)
0
 
jkrCommented:
Simple answer: You _cannot_ map an IO address into user space (even kernel mode drivers access IO ports trough HAL).
The only acceptable way would be to pass a user mode buffer to the driver in the MdlAddress of an DeviceIoControl IRP (similar to using an METHOD_OUT_DIRECT Device Object)
and using 'MmGetSystemAddressForMdl()' to access it directly when your driver handles the communication ... and don't forget to synchronize using a shared event ...
0
 
um3814Author Commented:
in the moment i use DeviceIoControl in order to send the data to the driver, then i use WRITE_PORT_UCHAR without any HAL . The DeviceIoControl call slows down the transfer rate 60 times.
I know, that memory addresses can be mapped into user address space. I think, its possible for a port adress too.

0
 
jkrCommented:
Have fun carrying on ! I assure you can't map a port address into user space (would be against the design principles of NT).
0
 
um3814Author Commented:
Thanks a lot !  The directio  driver showed me the solution of my problem. But i wonder why there were 2 different methods used
in the Sources in the zip file : one with MS-Function calls, and one with assembler near c-code. Which is better ?
0
All Courses

From novice to tech pro — start learning today.