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); }
public static extern void GetNativeSystemInfo(out NativeStructs.SYSTEM_INFO lpSystemInfo);
public static extern void GetSystemInfo(ref NativeStructs.SYSTEM_INFO Info);