Visual C++ 7.1Visual Studio .NET 2003Windows 2003Windows 2000Windows XPIntermediateDevVisual StudioWindowsC++
Kport Direct Access I/O Ports Under Win NT/2000/XP






3.47/5 (9 votes)
Two simple functions for accessing I/O ports, skiping H.A.L.
Introduction
I wrote this DLL for implementing direct access I/O ports in Windows NT/2K/XP.
Background
For compiling the project, you need VC7.1-2003. For compiling kioport.sys, you need to install the DDK. Kioport is based on PortTalk.sys from the article: "Beyond Logic Port Talk I/O Port Driver", http://www.beyondlogic.org/, and "A DDK's project wizard for VC2003", http://www.codeproject.com/KB/macros/ddkwizard.aspx.
Using the code
- Copy kioport.sys to \windows\system32\drivers.
- Add kioport.reg to register windows.
- Reboot windows for activate service in the register of windows.
- Add kport.h in your project and kport.lib.
- Put Kport.dll in the same directory as the application.
Using the Kport DLL is so easy. Here is the function definition, and the explanation follows:
// Returns a value from specific ports.
BYTE Inportb(WORD PortNum);
// Write a value to specific ports.
void Outportb(WORD PortNum, BYTE byte);
PortNum
: is the port number; for example: 0x378 (LPT1).BYTE
: data to send for a specificPortNum
inOuportb
, and data received inInportb
.
How to use the sample dialog
- Write a number bellow the text 'Write Value( )', and click in the Write button.
- Click on the Read button.
History
- First version: April 3, 2005.