Solved

How map IO Adress into Userspace in a NT driver

Posted on 1998-09-22
5
448 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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Picking random number 8 175
Describe order of operation while copying text 11 114
Detect CR LF to each line 12 152
How to access ANSI/IEEE Std 754 or equivalent information ? 3 43
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…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

948 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

22 Experts available now in Live!

Get 1:1 Help Now