49 static inline OSVERSIONINFOEX determineWinOsVersion()
51 OSVERSIONINFOEX
result = {
sizeof(OSVERSIONINFOEX), 0, 0, 0, 0, {
'\0'}, 0, 0, 0, 0, 0};
53 HMODULE ntdll = GetModuleHandleW(
L"ntdll.dll");
57 typedef NTSTATUS (NTAPI *RtlGetVersionFunction)(LPOSVERSIONINFO);
62 RtlGetVersionFunction pRtlGetVersion =
reinterpret_cast<RtlGetVersionFunction
>(
63 reinterpret_cast<QFunctionPointer
>(GetProcAddress(ntdll,
"RtlGetVersion")));
69 pRtlGetVersion(
reinterpret_cast<LPOSVERSIONINFO
>(&
result));
75 OSVERSIONINFOEX realResult = determineWinOsVersion();
78 if (
Q_UNLIKELY(qEnvironmentVariableIsSet(
"QT_WINVER_OVERRIDE"))) {
79 OSVERSIONINFOEX
result = realResult;
86 result.wServicePackMajor = 0;
87 result.wServicePackMinor = 0;
89 const QByteArray winVerOverride = qgetenv(
"QT_WINVER_OVERRIDE");
90 if (winVerOverride ==
"WINDOWS10" || winVerOverride ==
"2016") {
91 result.dwMajorVersion = 10;
96 if (winVerOverride ==
"2016") {
99 if (
result.wProductType == VER_NT_WORKSTATION)
100 result.wProductType = VER_NT_SERVER;
103 result.wProductType = VER_NT_WORKSTATION;
117 v.m_major = osv.dwMajorVersion;
118 v.m_minor = osv.dwMinorVersion;
119 v.m_micro = osv.dwBuildNumber;
The QByteArray class provides an array of bytes.
static Q_CORE_EXPORT QOperatingSystemVersionBase current()
static constexpr OSType currentType()
GLsizei const GLfloat * v
[13]
OSVERSIONINFOEX qWindowsVersionInfo()