Beispiel #1
0
        public static bool IsSupportedProcessorArchitecture(string arch)
        {
            if (string.Compare(arch, "msil", StringComparison.OrdinalIgnoreCase) == 0 || string.Compare(arch, "x86", StringComparison.OrdinalIgnoreCase) == 0)
            {
                return(true);
            }
            NativeMethods.SYSTEM_INFO sysInfo = new NativeMethods.SYSTEM_INFO();
            bool flag;

            try
            {
                NativeMethods.GetNativeSystemInfo(ref sysInfo);
                flag = true;
            }
            catch (EntryPointNotFoundException ex)
            {
                Logger.AddInternalState("In IsSupportedProcessorArchitecture: GetNativeSystemInfo API from kernel32.dll is not found.");
                flag = false;
            }
            if (!flag)
            {
                NativeMethods.GetSystemInfo(ref sysInfo);
                Logger.AddInternalState("In IsSupportedProcessorArchitecture: GetSystemInfo called.");
            }
            switch (sysInfo.uProcessorInfo.wProcessorArchitecture)
            {
            case 6:
                return(string.Compare(arch, "ia64", StringComparison.OrdinalIgnoreCase) == 0);

            case 9:
                return(string.Compare(arch, "amd64", StringComparison.OrdinalIgnoreCase) == 0);

            default:
                return(false);
            }
        }
Beispiel #2
0
 public static extern void GetNativeSystemInfo([MarshalAs(UnmanagedType.Struct)] ref NativeMethods.SYSTEM_INFO sysInfo);