diff options
| author | 2015-04-19 22:30:43 -0400 | |
|---|---|---|
| committer | 2015-04-19 22:30:43 -0400 | |
| commit | 094918f048c81474b22f9ba2940c96dc4033d753 (patch) | |
| tree | 2b89c77ad7dc9c55e9ba383f23f9f25b82df358e /SQLiteStudio3/coreSQLiteStudio/common/utils.cpp | |
| parent | 640fff60ceecde402131937dddb3458f7a003e9c (diff) | |
| parent | a308f430f694423064ebc86fd0506c8c6fdb3d93 (diff) | |
Merge tag 'upstream/3.0.5'
Upstream version 3.0.5
# gpg: Signature made Sun 19 Apr 2015 10:30:41 PM EDT using RSA key ID EBE9BD91
# gpg: Good signature from "Unit 193 <unit193@gmail.com>"
# gpg: aka "Unit 193 <unit193@ninthfloor.org>"
# gpg: aka "Unit 193 <unit193@ubuntu.com>"
# gpg: aka "Unit 193 <unit193@ninthfloor.com>"
Diffstat (limited to 'SQLiteStudio3/coreSQLiteStudio/common/utils.cpp')
| -rw-r--r-- | SQLiteStudio3/coreSQLiteStudio/common/utils.cpp | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/SQLiteStudio3/coreSQLiteStudio/common/utils.cpp b/SQLiteStudio3/coreSQLiteStudio/common/utils.cpp index d56d838..f2b3d1c 100644 --- a/SQLiteStudio3/coreSQLiteStudio/common/utils.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/common/utils.cpp @@ -18,6 +18,33 @@ #include <QFileInfo> #endif +#ifdef Q_OS_WIN +#include <windows.h> +#include <tchar.h> + +typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); +bool is64BitWindows() +{ +#if defined(_WIN64) + return true; // 64-bit programs run only on Win64 +#elif defined(_WIN32) + // 32-bit programs run on both 32-bit and 64-bit Windows + // so must sniff + BOOL f64 = false; + LPFN_ISWOW64PROCESS fnIsWow64Process; + + fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress(GetModuleHandle(TEXT("kernel32")), "IsWow64Process"); + if (fnIsWow64Process) + { + return fnIsWow64Process(GetCurrentProcess(), &f64) && f64; + } + return false; +#else + return true; // Win64 does not support Win16 +#endif +} +#endif + void initUtils() { qRegisterMetaType<QList<int>>("QList<int>"); @@ -735,7 +762,14 @@ QString getOsString() QString os = "Unknown"; #endif - os += ", " + QString::number(QSysInfo::WordSize) + "bit"; + os += ", "; +#ifdef Q_OS_WIN + os += (is64BitWindows() ? "64" : "32"); +#else + os += QString::number(QSysInfo::WordSize); +#endif + os += "bit"; + return os; } |
