summaryrefslogtreecommitdiffstats
path: root/src/qt3support/network
diff options
context:
space:
mode:
authorminiak <milan.burda@gmail.com>2009-07-01 09:50:10 (GMT)
committerMarius Storm-Olsen <marius@trolltech.com>2009-07-01 09:51:19 (GMT)
commit8a7fb1881afe6b358a35cec71247d7e6681efe0a (patch)
treed290ba7a2bb25d98ed2826e0002bd1e3eebdb356 /src/qt3support/network
parent22ab94871c4a924e37eca720a1620da2e1a7259d (diff)
downloadQt-8a7fb1881afe6b358a35cec71247d7e6681efe0a.zip
Qt-8a7fb1881afe6b358a35cec71247d7e6681efe0a.tar.gz
Qt-8a7fb1881afe6b358a35cec71247d7e6681efe0a.tar.bz2
src/qt3support: Remove QT_WA and non-Unicode code paths, dropping Win9x and NT support
Merge-request: 604 Reviewed-by: Marius Storm-Olsen <marius@trolltech.com>
Diffstat (limited to 'src/qt3support/network')
-rw-r--r--src/qt3support/network/q3dns.cpp70
1 files changed, 19 insertions, 51 deletions
diff --git a/src/qt3support/network/q3dns.cpp b/src/qt3support/network/q3dns.cpp
index b80b76b..6d514c1 100644
--- a/src/qt3support/network/q3dns.cpp
+++ b/src/qt3support/network/q3dns.cpp
@@ -2242,53 +2242,31 @@ typedef struct {
typedef DWORD (WINAPI *GNP)( PFIXED_INFO, PULONG );
// ### FIXME: this code is duplicated in qfiledialog.cpp
-static QString getWindowsRegString( HKEY key, const QString &subKey )
+static QString getWindowsRegString(HKEY key, const QString &subKey)
{
QString s;
- QT_WA( {
- char buf[1024];
- DWORD bsz = sizeof(buf);
- int r = RegQueryValueEx( key, (TCHAR*)subKey.ucs2(), 0, 0, (LPBYTE)buf, &bsz );
- if ( r == ERROR_SUCCESS ) {
- s = QString::fromUcs2( (unsigned short *)buf );
- } else if ( r == ERROR_MORE_DATA ) {
- char *ptr = new char[bsz+1];
- r = RegQueryValueEx( key, (TCHAR*)subKey.ucs2(), 0, 0, (LPBYTE)ptr, &bsz );
- if ( r == ERROR_SUCCESS )
- s = QLatin1String(ptr);
- delete [] ptr;
- }
- } , {
- char buf[512];
- DWORD bsz = sizeof(buf);
- int r = RegQueryValueExA( key, subKey.local8Bit(), 0, 0, (LPBYTE)buf, &bsz );
- if ( r == ERROR_SUCCESS ) {
- s = QLatin1String(buf);
- } else if ( r == ERROR_MORE_DATA ) {
- char *ptr = new char[bsz+1];
- r = RegQueryValueExA( key, subKey.local8Bit(), 0, 0, (LPBYTE)ptr, &bsz );
- if ( r == ERROR_SUCCESS )
- s = QLatin1String(ptr);
- delete [] ptr;
- }
- } );
+
+ wchar_t buf[1024];
+ DWORD bsz = sizeof(buf) / sizeof(wchar_t);
+ int r = RegQueryValueEx(key, (wchar_t*)subKey.utf16(), 0, 0, (LPBYTE)buf, &bsz);
+ if (r == ERROR_SUCCESS) {
+ s = QString::fromWCharArray(buf);
+ } else if (r == ERROR_MORE_DATA) {
+ char *ptr = new char[bsz+1];
+ r = RegQueryValueEx(key, (wchar_t*)subKey.utf16(), 0, 0, (LPBYTE)ptr, &bsz);
+ if (r == ERROR_SUCCESS)
+ s = QLatin1String(ptr);
+ delete [] ptr;
+ }
+
return s;
}
static bool getDnsParamsFromRegistry( const QString &path,
- QString *domainName, QString *nameServer, QString *searchList )
+ QString *domainName, QString *nameServer, QString *searchList )
{
HKEY k;
- int r;
- QT_WA( {
- r = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
- (TCHAR*)path.ucs2(),
- 0, KEY_READ, &k );
- } , {
- r = RegOpenKeyExA( HKEY_LOCAL_MACHINE,
- path.latin1(),
- 0, KEY_READ, &k );
- } );
+ int r = RegOpenKeyEx( HKEY_LOCAL_MACHINE, (wchar_t*)path.utf16(), 0, KEY_READ, &k );
if ( r == ERROR_SUCCESS ) {
*domainName = getWindowsRegString( k, QLatin1String("DhcpDomain") );
@@ -2321,14 +2299,10 @@ void Q3Dns::doResInit()
bool gotNetworkParams = false;
// try the API call GetNetworkParams() first and use registry lookup only
// as a fallback
-#ifdef Q_OS_WINCE
- HINSTANCE hinstLib = LoadLibraryW( L"iphlpapi" );
-#else
- HINSTANCE hinstLib = LoadLibraryA( "iphlpapi" );
-#endif
+ HINSTANCE hinstLib = LoadLibrary( L"iphlpapi" );
if ( hinstLib != 0 ) {
#ifdef Q_OS_WINCE
- GNP getNetworkParams = (GNP) GetProcAddressW( hinstLib, L"GetNetworkParams" );
+ GNP getNetworkParams = (GNP) GetProcAddress( hinstLib, L"GetNetworkParams" );
#else
GNP getNetworkParams = (GNP) GetProcAddress( hinstLib, "GetNetworkParams" );
#endif
@@ -2362,13 +2336,7 @@ void Q3Dns::doResInit()
if ( getDnsParamsFromRegistry(
QLatin1String("System\\CurrentControlSet\\Services\\Tcpip\\Parameters"),
&domainName, &nameServer, &searchList )) {
- // for NT
separator = ' ';
- } else if ( getDnsParamsFromRegistry(
- QLatin1String("System\\CurrentControlSet\\Services\\VxD\\MSTCP"),
- &domainName, &nameServer, &searchList )) {
- // for Windows 98
- separator = ',';
} else {
// Could not access the TCP/IP parameters
domainName = QLatin1String("");