@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user