Home | Products | Prices | Directory | Order | Contact | New | Books | Files | Links | Other
Bottom of Page

 
ZeeCube - UserMode Parallel Port Direct IO Driver for NT 4.0

 

Direct I/O Access from Win32 User Mode Applications to PC Parallel Port(s) under Microsoft Windows NT 4.0

  
Overview The Parallel Port Direct I/O Access package delivers the ability to access PC parallel ports from Win32 applications under Microsoft Windows NT 4.0. Previously, the only way would have been to write an NT device driver to perform the I/O on behalf of the application.

This kernel mode driver and Win32 library combination allow Win32 applications to execute IN and OUT instructions to the parallel port device hardware I/O ports.

Access is coordinated with the standard NT parallel driver to ensure that the parallel port is only 'claimed' if no other process is currently using it. Once the port is 'claimed', other processes are blocked from using the port (assuming they also use the standard parallel port arbitration scheme).

Once the application has finished using the parallel port, it may either exit or call the 'release' API and the parallel port is free for use by any other process again.

*****NEW*****

Do you have a DOS/Windows 16bit or Windows 95/98 32bit application that accesses a Parallel Port that you want to run under NT and you don't have the source?

Then you need this package.

Now, with one simple command, you can grant Parallel Port access to a specific application.

The program RUNAPP.EXE comes with the Direct I/O Access package and can be run to allow another application the Parallel Port.

To run a 32bit app use this command:

RUNAPP <Parallel Port#> <Application>

To run a 16bit app use this command:

RUNAPP <Parallel Port#> command.com /c <Application>

 

How it works Normally, under Windows NT, access is not permitted to the I/O port range of the parallel port (and most others). Executing an IN or OUT instruction causes a privileged instruction exception resulting in termination of the process.

The driver works by changing the I/O permission map (IOPM) for the process that 'claims' the indicated parallel port. Changing the IOPM, allows the process free access to the I/O port range of the parallel port hardware. It also supports additional parallel ports added using expansion cards.

 

The Details The API calls are provided in a Win32 DLL. One call is all that is required to use the direct I/O functionality. The Win32 application is linked with the supplied import library and the kernel driver is demand loaded as necessary. No tampering with the registry or rebooting is needed.

The API calls are documented here:

Include the header file for definitions and function prototypes.

#include "ParllIo.h"

The GetParallelPortCount API returns the number of parallel ports present in the PC.

INT WINAPI GetParallelPortCount(VOID)

Return value:
The number of parallel ports present in the PC or 0 if none are present or an error occurred. For the specific error code, call the standard Win32 function GetLastError().
The GetParallelPortInfo API returns information about the a particular indicated parallel port, such as the physical I/O port address and number of I/O port addresses spanned by the hardware device.

BOOL WINAPI GetParallelPortInfo(
  DWORD        dwPort,
  PPARLLIOINFO pinfo)

Arguments:
dwPort specifies the parallel port for which information should be returned
pinfo specifies the address of a PARLLIOINFO structure defined below. The member dwParllIoInfoSize should be initialized on entry to size(PARLLIOINFO).
Return value:
TRUE if the function returns the port information or FALSE if the port does not exist or an error occurs. For the specific error code, call the standard Win32 function GetLastError().
typedef struct {
  // size of structure
  DWORD dwParllIoInfoSize;
  // address of parallel port
  DWORD dwPortAddress;
  // span of parallel port
  DWORD dwPortSpan;
} PARLLIOINFO, *PPARLLIOINFO;

The ClaimParallelPort API attempts to allocate the specified parallel port from the standard Windows NT parallel driver. A timeout may be specified to wait for the port to become free if already allocated. Additionally, either no wait may be specified or wait indefinitely.

BOOL WINAPI ClaimParallelPort(
  DWORD dwPort,
  DWORD dwTimeout)

Arguments:
dwPort specifies the parallel port to be claimed
dwTimeout specifies in milliseconds how long to wait for the parallel port if already owned by another process or INFINITE to wait indefinitely or 0 not to wait at all.
Return value:
TRUE if the function succeeds in claiming the parallel port specified or FALSE if it is in use or an error occurs. For the specific error code call the standard Win32 function GetLastError().
The ReleaseParallelPort API frees the parallel port for use by another process. Direct I/O should not be performed after this function is called. If this function is not called, the application will own the parallel port until the application exits or is terminated.

BOOL WINAPI ReleaseParallelPort(
  DWORD dwPort)

Arguments:
dwPort specifies the parallel port to release
Return value:
TRUE if the function succeeds in releasing the parallel port specified or FALSE if the function fails or the process doesn't own the parallel port. For the specific error code call the standard Win32 function GetLastError().
For Visual Basic users six functions are provided for input and output as follows:

INT WINAPI OutByte(
  DWORD dwAdrs,
  INT   nByte)

INT WINAPI OutWord(
  DWORD dwAdrs,
  INT   nWord)

INT WINAPI OutDWord(
  DWORD dwAdrs,
  INT   nDWord)

INT WINAPI InByte(
  DWORD dwAdrs)

INT WINAPI InWord(
  DWORD dwAdrs)

INT WINAPI InDWord(
  DWORD dwAdrs)

I/O Timing I/O instructions executing in user mode (ring 3) will take longer than executing in kernel mode (ring 0). It is however, dependant upon the processor, but the number of clocks taken is generally two to three times that of comparable real-mode (i.e. MS-DOS) execution. Having said that, it is significantly quicker than calling down to a kernel mode driver for each IN / OUT instruction as some other NT I/O drivers require.

 

Installation The Direct I/O Access developer package consists of a header file ParllIo.h containing definitions and function prototypes, a Microsoft Visual C++ 5.0 compatible import library ParllIo.lib to be linked with the application and some example test programs. Both C and Visual Basic examples are supplied.

The Direct I/O Access runtime package consists of two files, a kernel mode driver ParllIo.sys and a dynamic link library, ParllIo.dll. These files should be distributed with the application.

The driver may either be loaded on-demand or may be loaded when the system boots. If the driver is loaded on-demand, the user running the application must have NT administrator rights.

If it is envisiged that the user running the program will not have NT administrator rights, the driver can be installed to load at boot. NT administrator rights are still needed during setup, but once completed the driver can be used by non administrative users.

A setup program is provided to create the necessary registry entries to load the driver at boot. It can be run in quiet mode so that it can be called from the application setup program or in interactive mode.

If the driver will be loaded on-demand, the application setup program can copy the files into the application directory.

Running the command setup /h show the setup program options.

setup2.jpg (5363 bytes)

To perform a quiet mode installation from another setup program, run the following command setup c:\winnt /q.This will copy ParllIo.sys to the system32\drivers directory and ParllIo.dll to the system32 directory and make the necessary registry entries to load the driver on boot.

Alternatively, use the setup program in interactive mode as shown below. 

setup1.jpg (11095 bytes) 

 

Windows 95/98 Support Under Microsoft Windows 95/98 direct port I/O is allowed to certain I/O address ranges. The parallel ports are one such range. When running under Windows 95/98, the library ParllIo.dll skips the calls to the kernel driver allowing the same code base and file set to be shipped for both Windows NT and Windows 95/98.

Note: A Windows 95/98 driver allowing coordinated access to parallel ports may be released if there is sufficient demand.

 

Price and Availability  
Development Pack
Includes first License.
$60USD
Runtime licenses
2 - 10 users $20USD each
11 - 50 users $15USD each
51 - 100 users $10USD each
Royality free distribution license is $995USD.
 
License Agreements Click here to read the development license agreement.
Click here to read the run-time license agreement.
 
The Author can be contacted at: peter@zeecube.com
Zeecube Home Page. 
The full Development Pack is available for download at ~$60USD
Order Zeecube Parallel Driver for NT. from our Secure Encrypted Credit card Site.

Product Distribution and Support:
This product is distributed on the Internet using a download invoked by the customer. There isn't a printed manual, and all support is done via the original Author. You will find his E-mail address on this page.

You must send me your E-Mail address with the order, as this is the only method of distribution of this product


User Feedback:
Both the Author and DonTronics are very interested in User feedback on this product, and we seek permission to post your messages on this page.


What's Really HOT at DonTronics????
Don's Download Dungeon.
 
Home | Products | Prices | Directory | Order | Contact | New | Books | Files | Links | Other
Top_of_Page
mailto: don@dontronics.com_ Copyright © 1996-99 DonTronics