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
+1 -1
View File
@@ -162,7 +162,7 @@ namespace OpenHardwareMonitor.Hardware.ATI {
where T : class
{
DllImportAttribute attribute = new DllImportAttribute(dllName);
attribute.CallingConvention = CallingConvention.StdCall;
attribute.CallingConvention = CallingConvention.Cdecl;
attribute.PreserveSig = true;
attribute.EntryPoint = entryPoint;
PInvokeDelegateFactory.CreateDelegate(attribute, out newDelegate);
+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);
}
}
+3 -2
View File
@@ -4,7 +4,7 @@
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) 2010-2011 Michael Möller <mmoeller@openhardwaremonitor.org>
Copyright (C) 2010-2012 Michael Möller <mmoeller@openhardwaremonitor.org>
*/
@@ -75,7 +75,8 @@ namespace OpenHardwareMonitor.Hardware {
private static bool ExtractDriver(string fileName) {
string resourceName = "OpenHardwareMonitor.Hardware." +
(IntPtr.Size == 4 ? "WinRing0.sys" : "WinRing0x64.sys");
(OperatingSystem.Is64BitOperatingSystem() ? "WinRing0x64.sys" :
"WinRing0.sys");
string[] names =
Assembly.GetExecutingAssembly().GetManifestResourceNames();
+1
View File
@@ -92,6 +92,7 @@
<Compile Include="Hardware\LPC\NCT677X.cs" />
<Compile Include="Hardware\Mainboard\GigabyteTAMG.cs" />
<Compile Include="Hardware\Opcode.cs" />
<Compile Include="Hardware\OperatingSystem.cs" />
<Compile Include="Hardware\Ring0.cs" />
<Compile Include="Hardware\KernelDriver.cs" />
<Compile Include="Hardware\Hardware.cs" />