Creating a virtual parallel for Windows 7 using C++

4.3k views Asked by At

I am developing an application which would redirect i/o from parallel port of, say, device A to the parallel port of device B. The two devices are connected on ethernet (LAN, WAN, internet, etc.).

Device A has a physical parallel port attached to it but device B is a machine with no parallel port on it. This is what makes me emulate a parallel port on device B such that windows thinks that it has a parallel port and works in the very manner with it as it works with parallel ports on hardware e.g. it auto detects when a device gets attached to the parallel port so that a driver for that device can be installed.

If any piece of hardware gets attached to the parallel port on device A the i/o is redirected to the parallel port on device B and the Windows on device B thinks that some hardware got attached to device B's own parallel port i.e. Windows doesn't know where in the world the hardware actually got attached; Windows just got fooled into thinking that the hardware is attached directly to device B.

My question is about the emulation part. How do I write a parallel port emulator in C++ for Windows 7 such that I fool Windows into thinking that it has a real/hardware parallel port?

A related question can be how does windows detect the hardware and on going changes in it e.g. when some hardware gets connected to the parallel port of a computer.

The program flow would be as follows.

  1. Read data from device A's parallel port.
  2. Write that data to device A's socket which sends it over to device B's socket.
  3. Read data from device B's socket.
  4. Write that data to device B's parallel port which makes windows think that some hardware got connected to it.

NB: I am to emulate a parallel port only i.e. parallel to parallel redirection only. No use of other ports on device B is allowed. That is a requirement for this application.

The part I've done so far is that I have written a program in C++ which reads and writes data from and to the parallel port respectively.

Please also let me know if you know of a better approach of parallel port to parallel port redirection over ethernet (LAN, WAN, internet, etc.).

1

There are 1 answers

1
Anttu On

Stumbled upon this question in my own search for LPT virtualization on windows. I know this one is old and unfortunately I don't have an direct answer to the it either, but I thought I'll share what I've found so far that could help you getting started: