winpty/misc/buffer-tests/harness/OsVersion.h
2015-10-21 19:56:12 -05:00

30 lines
596 B
C++

#pragma once
#include <windows.h>
#include <tuple>
#include <WinptyAssert.h>
inline std::tuple<int, int> osversion() {
OSVERSIONINFO info = { sizeof(info), 0 };
ASSERT(GetVersionEx(&info));
return std::make_tuple(info.dwMajorVersion, info.dwMinorVersion);
}
inline bool isWin7() {
return osversion() == std::make_tuple(6, 1);
}
inline bool isAtLeastVista() {
return osversion() >= std::make_tuple(6, 0);
}
inline bool isAtLeastWin7() {
return osversion() >= std::make_tuple(6, 1);
}
inline bool isAtLeastWin8() {
return osversion() >= std::make_tuple(6, 2);
}