aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/os.h
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2016-09-15 19:32:24 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2016-09-15 19:32:24 +0300
commit94ae6a34b0cb90ee387c6e9a86ccd1998f8864d6 (patch)
tree67e27c98fb4399f65aeee74b116dfed1565a6e8d /os.h
downloadprivilege-check-94ae6a34b0cb90ee387c6e9a86ccd1998f8864d6.tar.gz
privilege-check-94ae6a34b0cb90ee387c6e9a86ccd1998f8864d6.zip
initial commit
Diffstat (limited to 'os.h')
-rw-r--r--os.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/os.h b/os.h
new file mode 100644
index 0000000..e4ba71c
--- /dev/null
+++ b/os.h
@@ -0,0 +1,30 @@
+#pragma once
+
+#include "error.h"
+
+#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());
+ }
+}