Windows枚舉出系統中所有的串口的9種方法

  1. CreateFile("COM" + 1->255) as suggested by Wael Dalloul
    ✔ Found com0com ports, took 234ms.

  2. QueryDosDevice()
    ✔ Found com0com ports, took 0ms.

  3. GetDefaultCommConfig("COM" + 1->255)
    ✔ Found com0com ports, took 235ms.

  4. "SetupAPI1" using calls to SETUPAPI.DLL
    ✔ Found com0com ports, also reported "friendly names", took 15ms.

  5. "SetupAPI2" using calls to SETUPAPI.DLL
    ✘ Did not find com0com ports, reported "friendly names", took 32ms.

  6. EnumPorts()
    ✘ Reported some non-COM ports, did not find com0com ports, took 15ms.

  7. Using WMI calls
    ✔ Found com0com ports, also reported "friendly names", took 47ms.

  8. COM Database using calls to MSPORTS.DLL
    ✔/✘ Reported some non-COM ports, found com0com ports, took 16ms.

  9. Iterate over registry key HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM
    ✔ Found com0com ports, took 0ms.

發佈了137 篇原創文章 · 獲贊 16 · 訪問量 49萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章