From d26ccfdbceec9064c1c8df473b29da67be3b18b2 Mon Sep 17 00:00:00 2001 From: Phyxion <7643972+Phyxion@users.noreply.github.com> Date: Mon, 14 Oct 2019 10:43:04 +0200 Subject: [PATCH] Pr/147 (#149) Thanks to @KyodaiKen --- LibreHardwareMonitorLib/Interop/NvidiaML.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/LibreHardwareMonitorLib/Interop/NvidiaML.cs b/LibreHardwareMonitorLib/Interop/NvidiaML.cs index c05a4ed..ea70501 100644 --- a/LibreHardwareMonitorLib/Interop/NvidiaML.cs +++ b/LibreHardwareMonitorLib/Interop/NvidiaML.cs @@ -12,6 +12,8 @@ namespace LibreHardwareMonitor.Interop internal static class NvidiaML { private const string LinuxDllName = "nvidia-ml"; + private const string WindowsDllName = "nvml.dll"; + private static WindowsNvmlGetHandleDelegate _windowsNvmlDeviceGetHandleByIndex; private static WindowsNvmlGetPowerUsageDelegate _windowsNvmlDeviceGetPowerUsage; private static WindowsNvmlDelegate _windowsNvmlInit; @@ -45,14 +47,15 @@ namespace LibreHardwareMonitor.Interop // windows standard search order for applications. This will // help installations that either have the library in // %windir%/system32 or provide their own library - WindowsDll = Kernel32.LoadLibrary("nvidiaMl.dll"); + WindowsDll = Kernel32.LoadLibrary(WindowsDllName); // If there is no dll in the path, then attempt to load it // from program files if (WindowsDll == IntPtr.Zero) { string programFilesDirectory = Environment.ExpandEnvironmentVariables("%ProgramW6432%"); - string dllPath = Path.Combine(programFilesDirectory, @"NVIDIA Corporation\NVSMI\nvidiaMl.dll"); + string dllPath = Path.Combine(programFilesDirectory, @"NVIDIA Corporation\NVSMI", WindowsDllName); + WindowsDll = Kernel32.LoadLibrary(dllPath); }