Beispiel #1
0
        private static bool Is64BitOperatingSystem()
        {
            if (IntPtr.Size == 8) // 64-bit programs run only on Win64
            {
                return(true);
            }

            // Detect whether the current process is a 32-bit process running on a 64-bit system.
            bool is64;
            bool methodExist = KernelNativeMethods.MethodExists("kernel32.dll", "IsWow64Process");

            return((methodExist && KernelNativeMethods.IsWow64Process(KernelNativeMethods.GetCurrentProcess(), out is64)) && is64);
        }
        private bool Is64BitOperatingSystem()
        {
            if (IntPtr.Size == 8) // 64-bit programs run only on Win64
            {
                return(true);
            }

            try {
                // Detect whether the current process is a 32-bit process running on a 64-bit system.
                bool is64;
                bool methodExist = KernelNativeMethods.MethodExists("kernel32.dll", "IsWow64Process");

                return((methodExist && KernelNativeMethods.IsWow64Process(KernelNativeMethods.GetCurrentProcess(), out is64)) && is64);
            } catch (Exception ex) {
                _log.FormattedWarn(typeof(DefaultEnvironmentInfoCollector), "Unable to get CPU architecture. Error message: {0}", ex.Message);
            }

            return(false);
        }