Sobre INPOU32.DLL for Windows 98/2000/NT/XP

Fonte: http://www.lvr.com/, Logix4u

The Problem

Writing programs to talk with parallel port was pretty easy in old DOS days and in Win95/98 too. We could use Inporb and outportb or _inp() or _Outp functions in our program without any problem if we are running the program on DOS or WIN95/98. But entering to the new era of NT clone operating systems like WIN NT4, WIN2000, WINXP, all this simplicity goes away. Being interested in Parallel port interfacing and programming you might have experienced the problems in writing a program that can talk to parallel port successfully in NT based operating systems. When we are trying to run a program which is written using the conventional software functions like Inporb, outportb, _inp() or _Outp on a WINNT or WIN2000 system, it will show an error message that "The exception privileged instruction occurred in the application at location ....". The picture of such a messagebox is given at Logix4u.

Staring to this messagebox, you might have been thinking.... "did i make a mistake in my program ?" it is working fine on WIN98 ... Who is guilty here. 'Nobody' that is the answer. Then why it is happening like this ..? The answer is in the next paragraph

Being a very secure operating system, Windows NT assigns some privileges and restrictions to different types of programs running on it.It classifies all the programs in to two categories , User mode and Kernel mode ie; running in ring3 and ring0 modes. user mode programs are running in ring3 mode and Kernel mode programs are running in ring0 mode. The programs you generally write falls in the user mode category. The user mode programs are restricted to use certain instructions like IN, OUT etc.. Whenever the operating system find that a user mode program is trying to execute such instructions , the operating system stops execution of those programs and will display an error message. Eventually our interfacing programs stops where they are executing IN or OUT instructions to read or write data to parallel port. But in the same time Kernel mode programs are in no way restricted in executing such instructions. Device drivers are capable of running in kernel mode. So the work around for the above stated problem is to write a kernel mode driver capable of reading and writing data to parallel port and let the user mode program to communicate with it. Writing a driver is not an easy job for even experienced programmers. But writing a simple driver for communicating with parallel port is a simple task when drivers like USB, sound card etc.. are concerned. Even though you get a working driver from somewhere else, installing and configuring it can be very cumbersome task.

The Solution

Introducing Inpout32.dll for WIN 98/NT/2000/XP. This dll have the following features

  1. Works seam less with all versions of windows (WIN 98, NT, 200 and XP)
  2. Using a kernel mode driver embedded in the dll
  3. No special software or driver installation required
  4. Driver will be automatically installed and configured automatically when the dll is loaded
  5. No special APIs required only two functions Inp32 and Out32
  6. Can be easily used with VC++ and VB
  7. Functions are compatible with Jan Axelsons Inpout32.dll (available at http://www.lvr.com/parport.htm). So this dll can be used with the sample programs available with the book Parallel Port Complete, without any modification.

Click here for a sample program written for Borland C++ command line compiler, by Douglas Beattie Jr.

Click here for a sample program written for Real Basic, by Aaron Ballman.

Click here for 64 bit version of inpout which can be used with 64 bit windows, by Phil.