Solved

How map IO Adress into Userspace in a NT driver

Posted on 1998-09-22
5
447 Views
Last Modified: 2012-06-27
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 ?
0
Comment
Question by:um3814
  • 2
  • 2
5 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 1252961
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
 

Author Comment

by:um3814
ID: 1252962
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
 
LVL 86

Expert Comment

by:jkr
ID: 1252963
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
 
LVL 4

Accepted Solution

by:
agreen earned 200 total points
ID: 1252964
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
 

Author Comment

by:um3814
ID: 1252965
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

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now