コード例 #1
0
        private static bool Is32BitProcessOn64BitProcessor()
        {
            OSVersionInfo.IsWow64ProcessDelegate wow64ProcessDelegate = OSVersionInfo.GetIsWow64ProcessDelegate();
            bool isWow64Process;

            if (wow64ProcessDelegate == null || !wow64ProcessDelegate(Process.GetCurrentProcess().Handle, out isWow64Process))
            {
                return(false);
            }
            return(isWow64Process);
        }
コード例 #2
0
        private static OSVersionInfo.IsWow64ProcessDelegate GetIsWow64ProcessDelegate()
        {
            IntPtr hwnd = OSVersionInfo.LoadLibrary("kernel32");

            if (hwnd != IntPtr.Zero)
            {
                IntPtr procAddress = OSVersionInfo.GetProcAddress(hwnd, "IsWow64Process");
                if (procAddress != IntPtr.Zero)
                {
                    return((OSVersionInfo.IsWow64ProcessDelegate)Marshal.GetDelegateForFunctionPointer(procAddress, typeof(OSVersionInfo.IsWow64ProcessDelegate)));
                }
            }
            return((OSVersionInfo.IsWow64ProcessDelegate)null);
        }
コード例 #3
0
 private static bool IsWindows10()
 {
     return(OSVersionInfo.RegistryRead("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "ProductName", "").StartsWith("Windows 10", StringComparison.OrdinalIgnoreCase));
 }