Sine Striker
2023-12-12 0586c98f90866e4bc9f0dfe73aefb0a07c56697e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "qwindowkit_windows.h"
 
namespace QWK {
 
    RTL_OSVERSIONINFOW GetRealOSVersion() {
        static const auto result = []() -> RTL_OSVERSIONINFOW {
            HMODULE hMod = ::GetModuleHandleW(L"ntdll.dll");
            using RtlGetVersionPtr = NTSTATUS(WINAPI *)(PRTL_OSVERSIONINFOW);
            auto pRtlGetVersion = reinterpret_cast<RtlGetVersionPtr>(::GetProcAddress(hMod, "RtlGetVersion"));
            RTL_OSVERSIONINFOW rovi{};
            rovi.dwOSVersionInfoSize = sizeof(rovi);
            pRtlGetVersion(&rovi);
            return rovi;
        }();
        return result;
    }
 
}