Check if the system is 64 bit.
public Boolean Is64Bit_1() { return System.Environment.GetEnvironmentVariable("ProgramW6432") != ""; } |
Check if specified process is 64 bit.
[System.Runtime.InteropServices.DllImport("kernel32.dll", SetLastError = true, CallingConvention = System.Runtime.InteropServices.CallingConvention.Winapi)] [return: System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool IsWow64Process([System.Runtime.InteropServices.In] IntPtr hProcess, [System.Runtime.InteropServices.Out] out Boolean lpSystemInfo); public Boolean Is64Bit_2() { Boolean ret = false; IsWow64Process(System.Diagnostics.Process.GetCurrentProcess().Handle, out ret); return ret; } |