• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 329
  • Last Modified:

Crossposting: Who is LPT1?

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.)

1 Solution

you may find a program user port useful

for complete info click on th elink below



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

ThomasHolzAuthor Commented:
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...
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.
ThomasHolzAuthor Commented:
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now