Beispiel #1
0
        public static Platform GetOperationSystemPlatform()
        {
            if (Environment.OSVersion.Platform == PlatformID.Unix)
            {
                return(Environment.Is64BitOperatingSystem  ? Platform.X64 : Platform.X86);
            }
            var sysInfo = new Win32NativeMethods.SYSTEM_INFO();

            // WinXP and older - use GetNativeSystemInfo
            if (Environment.OSVersion.Version.Major > 5 ||
                (Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor >= 1))
            {
                NativeMethodWrapper.GetNativeSystemInfo(ref sysInfo);
            }
            // else use GetSystemInfo
            else
            {
                NativeMethodWrapper.GetSystemInfo(ref sysInfo);
            }

            switch (sysInfo.wProcessorArchitecture)
            {
            case PROCESSOR_ARCHITECTURE_IA64:
            case PROCESSOR_ARCHITECTURE_AMD64:
                return(Platform.X64);

            case PROCESSOR_ARCHITECTURE_INTEL:
                return(Platform.X86);

            default:
                return(Platform.Unknown);
            }
        }
Beispiel #2
0
 public static void GetNativeSystemInfo(ref Win32NativeMethods.SYSTEM_INFO sysInfo)
 {
     Win32NativeMethods.GetNativeSystemInfo(ref sysInfo);
     return;
 }