diff options
author | Daniel Wilhelm <daniel@wili.li> | 2015-10-02 14:53:55 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2015-10-02 14:53:55 +0200 |
commit | 9321c6bdfc559db6cf436d4ea88198983ce59846 (patch) | |
tree | e711c3373711b70b26de188aa4a893ffd30a1754 /zen/win_ver.h | |
parent | 6.11 (diff) | |
download | FreeFileSync-9321c6bdfc559db6cf436d4ea88198983ce59846.tar.gz FreeFileSync-9321c6bdfc559db6cf436d4ea88198983ce59846.tar.bz2 FreeFileSync-9321c6bdfc559db6cf436d4ea88198983ce59846.zip |
6.12
Diffstat (limited to 'zen/win_ver.h')
-rw-r--r-- | zen/win_ver.h | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/zen/win_ver.h b/zen/win_ver.h index 1d7ce7f0..97b6d7e1 100644 --- a/zen/win_ver.h +++ b/zen/win_ver.h @@ -1,6 +1,6 @@ // ************************************************************************** // * This file is part of the FreeFileSync project. It is distributed under * -// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * +// * GNU General Public License: http://www.gnu.org/licenses/gpl-3.0 * // * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** @@ -10,6 +10,8 @@ #include <cassert> #include <utility> #include "win.h" //includes "windows.h" +#include "build_info.h" +#include "dll.h" namespace zen { @@ -33,6 +35,7 @@ const OsVersion osVersionWin7 (6, 1); const OsVersion osVersionWinVista (6, 0); const OsVersion osVersionWinServer2003(5, 2); const OsVersion osVersionWinXp (5, 1); +const OsVersion osVersionWin2000 (5, 0); /* NOTE: there are two basic APIs to check Windows version: (empiric study following) @@ -53,6 +56,8 @@ inline bool winXpOrLater () { using namespace std::rel_ops; return getOsV bool isRealOsVersion(const OsVersion& ver); +bool runningWOW64(); +bool running64BitWindows(); @@ -98,6 +103,30 @@ bool isRealOsVersion(const OsVersion& ver) return rv; } + + +inline +bool runningWOW64() //test if process is running under WOW64: http://msdn.microsoft.com/en-us/library/ms684139(VS.85).aspx +{ + typedef BOOL (WINAPI* IsWow64ProcessFun)(HANDLE hProcess, PBOOL Wow64Process); + + const SysDllFun<IsWow64ProcessFun> isWow64Process(L"kernel32.dll", "IsWow64Process"); + if (isWow64Process) + { + BOOL isWow64 = FALSE; + if (isWow64Process(::GetCurrentProcess(), &isWow64)) + return isWow64 != FALSE; + } + return false; +} + + +inline +bool running64BitWindows() //http://blogs.msdn.com/b/oldnewthing/archive/2005/02/01/364563.aspx +{ + static_assert(zen::is32BitBuild || zen::is64BitBuild, ""); + return is64BitBuild || runningWOW64(); //should we bother to make this a compile-time check? +} } #endif //WINDOWS_VERSION_HEADER_238470348254325 |