[DllImport("coredll", SetLastError = true)]
public static extern void GetSystemInfo(out SYSTEM_INFO pSi);
Declare Function GetSystemInfo Lib "coredll.dll" (TODO) As TODO
// const for wProcessorArchitecture
public const int PROCESSOR_ARCHITECTURE_INTEL = 0;
public const int PROCESSOR_ARCHITECTURE_MIPS = 1;
public const int PROCESSOR_ARCHITECTURE_ALPHA = 2;
public const int PROCESSOR_ARCHITECTURE_PPC = 3;
public const int PROCESSOR_ARCHITECTURE_SHX = 4;
public const int PROCESSOR_ARCHITECTURE_ARM = 5;
public const int PROCESSOR_ARCHITECTURE_IA64 = 6;
public const int PROCESSOR_ARCHITECTURE_ALPHA64 = 7;
public const int PROCESSOR_ARCHITECTURE_UNKNOWN = 0xFFFF;
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 short 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);
}
}
}