示例#1
0
        private static ProcessorArchitecture GetProcessorArchitecture()
        {
            NativeStructs.SYSTEM_INFO info = new NativeStructs.SYSTEM_INFO();

            SafeNativeMethods.GetSystemInfo(ref info);

            ProcessorArchitecture architecture;

            switch (info.wProcessorArchitecture)
            {
            case NativeConstants.PROCESSOR_ARCHITECTURE_INTEL:
                architecture = ProcessorArchitecture.X86;
                break;

            case NativeConstants.PROCESSOR_ARCHITECTURE_AMD64:
                architecture = ProcessorArchitecture.X64;
                break;

            case NativeConstants.PROCESSOR_ARCHITECTURE_ARM:
                architecture = ProcessorArchitecture.Arm;
                break;

            case NativeConstants.PROCESSOR_ARCHITECTURE_ARM64:
                architecture = ProcessorArchitecture.Arm64;
                break;

            default:
                architecture = ProcessorArchitecture.Unknown;
                break;
            }

            return(architecture);
        }
示例#2
0
 public static extern void GetNativeSystemInfo(out NativeStructs.SYSTEM_INFO lpSystemInfo);
示例#3
0
 public static extern void GetSystemInfo(ref NativeStructs.SYSTEM_INFO Info);