15 OSVERSIONINFOEX result = {
sizeof(OSVERSIONINFOEX), 0, 0, 0, 0, {
'\0'}, 0, 0, 0, 0, 0};
17 HMODULE ntdll = GetModuleHandleW(L"ntdll.dll");
18 if (Q_UNLIKELY(!ntdll))
21 typedef NTSTATUS (NTAPI *RtlGetVersionFunction)(LPOSVERSIONINFO);
26 RtlGetVersionFunction pRtlGetVersion =
reinterpret_cast<RtlGetVersionFunction>(
27 reinterpret_cast<QFunctionPointer>(GetProcAddress(ntdll,
"RtlGetVersion")));
28 if (Q_UNLIKELY(!pRtlGetVersion))
33 pRtlGetVersion(
reinterpret_cast<LPOSVERSIONINFO>(&result));
39 OSVERSIONINFOEX realResult = determineWinOsVersion();
42 if (Q_UNLIKELY(qEnvironmentVariableIsSet(
"QT_WINVER_OVERRIDE"))) {
43 OSVERSIONINFOEX result = realResult;
44 result.dwMajorVersion = 0;
45 result.dwMinorVersion = 0;
48 result.dwBuildNumber = 0;
49 result.szCSDVersion[0] = L'\0';
50 result.wServicePackMajor = 0;
51 result.wServicePackMinor = 0;
53 const QByteArray winVerOverride = qgetenv(
"QT_WINVER_OVERRIDE");
54 if (winVerOverride ==
"WINDOWS10" || winVerOverride ==
"2016"
55 || winVerOverride ==
"2019" || winVerOverride ==
"2022") {
56 result.dwMajorVersion = 10;
57 }
else if (winVerOverride ==
"WINDOWS11") {
58 result.dwMajorVersion = 10;
59 result.dwBuildNumber = 22000;
64 if (winVerOverride ==
"2016" || winVerOverride ==
"2019"
65 || winVerOverride ==
"2022") {
68 if (result.wProductType == VER_NT_WORKSTATION)
69 result.wProductType = VER_NT_SERVER;
72 result.wProductType = VER_NT_WORKSTATION;