News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

List of com & lpt ports

Started by Faktor, September 06, 2006, 09:01:26 AM

Previous topic - Next topic

Faktor

Hi !
Pardon my english.
Im new in MASM an in WIN32 programing ,i have some experience in DOS programing.
MASM RULES!
OK,i understand SOME of the principles of Win programing.
My question is:

How to get a list of all valid com & lpt ports in MASM ,on a specific PC in Win98 enviroment?


I think that ther is a list in Win98 registers under HKEY_LOCAL_MACHINE/Hardware/DeviceMap/SeriallComm..
and somting similar under ME and XP
This is not a physical list, but is identical to the control panel list.
For example, i'm making a program for RS232 com. and IO operations on LPT (under win98),and i dont whant to refer to a port that dosent exist.
I use atleast 2 COM ports and 1 LPT port.(diffrent physical hrdwarwe connections)

Shud i useĀ  GetLastError or some similar mechanisam?



anon

Look up CreateFile. What I did was test for COM1, COM2, etc. in a loop.
If CreateFile returns a valid handle, then that resource is available. You
then do the same thing for LPT1, LPT2, etc.

Faktor