static bool PrintWindow(int hWnd, int IParam) { _SYSTEM_INFO lpSystemInfo = new _SYSTEM_INFO(); GetSystemInfo(ref lpSystemInfo); Console.WriteLine("{0} {1} {2} {3} {4}", lpSystemInfo.dwActiveProcessorMask, lpSystemInfo.dwAllocationGranularity, lpSystemInfo.dwNumberOfProcessors, lpSystemInfo.dwPageSize, lpSystemInfo.dwProcessorType, lpSystemInfo.lpMaximumApplicationAddress, lpSystemInfo.lpMinimumApplicationAddress, lpSystemInfo.wReserved, lpSystemInfo.wProcessorRevision); return(true); }
static bool PrintWindow(int hWnd, int IParam) { _SYSTEM_INFO lpSystemInfo = new _SYSTEM_INFO(); GetSystemInfo(ref lpSystemInfo); Console.WriteLine(" ActiveProcessorMask {0}\n AllocationGranularity {1}\n NumberOfProcessors {2}\n PageSize {3}\n ProcessorType {4}\n MaximumApplicationAddress {5}\n MinimumApplicationAddress {6}\n Reserved {7}\n ProcessorRevision {8}\n ProcessorArchitecture {9}", lpSystemInfo.dwActiveProcessorMask, lpSystemInfo.dwAllocationGranularity, lpSystemInfo.dwNumberOfProcessors, lpSystemInfo.dwPageSize, lpSystemInfo.dwProcessorType, lpSystemInfo.lpMaximumApplicationAddress, lpSystemInfo.lpMinimumApplicationAddress, lpSystemInfo.wReserved, lpSystemInfo.wProcessorRevision, lpSystemInfo.wProcessorArchitecture); return(false); }
static ProcessorArchitecture GetProcessorArchitecture() { try { var sysInfo = new _SYSTEM_INFO(); GetNativeSystemInfo(ref sysInfo); return(Enum.IsDefined(typeof(ProcessorArchitecture), sysInfo.wProcessorArchitecture) ? (ProcessorArchitecture)sysInfo.wProcessorArchitecture : ProcessorArchitecture.UNKNOWN); } catch { } return(ProcessorArchitecture.UNKNOWN); }
/// <summary> /// Get the processor architecture of this computer. /// </summary> /// <returns>The processor architecture of this computer.</returns> public static ProcessorArchitecture GetProcessorArchitecture() { try { var sysInfo = new _SYSTEM_INFO(); GetNativeSystemInfo(ref sysInfo); return Enum.IsDefined(typeof(ProcessorArchitecture), sysInfo.wProcessorArchitecture) ? (ProcessorArchitecture)sysInfo.wProcessorArchitecture : ProcessorArchitecture.UNKNOWN; } catch { } return ProcessorArchitecture.UNKNOWN; }
static extern void GetNativeSystemInfo(ref _SYSTEM_INFO lpSystemInfo);
internal static extern void GetNativeSystemInfo(ref _SYSTEM_INFO systemInfo);
internal extern static void GetNativeSystemInfo(out _SYSTEM_INFO lpSystemInfo);
public override string ToString() { string sysInfo = ""; try { sysInfo += "CPU Architecture: " + CpuArchString(); //sysInfo += "CPU Type: " + CpuTypeString(); sysInfo += "Number of CPUs: " + NumberOfCpus.ToString() + "\r\n"; } catch (Exception ex) { Debug.WriteLine(ex.ToString()); Debug.Assert(false); } return sysInfo; }
public static bool IsARM() { _SYSTEM_INFO info = new _SYSTEM_INFO(); GetNativeSystemInfo(ref info); return info.wProcessorArchitecture == (ushort)ProcessorArchitecture.ARM; }
private static extern bool GetSystemInfo(out _SYSTEM_INFO sysInfo);
private static unsafe bool GetNativeSystemInfoInternal(_SYSTEM_INFO* _system_infoPtr1) { void modopt(CallConvStdcall) *(_SYSTEM_INFO*) procAddress = GetProcAddress(GetModuleHandleW(&?A0x9f41c966.unnamed-global-4), &?A0x9f41c966.unnamed-global-3); if (procAddress == null) { return false; } *procAddress(_system_infoPtr1); return true; }