public static Version RtlGetVersion() { RTL_OSVERSIONINFOEX v = default; v.dwOSVersionInfoSize = (uint)Marshal.SizeOf(v); if (RtlGetVersion(ref v) == 0) { return(new Version((int)v.dwMajorVersion, (int)v.dwMinorVersion, (int)v.dwBuildNumber)); } else { throw new Win32Exception("RtlGetVersion failed!"); } }
private static extern int RtlGetVersion(ref RTL_OSVERSIONINFOEX lpVersionInformation);