Define:
[DllImport("kernel32.dll")]
internal static extern void GetNativeSystemInfo(ref SystemInfo lpSystemInfo);
[DllImport("kernel32.dll")]
internal static extern void GetSystemInfo(ref SystemInfo lpSystemInfo);
[StructLayout(LayoutKind.Sequential)]
internal struct SystemInfo
{
public ushort wProcessorArchitecture;
public ushort wReserved;
public uint dwPageSize;
public IntPtr lpMinimumApplicationAddress;
public IntPtr lpMaximumApplicationAddress;
public UIntPtr dwActiveProcessorMask;
public uint dwNumberOfProcessors;
public uint dwProcessorType;
public uint dwAllocationGranularity;
public ushort wProcessorLevel;
public ushort wProcessorRevision;
}
internal const ushort ProcessorArchitectureIntel = 0;
internal const ushort ProcessorArchitectureIa64 = 6;
internal const ushort ProcessorArchitectureAmd64 = 9;
internal const ushort ProcessorArchitectureUnknown = 0xFFFF;
GetNativeSystemInfo will return you info about the machine you're running on.
GetSystemInfo will return you info about the virtualised environment you're running within (which will be the same as GetNativeSystemInfo if there isn't one).
I.e:
On 32 bit Windows, you will have wProcessorArchitecture == ProcessorArchitectureIntel always.
On 64 bit Windows, you will have wProcessorArchitecture == ProcessorArchitectureIntel for GetSystemInfo, but wProcessorArchitecture == ProcessorArchitectureAmd64 for GetNativeSystemInfo, if you are running as a 32 bit process.
They will obviously both be ProcessorArchitectureAmd64 if you're a 64 bit process on 64 bit Windows.