Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How map IO Adress into Userspace in a NT driver

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
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 switch statements in the C programming language.

861 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