Help to invoke request to parallel port (IOCTL_PAR_QUERY_DEVICE_ID)

Posted on 2005-04-21
Last Modified: 2012-06-21
Hello everybody,

I have a problem making an I/O request to the parallel port (LPT1).

I write a small tool, where I want to get information about device connected to the parallel port (model name).
Currently I open the device using
and pass obtained handle to the DeviceIoControl()


This call fails with "Incorrect function" error.
I have tried to make first IOCTL_PAR_QUERY_DEVIEC_ID_SIZE request, but the result is the same :((((

Did anybody do such thing with parallel port?

Your help is greatly apreciated!

Thank you.
Question by:Rothmans
    LVL 86

    Expert Comment

    You can only use that very IOCTL in a device driver, not a user mode program.

    Author Comment

    Do you mean, that this only particular IOCTL (namely IOCTL_PAR_QUERY_DEVICE_ID) is allowed to use only from kernel mode?
    I saw some samples in internet, where this exactly request was made from user mode (normal application) along with other IOCTL requests.
    Could you be wrong?
    LVL 86

    Expert Comment

    I could be wrong, but then, why would MS put the declaration only in ntddpar.h (which is part of the DDK, and not the PSDK)?

    Author Comment

    I actually suspect right now, that I am using incorrect device name in the CreateFile. "LPT1" could probably mean the port itself, although the call to CreateFile with "LPT1.4" as device name returns the same handle (numerical value).

    Author Comment

    The device is actually a laser printer.

    Author Comment

    Yes, jkr,
    you are definetly wrong.
    Now it works, thank's God.
    The problem was in the device name.
    Instead of "LPT1" I must use "\\.\LPT1.4".
    My tool still works in common user mode.
    LVL 30

    Expert Comment

    by:Wayne Barron
    No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
    I will leave the following recommendation for this question in the Cleanup topic area:
    [PAQ - Refund]

    Any objections should be posted here in the next 4 days. After that time, the question will be closed.

    EE Cleanup Volunteer
    LVL 1

    Accepted Solution

    PAQed with points refunded (250)

    EE Admin

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
    I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now