Microsoft KB Archive/155341

{|
 * width="100%"|

New README File for Generic Port I/O Driver

 * }

Q155341

-

The information in this article applies to:


 * Microsoft Win32 Device Driver Kit (DDK) for Windows NT, versions 3.5, 3.51, 4.0

-

SUMMARY
The README file in the Windows NT DDK genport contains insufficient data. This article contains a new README file designed to assist inexperienced NT developers. It can also be a useful reference tool for experienced developers.

Generic Port I/O Driver
Included with this file are:


 * a Windows NT device driver to provide simple access to 8- 16- and 32-bit IO ports.
 * some simple test programs that read from and write to ports.

The following sample is based on an x86 machine. If you use a Power PC, a MIPS, or an Alpha machine, just replace the processor with  or  or .

NOTE: This device driver provides an example of a minimal driver. Neither it nor the sample programs are intended to be used in a production environment. Rather, they are intended as a skeleton driver for those devices that do not use interrupts or DMA.

Building the Driver and its Test Programs
To compile the device driver:


 * 1) Click the "Free Build Environment" or "Checked Build Environment" icon under your "Windows NT DDK" program's group to set basic environment variables needed by NT.
 * 2) Change to the directory containing the device source code, such as cd SRC\GENERAL\PORTIO.
 * 3) Run "BUILD -cef," or use the macro "BLD." This behavior invokes the Microsoft make routines that produce log files called BUILD.LOG, BUILD.WRN, and BUILD.ERR. The WRN file will contain warnings. If the build succeeds, the driver will be named "genport.sys," and it can be found in the I386 subdirectory of your DDK directory. The gpdRead.exe and gpdWrite.exe will be built and placed in the same output directory.

Driver Installation Examples
 Copy the genport.sys file from the \Lib\I386\ subdirectory created by BUILD to the  \SYSTEM32\DRIVERS directory where all the NT device drivers are stored. If the system responds "ACCESS DENIED," a previous version of the file is currently in use and NT will not let you replace it. You can unload it by typing "net stop genport." Copy gpdREAD.exe and gpdWRITE.exe from the \Lib\I386\ subdirectory created by BUILD to your target \ where you will exercise the read and write test. To install the Generic Port I/O driver (GENPORT):

 Copy \src\general\portio\sys\genport.ini to anywhere in your target machine so you can initialize the registry for this genport driver.</li> Use the REGINI utility to create the entries listed in the genport.ini file. For example:

Regini genport.ini

(You must do this with "Administrator" privilege)

NOTE: This adds a GENPORT driver key to the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\GenPort's tree in the registry. You can verify this by running REGEDT32.EXE and looking in this mentioned location.</li> Reboot a machine under test.

When testing the gpdRead.exe or gpdWrite.exe, note that your driver is not loaded if an the error "Can't read from a device" appears on your screen. gpdRead and gpdWrite are defaulted to port address 300h.

If this port has been claimed by another device, then the driver "genport.sys" won't be loaded and gpdRead and pgdWrite will not function. You can run "winmsd" to see if port address 300h is being used. If it is, go into the "genport" register entry to modify its port address to an unused address, and then reboot your machine. There should also be a message in the event log indicating that the driver didn't load if the conflict did occur.</li>  To test your genport driver, do the following:

<pre class="FIXEDTEXT">      gpdRead  -b 1   {This reads a byte from port 0301H } gpdWrite -b 1  {This writes a byte to port 0301H } </li></ol> </li></ol>

Additional query words: 3.51 4.00 kbdsh Genport

Keywords :

Issue type :

Technology : kbAudDeveloper kbWinDDKSearch kbWin32sSearch kbWin32DDKSearch kbWin32DDKNT350 kbWin32DDKNT351 kbWin32DDKNT400 kbWin32DDKNTSearch