Skip to content

Instantly share code, notes, and snippets.

@pnp0a03
Created March 16, 2019 04:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pnp0a03/3af5127162b5f9816e9098d8f702e88f to your computer and use it in GitHub Desktop.
Save pnp0a03/3af5127162b5f9816e9098d8f702e88f to your computer and use it in GitHub Desktop.
Using GetNativeSystemInfo from UWP app
[DllImport("api-ms-win-core-sysinfo-l1-2-3.dll")]
static extern void GetNativeSystemInfo(ref SYSTEM_INFO lpSystemInfo);
[StructLayout(LayoutKind.Sequential)]
public struct SYSTEM_INFO
{
public ushort processorArchitecture;
ushort reserved;
public uint pageSize;
public IntPtr minimumApplicationAddress;
public IntPtr maximumApplicationAddress;
public IntPtr activeProcessorMask;
public uint numberOfProcessors;
public uint processorType;
public uint allocationGranularity;
public ushort processorLevel;
public ushort processorRevision;
}
...
var si = new SYSTEM_INFO();
GetNativeSystemInfo(ref si);
Windows.System.ProcessorArchitecture at = (Windows.System.ProcessorArchitecture)si.processorArchitecture;
string architecture = at.ToString();
if( 12 == (int)at)
{
architecture = "Arm64";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment