Microsoft KB Archive/138432

{|
 * width="100%"|

How to Set the ECP Mode Addressing on LPT Ports

 * }

Q138432

-

The information in this article applies to:


 * Microsoft Win32 Device Driver Kit (DDK) for Windows NT, version 4.0

-

SUMMARY
The built-in Lpt.vxd port provider in Windows 95 implements the IEEE Parallel interface P1284. One of the interesting features of the ECP mode is the ability to address up to 128 separate I/O devices. This can be accomplished at the application level with the DeviceIoControl function or from a VxD with _VCOMM_EscapeCommFunction.

How to Address Up to 128 Separate I/O Devices from a VxD
The standard call for EscapeCommFunction is given as:

include vcomm.inc

VxDcall _VCOMM_EscapeCommFunction, > or     eax, eax jz     error_handler

Set hPort to the handle passed back from OpenComm, set lfunc to SETECPADDRESS, and set InData to a pointer to a buffer the first byte of which is the address to be set 0x00..0x7F.

How to Address Up to 128 Separate I/O Devices from a 32-bit Application
Please refer to the MSDN Library compact disc for the standard DeviceIoContol function. Set hDevice to the device handle, set dwIoControlCode to SETECPADDRESS, and set lpInBuffer to a pointer to a buffer the first byte of which is the address 0x00..0x7F. Use GetLastError to retrieve the error code if the function returns false.