[DllImport("coredll", SetLastError = true)]
public static extern void GetSystemInfo(out SYSTEM_INFO lpSystemInfo);
Declare Function GetSystemInfo Lib "coredll.dll" (ByVal lpSystemInfo AS SYSTEM_INFO)
Public Enum ProcessorArchitecture As Int16
PROCESSOR_ARCHITECTURE_INTEL = 0
PROCESSOR_ARCHITECTURE_MIPS = 1
PROCESSOR_ARCHITECTURE_ALPHA = 2
PROCESSOR_ARCHITECTURE_PPC = 3
PROCESSOR_ARCHITECTURE_SHX = 4
PROCESSOR_ARCHITECTURE_ARM = 5
PROCESSOR_ARCHITECTURE_IA64 = 6
PROCESSOR_ARCHITECTURE_ALPHA64 = 7
PROCESSOR_ARCHITECTURE_UNKNOWN = &hFFFF;
End Enum
SYSTEM_INFO on MSDN
[StructLayout(LayoutKind.Sequential)]
public struct SYSTEM_INFO
{
//[MarshalAs(UnmanagedType.U4)]
//public int dwOemId; // dwOemId is obsolete according to MS: http://msdn.microsoft.com/en-us/library/aa450921.aspx
[MarshalAs(UnmanagedType.U2)]
public ProcessorArchitecture wProcessorArchitecture;
[MarshalAs(UnmanagedType.U2)]
public short wReserved;
[MarshalAs(UnmanagedType.U4)]
public int dwPageSize;
public uint lpMinimumApplicationAddress;
public uint lpMaximumApplicationAddress;
[MarshalAs(UnmanagedType.U4)]
public int dwActiveProcessorMask;
[MarshalAs(UnmanagedType.U4)]
public int dwNumberOfProcessors;
[MarshalAs(UnmanagedType.U4)]
public int dwProcessorType;
[MarshalAs(UnmanagedType.U4)]
public int dwAllocationGranularity;
[MarshalAs(UnmanagedType.U2)]
public short dwProcessorLevel;
[MarshalAs(UnmanagedType.U2)]
public short dwProcessorRevision;
}
Do you know one? Please contribute it!
Please add some!
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace Test
{
[StructLayout(LayoutKind.Sequential)]
public struct SYSTEM_INFO
{
[MarshalAs(UnmanagedType.U4)]
public int dwOemId;
[MarshalAs(UnmanagedType.U4)]
public int dwPageSize;
public uint lpMinimumApplicationAddress;
public uint lpMaximumApplicationAddress;
[MarshalAs(UnmanagedType.U4)]
public int dwActiveProcessorMask;
[MarshalAs(UnmanagedType.U4)]
public int dwNumberOfProcessors;
[MarshalAs(UnmanagedType.U4)]
public int dwProcessorType;
[MarshalAs(UnmanagedType.U4)]
public int dwAllocationGranularity;
[MarshalAs(UnmanagedType.U2)]
public short dwProcessorLevel;
[MarshalAs(UnmanagedType.U2)]
public short dwProcessorRevision;
}
class Program
{
[DllImport("coredll", SetLastError = true)]
public static extern void GetSystemInfo(out SYSTEM_INFO pSi);
static void Main(string[] args)
{
SYSTEM_INFO si;
GetSystemInfo(out si);
}
}
}