Link to home
Start Free TrialLog in
Avatar of Doldrums
Doldrums

asked on

Need to find all modem's com ports...

I need to be able to find the com port of the modems installed in Win95 & NT.  I have no problem finding the general information for the modems in both operating systems' registries.  What I can't figure out is the key that is the comport.  I have tried "AttatchedTo"... but this key doesn't exists for PCMCIA modems.
Avatar of faster
faster

I think instead of checking the registry, you can do a search on all the com ports, for example send any at commands and see whether "OK" is returned.
Why not use the CreateFile function and check the error code on each?  If it's an error, it will tell you what kind of error.  For instance, and DEVICE_BUSY error would tell you that it is in use, and any other error would at least tell you if it exists.

In the registry, try:

hkLM/hardware/devicemap/serialcomm

It's not as reliable, though.
Avatar of Doldrums

ASKER

The [HKEY_LOCAL_MACHINE\hardware\devicemap\serialcomm] doesn't really help...

The idea about the CreateFile has me a bit lost...  am I to create a file to the comport???  I have a modem's name... I need to find the comport the modem is on.
You can use the CreateFile() API to access any handle in Win95/NT.  File handles, StdHandles, Communication handles.

The usage goes something like this:

CreateFile("\\COMM1".....);
Alright... so let's say I CreateFile for all the com ports.  This still doesn't give me anyway to find out what modem is on what port.

What I want to do is make a function that takes a modem's name and returns its comport.  Nothing more...
You have 50% of the information you need.  Basically IF
you can identify that a modem exists on a comport (And
it does sound like the above suggestions will do this),
unless you use the registry to tell you the modem name
(which as we also see is not reliable), THEN >YOU<
must use 'detection techniques' to determine modem type.
So.. AT I6, etc.. you'll need the AT Commands for
Rockwell and USR chipsets (the big boys), as well as
AT&T, etc... Most smaller players buy their chipsets from
the big-boys.. But thats the ONLY way to get a modem 'name'...
  Sorry for the crappy news, but unless you can have windows
identify the name, you have to know the protocol to do it
youself.. Fortionately, the AT commands are pretty standard..
  -- Aaron

I found the answer to my question elsewhere.
Thanks to all who gave me their suggestions and comments.
The way to find it is that once you have the modem name... you can look at:
\\hkey_local_machine\enum\pcmcia\<modem-name>

Special thanks to John Leier of TurboPower Software for his answer!
http://www.turbopower.com

Sidenote:  I do *NOT* work for or have any affiliation with TurboPower.  But, now I *can* start to finally grow back all the hair that I pulled out!!! :)

Hugh
ASKER CERTIFIED SOLUTION
Avatar of amartin030297
amartin030297

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial