diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2015-12-09 22:28:03 +0300 |
---|---|---|
committer | Denis Shienkov <denis.shienkov@gmail.com> | 2015-12-10 09:49:14 +0000 |
commit | a1a98f1cffedd23fed9f0a29cd297fc255af1978 (patch) | |
tree | 6ffda0aed940df56d6a458ba930b59082567d536 /src/serialport/qserialportinfo_win.cpp | |
parent | 5641fd99e3c61291cf5562b5083e93678c5d6ab4 (diff) | |
download | qtserialport-a1a98f1cffedd23fed9f0a29cd297fc255af1978.tar.gz |
Use pre-defined class/interface devices GUIDs
Also is added the test for verification of presence of ntddmodm.h file,
which contains GUID_DEVINTERFACE_MODEM definition. In case the compiler
has not this file, we define GUID_DEVINTERFACE_MODEM himself.
Change-Id: I471f76f8eabd2a200702a0970aa538c780208e18
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Diffstat (limited to 'src/serialport/qserialportinfo_win.cpp')
-rw-r--r-- | src/serialport/qserialportinfo_win.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/serialport/qserialportinfo_win.cpp b/src/serialport/qserialportinfo_win.cpp index 06987f2..123b066 100644 --- a/src/serialport/qserialportinfo_win.cpp +++ b/src/serialport/qserialportinfo_win.cpp @@ -44,9 +44,17 @@ #include <vector> #include <initguid.h> +#include <devguid.h> // for GUID_DEVCLASS_PORTS and GUID_DEVCLASS_MODEM +#include <winioctl.h> // for GUID_DEVINTERFACE_COMPORT #include <setupapi.h> #include <cfgmgr32.h> +#ifdef QT_NO_REDEFINE_GUID_DEVINTERFACE_MODEM +# include <ntddmodm.h> // for GUID_DEVINTERFACE_MODEM +#else + DEFINE_GUID(GUID_DEVINTERFACE_MODEM, 0x2c7089aa, 0x2e0e, 0x11d1, 0xb1, 0x14, 0x00, 0xc0, 0x4f, 0xc2, 0xaa, 0xe4); +#endif + QT_BEGIN_NAMESPACE typedef QPair<QUuid, DWORD> GuidFlagsPair; @@ -54,14 +62,10 @@ typedef QPair<QUuid, DWORD> GuidFlagsPair; static inline const QList<GuidFlagsPair>& guidFlagsPairs() { static const QList<GuidFlagsPair> guidFlagsPairList = QList<GuidFlagsPair>() - // Standard Setup Ports Class GUID - << qMakePair(QUuid(0x4D36E978, 0xE325, 0x11CE, 0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18), DWORD(DIGCF_PRESENT)) - // Standard Setup Modems Class GUID - << qMakePair(QUuid(0x4D36E96D, 0xE325, 0x11CE, 0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18), DWORD(DIGCF_PRESENT)) - // Standard Serial Port Device Interface Class GUID - << qMakePair(QUuid(0x86E0D1E0, 0x8089, 0x11D0, 0x9C, 0xE4, 0x08, 0x00, 0x3E, 0x30, 0x1F, 0x73), DWORD(DIGCF_PRESENT | DIGCF_DEVICEINTERFACE)) - // Standard Modem Device Interface Class GUID - << qMakePair(QUuid(0x2C7089AA, 0x2E0E, 0x11D1, 0xB1, 0x14, 0x00, 0xC0, 0x4F, 0xC2, 0xAA, 0xE4), DWORD(DIGCF_PRESENT | DIGCF_DEVICEINTERFACE)); + << qMakePair(QUuid(GUID_DEVCLASS_PORTS), DWORD(DIGCF_PRESENT)) + << qMakePair(QUuid(GUID_DEVCLASS_MODEM), DWORD(DIGCF_PRESENT)) + << qMakePair(QUuid(GUID_DEVINTERFACE_COMPORT), DWORD(DIGCF_PRESENT | DIGCF_DEVICEINTERFACE)) + << qMakePair(QUuid(GUID_DEVINTERFACE_MODEM), DWORD(DIGCF_PRESENT | DIGCF_DEVICEINTERFACE)); return guidFlagsPairList; } |