diff --git a/LibreHardwareMonitorLib/Hardware/Battery/BatteryGroup.cs b/LibreHardwareMonitorLib/Hardware/Battery/BatteryGroup.cs index 562833f..4cdc35c 100644 --- a/LibreHardwareMonitorLib/Hardware/Battery/BatteryGroup.cs +++ b/LibreHardwareMonitorLib/Hardware/Battery/BatteryGroup.cs @@ -52,7 +52,7 @@ internal class BatteryGroup : IGroup if (Marshal.GetLastWin32Error() == SetupApi.ERROR_INSUFFICIENT_BUFFER) { IntPtr pdidd = Kernel32.LocalAlloc(Kernel32.LPTR, cbRequired); - Marshal.WriteInt32(pdidd, Environment.Is64BitOperatingSystem ? 8 : 4); // cbSize. + Marshal.WriteInt32(pdidd, Environment.Is64BitProcess ? 8 : 4 + Marshal.SystemDefaultCharSize); // cbSize. if (SetupApi.SetupDiGetDeviceInterfaceDetail(hdev, did, diff --git a/LibreHardwareMonitorLib/Interop/NvApi.cs b/LibreHardwareMonitorLib/Interop/NvApi.cs index b96705a..1a51268 100644 --- a/LibreHardwareMonitorLib/Interop/NvApi.cs +++ b/LibreHardwareMonitorLib/Interop/NvApi.cs @@ -218,7 +218,7 @@ internal static class NvApi private static void GetDelegate(uint id, out T newDelegate) where T : class { - IntPtr ptr = Environment.Is64BitOperatingSystem ? NvAPI64_QueryInterface(id) : NvAPI32_QueryInterface(id); + IntPtr ptr = Environment.Is64BitProcess ? NvAPI64_QueryInterface(id) : NvAPI32_QueryInterface(id); if (ptr != IntPtr.Zero) newDelegate = Marshal.GetDelegateForFunctionPointer(ptr, typeof(T)) as T; @@ -228,7 +228,7 @@ internal static class NvApi public static bool DllExists() { - IntPtr module = Kernel32.LoadLibrary(Environment.Is64BitOperatingSystem ? DllName64 : DllName); + IntPtr module = Kernel32.LoadLibrary(Environment.Is64BitProcess ? DllName64 : DllName); if (module == IntPtr.Zero) return false;