Fixed Issue 274. Fixed Issue 107.

This commit is contained in:
Michael Möller
2012-07-11 22:28:39 +00:00
parent 028248273b
commit 4026c56ba0
4 changed files with 43 additions and 3 deletions
+38
View File
@@ -0,0 +1,38 @@
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
Copyright (C) 2012 Michael Möller <mmoeller@openhardwaremonitor.org>
*/
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace OpenHardwareMonitor.Hardware {
internal static class OperatingSystem {
public static bool Is64BitOperatingSystem() {
if (IntPtr.Size == 8)
return true;
try {
bool wow64Process;
bool result = IsWow64Process(
Process.GetCurrentProcess().Handle, out wow64Process);
return result && wow64Process;
} catch (EntryPointNotFoundException) {
return false;
}
}
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool IsWow64Process(IntPtr hProcess,
out bool wow64Process);
}
}