src/gui/util/qdesktopservices_win.cpp
changeset 30 5dc02b23752f
parent 18 2f34d5167611
--- a/src/gui/util/qdesktopservices_win.cpp	Wed Jun 23 19:07:03 2010 +0300
+++ b/src/gui/util/qdesktopservices_win.cpp	Tue Jul 06 15:10:48 2010 +0300
@@ -59,7 +59,7 @@
 #  endif
 #endif
 
-#if defined(Q_CC_MINGW) && !defined(CSIDL_MYMUSIC)
+#ifndef CSIDL_MYMUSIC
 #define CSIDL_MYMUSIC	13
 #define CSIDL_MYVIDEO	14
 #endif
@@ -97,19 +97,19 @@
     if (url.scheme() == QLatin1String("mailto")) {
         //Retrieve the commandline for the default mail client
         //the default key used below is the command line for the mailto: shell command
-        DWORD  bufferSize = 2 * MAX_PATH;
+        DWORD  bufferSize = sizeof(wchar_t) * MAX_PATH;
         long  returnValue =  -1;
         QString command;
 
         HKEY handle;
         LONG res;
-        wchar_t keyValue[2 * MAX_PATH] = {0};
+        wchar_t keyValue[MAX_PATH] = {0};
         QString keyName(QLatin1String("mailto"));
 
         //Check if user has set preference, otherwise use default.
-        res = RegOpenKeyExW(HKEY_CURRENT_USER,
-                            L"Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\mailto\\UserChoice",
-                            0, KEY_READ, &handle);
+        res = RegOpenKeyEx(HKEY_CURRENT_USER,
+                           L"Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\mailto\\UserChoice",
+                           0, KEY_READ, &handle);
         if (res == ERROR_SUCCESS) {
             returnValue = RegQueryValueEx(handle, L"Progid", 0, 0, reinterpret_cast<unsigned char*>(keyValue), &bufferSize);
             if (!returnValue)
@@ -121,8 +121,8 @@
         if (res != ERROR_SUCCESS)
             return false;
 
-        bufferSize = 2 * MAX_PATH;
-        returnValue = RegQueryValueExW(handle, L"", 0, 0, reinterpret_cast<unsigned char*>(keyValue), &bufferSize);
+        bufferSize = sizeof(wchar_t) * MAX_PATH;
+        returnValue = RegQueryValueEx(handle, L"", 0, 0, reinterpret_cast<unsigned char*>(keyValue), &bufferSize);
         if (!returnValue)
             command = QString::fromRawData((QChar*)keyValue, bufferSize);
         RegCloseKey(handle);