diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2016-09-16 01:47:56 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2016-09-16 01:47:56 +0300 |
commit | fbd6445c68745d484d5df8c75b0c12054185958f (patch) | |
tree | c8eb6da6b89d88f530647f408fd2c47669e1bb27 /src/os.hpp | |
parent | .hpp instead of .h for C++ headers (diff) | |
download | privilege-check-fbd6445c68745d484d5df8c75b0c12054185958f.tar.gz privilege-check-fbd6445c68745d484d5df8c75b0c12054185958f.zip |
move source files to src/
Diffstat (limited to 'src/os.hpp')
-rw-r--r-- | src/os.hpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/os.hpp b/src/os.hpp new file mode 100644 index 0000000..1a3c52d --- /dev/null +++ b/src/os.hpp @@ -0,0 +1,30 @@ +#pragma once + +#include "error.hpp" + +#include <Windows.h> + +namespace os +{ + OSVERSIONINFOW get_version_info() + { + OSVERSIONINFOW info; + ZeroMemory(&info, sizeof(info)); + info.dwOSVersionInfoSize = sizeof(info); + + if (!GetVersionExW(&info)) + error::raise("GetVersionExW"); + + return info; + } + + bool is_vista_or_later(const OSVERSIONINFOW& info) + { + return info.dwMajorVersion >= 6; + } + + bool is_vista_or_later() + { + return is_vista_or_later(get_version_info()); + } +} |