Qt4ProjectManager: Do not include windows.h in qtversionmanager.

Move 64bit-binary detection into Utils library.
This commit is contained in:
Friedemann Kleint
2010-11-03 09:05:14 +01:00
parent 36a10aa26f
commit 0aaeae97c6
3 changed files with 27 additions and 21 deletions

View File

@@ -28,6 +28,7 @@
**************************************************************************/
#include "winutils.h"
#include "qtcassert.h"
// Enable WinAPI Windows XP and later
#define _WIN32_WINNT 0x0501
@@ -38,6 +39,7 @@
#include <QtCore/QDebug>
#include <QtCore/QLibrary>
#include <QtCore/QTextStream>
#include <QtCore/QDir>
namespace Utils {
@@ -173,4 +175,23 @@ QTCREATOR_UTILS_EXPORT bool winIs64BitSystem()
|| systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64;
}
QTCREATOR_UTILS_EXPORT bool winIs64BitBinary(const QString &binaryIn)
{
QTC_ASSERT(!binaryIn.isEmpty(), return false; )
#ifdef Q_OS_WIN32
# ifdef __GNUC__ // MinGW lacking some definitions/winbase.h
# define SCS_64BIT_BINARY 6
# endif
bool isAmd64 = false;
DWORD binaryType = 0;
const QString binary = QDir::toNativeSeparators(binaryIn);
bool success = GetBinaryTypeW(reinterpret_cast<const TCHAR*>(binary.utf16()), &binaryType) != 0;
if (success && binaryType == SCS_64BIT_BINARY)
isAmd64=true;
return isAmd64;
#else
return false;
#endif
}
} // namespace Utils