Using LPT port without kernel-mode driver

Applications running under Windows 2000 or XP could not access system hardware directly. This is quite reasonable - see Dr Dobbs, Direct Port I/O and Windows NT article.

Using _inp() or _outp() function will result in "Privileged Instruction" exception. There are few libraries that allows direct access to hardware registers like:

For simple purposes such as driving few relays or LEDs using custom library may be not needed. By tying few handshake port lines to the ground we can trick operating system and toggle data lines using standard CreateFile/WriteFile API.
lpt windows xp test

Simple program to set/clear data lines (with source code, Turbo C++ 2006 aka C++ Builder): LPT_test.7z.
lpt windows xp test program
When running this program without hardware connected write operation will result in timeout with "No device connected" message. Application is setting total write timeout to 6 s, default value would block if for quite a long time (Accessing the parallel port via Win API):

    The parallelTimeouts.WriteTotalTimeoutConstant variable
    has a minimum value of 2000 (2 seconds) on WinXP.
    Default value is set to 300000 (5 mins).    
    

Another interesting article - How To Connect a USB TO IEEE 1284 Parallel Printer Cable To Visual Studio shows how to write data directly to USB generic printer adapter. This may be very cheap (I've seen those LPT-USB adapters under $2) solution to add few generic TTL output lines to PC.

WSED.zip: another application, intended to control 4-motor electric model using keyboard/mouse and LPT port.
Application to control electric car model using LPT

LPT_pattern.7z: yet another application that generates signal patterns with LPT port.
Application generating signal patterns with LPT port