c++parallel-port

where is hwinterface.sys for controling LPT?


I try to set parallel port in my win32 application. i use inpout32.dll in my program. it works in windows XP but doesn't work in windows 7.

this occurred because i have hwinterface.sys in windows XP but i don't have this file in windows 7.

my question is : where is hwinterface.sys? and how can i find it? or how can i work with LPT without using inpout32.dll.

these functions are in inpout32.dll:

hComm01 = CreateFile("\\\\.\\hwinterface", 
                             GENERIC_READ | GENERIC_WRITE, 
                             0, 
                             NULL,
                             OPEN_EXISTING, 
                             FILE_ATTRIBUTE_NORMAL, 
                             NULL);
DeviceIoControl(hComm01,
               IOCTL_WRITE_PORT_UCHAR,
               &Buffer,
               3,
               NULL,
               0,
               &BytesReturned,
               NULL);

Solution

  • In first time I should run as Administrator.

    refrence: the first time it is run, it must be elevated on Vista and later (run as Administrator).

    http://www.highrez.co.uk/downloads/inpout32/