Пример #1
0
        /// <summary>
        /// Use RtlGetVersion for get real OS Version without app.manifest (for apps it is masked as 6.2)
        /// </summary>
        /// <param name="version"></param>
        /// <returns></returns>
        internal static bool GetOsVersion(out Version version)
        {
            var nativeOsInfo = new RTL_OSVERSIONINFOEXW();

            nativeOsInfo.dwOSVersionInfoSize = 20 + 256 + 8;

            bool ok = false;

            try
            {
                ok = RtlGetVersion(ref nativeOsInfo) == 0;
            }
            catch (Exception e)
            {
            }

            if (ok)
            {
                version = new Version(nativeOsInfo.dwMajorVersion, nativeOsInfo.dwMinorVersion, nativeOsInfo.dwBuildNumber, 0);
            }
            else
            {
                version = new Version(0, 0, 0, 0);
            }
            return(ok);
        }
Пример #2
0
 internal static extern int RtlGetVersion(ref RTL_OSVERSIONINFOEXW osVersionInfo);