How can I get specific serial (COM) port information in Windows?

Since I have several dozen virtual serial ports (COM) installed, and half of them are Bluetooth devices, I would like to know which port belongs to the device and whether it connects directly or via Bluetooth.

Therefore, in particular, I am not interested in the trivial enumeration of all serial ports, which will only reveal the "COM" list of the corresponding number, but the real name of this device and, probably, its device identifier (where information can be found out if this is connected via USB or Bluetooth.

Although I could get this information through WMI, there are many problems associated with this method. In particular, it is damn slow, but it also lists only connected devices (except for Bluetooth devices that can be connected and shown regardless of the actual connection)

I would prefer a solution written in Delphi / Object Pascal, but any other language is also suitable for me (WMI passcode was copied from C #).

+4
source share
1 answer

If you use a programming language / API that can read the registry, check the subtree HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum.

, , , . Device Parameters\PortName, COM.

,

ACPI\PNP0501\1\Device Parameters\PortName = COM1
BTHENUM\{GUID}{ID}\Device Parameters\PortName = COM4

,

ACPI\PNP0501\1\FriendlyName = Kommunikationsanschluss (COM1)  (german windows)
ACPI\PNP0501\1\Service = Serial
BTHENUM\{GUID}{ID}\Service = BTHMODEM

regedit, , . .

+6

Source: https://habr.com/ru/post/1523793/


All Articles