Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Help to invoke request to parallel port (IOCTL_PAR_QUERY_DEVICE_ID)

Posted on 2005-04-21
Medium Priority
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

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

Author Comment

ID: 13856631
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

ID: 13860802
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)?
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


Author Comment

ID: 13864578
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

ID: 13864613
The device is actually a laser printer.

Author Comment

ID: 13865447
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 31

Expert Comment

by:Wayne Barron
ID: 15717156
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

Accepted Solution

Computer101 earned 0 total points
ID: 15759184
PAQed with points refunded (250)

EE Admin

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Machine Learning is one of the profound applications of AI and therefore, just like AI, it is surrounded by myths and fears. Check out these facts about ML that demystify the related myths.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
Suggested Courses

578 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