创建systeminfo结构 [StructLayout(LayoutKind.Sequential)] public struct SYSTEM_INFO { internal short wProcessorArchitecture; internal short wReserved; internal int dwPageSize; internal IntPtr lpMinimumApplicationAddress; internal IntPtr lpMaximumApplicationAddress; internal IntPtr dwActiveProcessorMask; internal int dwNumberOfProcessors; internal int dwProcessorType; internal int dwAllocationGranularity; internal short wProcessorLevel; internal short wProcessorRevision; } 判断方法 private const short PROCESSOR_ARCHITECTURE_INTEL = 0; private const short PROCESSOR_ARCHITECTURE_IA64 = 6; private const short PROCESSOR_ARCHITECTURE_AMD64 = 9; private const int PROCESSOR_ARCHITECTURE_UNKNOWN = 0x00FFFF; [DllImport("kernel32.dll")] static extern void GetNativeSystemInfo(out SYSTEM_INFO lpSystemInfo); bool IsPlatformX64() { SYSTEM_INFO sysinfo=new SYSTEM_INFO(); var s_OK = false ; GetNativeSystemInfo(out sysinfo); switch (sysinfo.wProcessorArchitecture) { case PROCESSOR_ARCHITECTURE_IA64: s_OK = true; break; case PROCESSOR_ARCHITECTURE_AMD64: s_OK = true; break; default: s_OK = false; break; } // if (sysinfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64 | sysinfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) //{ // s_OK = true; // } return s_OK; }