Crossposting: Who is LPT1?

Posted on 2005-05-11
Last Modified: 2008-03-06
This is a crossposting from this 400-Points question in Hardware, because it's not only HW-related:

The question:
By default LPT1 seems to be mapped to port 0x378. But the user can change this. How do you programmatically detect which port is behind LPT1? (LPT2/LPT3?)

Under DOS it seems you can get a list from memory location 0x40..0x4F. But I didn't find a way to do this programmatically under Windows (NT/2K/XP, if possible also 98/ME) and the values in memory don't seem to be correct on my PC if I do it manually.

Does anybody know how to detect this? (For details see the link.)

Question by:ThomasHolz
    LVL 4

    Expert Comment


    you may find a program user port useful

    for complete info click on th elink below

    LVL 4

    Expert Comment


    see u cannot access LPT1 port dirctly in windwos

    u shd use createfile( LPT1 ...)
    every port can be accessed by file in windows.

    Under DOS u can use bios calls using interrupt u can access it if ur using turboc

    int86(0x13 , ,,...) access serial and parallel port


    Author Comment

    Actually I don't need to access the port. That is already done and solved. (Ironic, isn't it?) I just want to make a configuration dialog a bit better documented. But that seems to be difficult, as we're not talking about DOS here...

    Accepted Solution

    Under Windows, the following will place the address of LPT1 in the 'address' variable.

         DWORD address;
         GetPhysLong((PBYTE)0x408, &address);

    You may, however, run into problems when using it under Windows XP.  Since Windows XP abstracts away a lot of the low-level hardware details, the address returned may part of Windows XP's DOS emulator (kind of a virtual machine), which may or may not correspond to the actual physical address.

    Author Comment

    Not what I dreamt of (since it requires an extra driver and yields wrong results at least on my strange PC) but it's as close as I can get, it seems.

    If you post a comment on that page, I'll accept it as answer to the main question:

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
    Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
    The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
    The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

    745 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

    16 Experts available now in Live!

    Get 1:1 Help Now