summaryrefslogtreecommitdiffstats
path: root/tools/runonphone/serenum_win.cpp
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2010-01-07 17:46:16 (GMT)
committerShane Kearns <shane.kearns@sosco.com>2010-01-08 11:22:56 (GMT)
commit32419380bdd11e7db401fd37a840e0ec4f5b6845 (patch)
treeb2b738d67313c778633f62e353a54e1820d36f99 /tools/runonphone/serenum_win.cpp
parent1f8fa41e78b4174ab64953dd80a1d562b0afc5aa (diff)
downloadQt-32419380bdd11e7db401fd37a840e0ec4f5b6845.zip
Qt-32419380bdd11e7db401fd37a840e0ec4f5b6845.tar.gz
Qt-32419380bdd11e7db401fd37a840e0ec4f5b6845.tar.bz2
Enable building with MSVC2008
Removed the alternate implementation of the registry reading, although the new API is simpler, the old XP method is not deprecated. Added an extra library that is needed according to API documentation, but is omittable on MinGW. Also gave a better error message when serial port detection fails. Reviewed-by: Miikka Heikkinen
Diffstat (limited to 'tools/runonphone/serenum_win.cpp')
-rw-r--r--tools/runonphone/serenum_win.cpp11
1 files changed, 1 insertions, 10 deletions
diff --git a/tools/runonphone/serenum_win.cpp b/tools/runonphone/serenum_win.cpp
index ec11c3c..23e3862 100644
--- a/tools/runonphone/serenum_win.cpp
+++ b/tools/runonphone/serenum_win.cpp
@@ -77,8 +77,7 @@ QList<SerialPortId> enumerateSerialPorts()
}
HKEY key = SetupDiOpenDevRegKey(infoset, &info, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_READ);
if(key != INVALID_HANDLE_VALUE) {
-#if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0600
- //RegGetValue not supported on XP, SHRegGetValue not supported by mingw :(
+ //RegGetValue not supported on XP, SHRegGetValue not supported by mingw, so use the old method of enumerating all the values
for (DWORD dwi=0;;dwi++) {
DWORD vsize = valueName.size();
if (ERROR_SUCCESS == RegEnumValue(key, dwi, (WCHAR*)(valueName.data()), &vsize, 0, 0, 0, &size)) {
@@ -93,14 +92,6 @@ QList<SerialPortId> enumerateSerialPorts()
break;
}
}
-#else
- if (ERROR_SUCCESS == SHRegGetValue(key, 0, "PortName", SRRF_RT_REG_SZ, 0, &size)) {
- QByteArray ba(size, 0);
- if (ERROR_SUCCESS == RegGetValue(key, 0, "PortName", SRRF_RT_REG_SZ, (BYTE*)(ba.data()), &size)) {
- portName = QString((const QChar*)(ba.constData()), ba.size() / 2 - 1);
- }
- }
-#endif
RegCloseKey(key);
}
SerialPortId id;