Zhao Yuhang
2023-12-11 2f6c83c095724bbba0f43b2f2893ba73c17949a6
src/core/qwindowkit_windows.cpp
@@ -1 +1,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;
    }
}