diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2016-09-16 01:08:49 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2016-09-16 01:08:49 +0300 |
commit | 42f1ad36ef93c98542f9899ada57bd55396a99f5 (patch) | |
tree | d0b10dd617764271db739b608a9d6bfaa63d516b /os.hpp | |
parent | make the 'Elevate' button smaller (diff) | |
download | privilege-check-42f1ad36ef93c98542f9899ada57bd55396a99f5.tar.gz privilege-check-42f1ad36ef93c98542f9899ada57bd55396a99f5.zip |
.hpp instead of .h for C++ headers
Diffstat (limited to 'os.hpp')
-rw-r--r-- | os.hpp | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -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()); + } +} |