From 42f1ad36ef93c98542f9899ada57bd55396a99f5 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Fri, 16 Sep 2016 01:08:49 +0300 Subject: .hpp instead of .h for C++ headers --- os.hpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 os.hpp (limited to 'os.hpp') diff --git a/os.hpp b/os.hpp new file mode 100644 index 0000000..1a3c52d --- /dev/null +++ b/os.hpp @@ -0,0 +1,30 @@ +#pragma once + +#include "error.hpp" + +#include + +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()); + } +} -- cgit v1.2.3