Asmichi.Interop.Windows.NtDll.RtlGetVersion C# (CSharp) Метод

RtlGetVersion() приватный Метод

private RtlGetVersion ( RTL_OSVERSIONINFOW &lpVersionInformation ) : int
lpVersionInformation RTL_OSVERSIONINFOW
Результат int
        public static extern int RtlGetVersion([In, Out] ref RTL_OSVERSIONINFOW lpVersionInformation);

Usage Example

Пример #1
0
        private static unsafe bool GetIsWindows1809()
        {
            // Resort to ntdll. OsGetVersionEx and hence Environment.OSVersion.Version (till .NET Core 3.1)
            // will always return Windows 8.1 if the app is not manifested to support newer versions.
            // https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getversionexw
            // https://github.com/dotnet/runtime/pull/33651
            var osvi = default(NtDll.RTL_OSVERSIONINFOW);

            osvi.dwOSVersionInfoSize = (uint)sizeof(NtDll.RTL_OSVERSIONINFOW);
            int ntstatus = NtDll.RtlGetVersion(ref osvi);

            if (ntstatus < 0)
            {
                throw new AsmichiChildProcessInternalLogicErrorException(Invariant($"RtlGetVersion failed (0x{ntstatus:X})."));
            }

            return(osvi.dwPlatformId == 2 &&
                   osvi.dwMajorVersion == 10 &&
                   osvi.dwMinorVersion == 0 &&
                   osvi.dwBuildNumber == 17763);
        }