Commit Graph
37 Commits
Author SHA1 Message Date
Nick Babcock 297bbff5cf Prefer load nvml from standard search order (#97)
Currently it is assumed that `nvml.dll` is located in

```
%ProgramW6432%\NVIDIA Corporation\NVSMI\nvml.dll
```

Not everyone has it installed there. Those that have the nvidia drivers
installed through windows updates will have it in in
`%WINDIR%\system32\nvml.dll` and won't have anything under the "NVSMI"
directory.

Instead of hard coding `%WINDIR%\system32\nvml.dll` as a search
location, we can load whatever `nvml.dll` appears first in the search
order:

```csharp
LoadLibrary("nvml.dll")
```

From [Standard Search Order for Desktop
Applications](https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order#standard-search-order-for-desktop-applications):

> 1. The directory from which the application loaded.
> 1. The system directory. Use the GetSystemDirectory function to get the path of this directory.
> 1. The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched.
> 1. The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
> 1. The current directory.
> 1. The directories that are listed in the PATH environment variable. Note that this does not include the per-application path specified by the App Paths registry key. The App Paths key is not used when computing the DLL search path.

`%WINDIR%\system32` is the system directory and thus `nvml.dll` is loaded.

This will also allow those interested to override the `nvml.dll` by
placing their own in the current directory as LibreHM without effecting
a system installation.

Only if there is no `nvml.dll` in the search space does LibreHM fallback
to searching program files. This may technically be a breaking change
for those that have `nvml.dll` in both the search space (like
`%WINDIR%\system32\nvml.dll`) and `%ProgramW6432%\NVIDIA
Corporation\NVSMI\nvml.dll` and those files differ. I don't suspect this
to be a common occurrence.

If this is expected to be a common occurrence I can switch the logic such
that program files is checked before the standard search space, though
this would make it so one couldn't override the program files
`nvml.dll`.

Tested it and works great so far!
2019-07-09 12:59:10 +02:00
MmAaXx500 e0ad20819b Fix 'PInvokeStackImbalance' in NVAPI.cs (#88) 2019-05-10 21:36:59 +02:00
Campbell 98969ebc3e Added basic Nvidia NVML library support and power usage sensor (#60)
* Added basic Nvidia NVML library support and power usage sensor

* Added basic Nvidia NVML library support and power usage sensor

* Added Initialised check

* Made NvmlDevice internal

* Code formatting

* Move NvmlDevice and NvmlReturn to separate files

* Move code from NvidiaNVMLGPU class to NvidiaGPU class

* Replace call to SetDllDirectory with LoadLibrary/FreeLibrary and code formatting changes

* Made native methods private

* Fixed p/invoke definitions, removed unnecessary try/catch blocks. Code style cleanup
2019-01-27 10:34:04 +01:00
Michal 5d89cdc43d Cleanup around base collection types. (#59)
* Hardware in IGroup is now IEnumerable. No point to call ToArray each time.

* Use ValueTuple insead of custom pair.

* ListSet -> HashSet

* Ring Collection -> List

* ReadOnlyArray -> ReadOnlyList
2018-10-30 14:44:41 +01:00
LORDofDOOM ba6e3bf253 [Core] netstandard support, drop PInvokeDelegateFactory and replace with direct dll calls in ADL.cs, NVAPI.cs, FTD2XX.cs, create project and solution file for netstandard, add compiler option in KernelDriver.cs and Ring0.cs - These options are not required for library mode. netstandard is not default for library - If compiled as usual anything works as in previous versions 2017-11-13 23:20:14 +01:00
Michael Möller 9be5da3e0b Merge branch 'Nvidia VRAM AddOn' 2016-11-06 12:29:42 +01:00
Michael Möller 4f87cc3bb4 Corrected the source code format. 2016-11-06 12:15:29 +01:00
DarthDestroyer 51c6d776e1 Update NvidiaGPU.cs 2016-04-28 19:59:52 +02:00
Michael Möller 5dfad04b31 Fixed issue #701. Writing temporary 0 values to the sensor (NVIDIA GPU clocks) gets them recorded and leads to wrong sensor min values and wrong recorded/averaged values for plotting. 2015-12-06 19:42:58 +01:00
DarthDestroyer d7a7ccd1bc VRAM used / free / total as Value? #753 2015-12-06 17:20:03 +01:00
Michael Möller bf8d491ef2 Fixed Issue 651. 2014-12-30 21:04:54 +00:00
Michael Möller dc69a9431c Added a new "Undefined" control mode. Changed the GPU fan control to restore to default (auto) settings when the Open Hardware Monitor closes (unless the control remained in "Undefined" mode). 2014-12-30 16:02:52 +00:00
Michael Möller 2e3489e1f7 Changed the license to the Mozilla Public License 2.0 and update the licensing information. 2012-05-27 14:23:31 +00:00
Michael Möller a5ff8ac69b Fixed Issue 209. 2012-01-15 15:35:03 +00:00
Michael Möller 58f6092983 Added fan control for Nvidia GPUs based on a patch by Christian Vallières. 2011-07-07 21:53:09 +00:00
Michael Möller 330e93ea64 Added support for saving and restoring the sensor history for the last 24h. The sensor history is now saved in a reduced format (duplicate values are removed, gaps are marked with a NAN sensor value. 2011-06-19 12:41:18 +00:00
Michael Möller 6e86c9e1a9 Fixed Issue 199. 2011-04-30 16:03:58 +00:00
Michael Möller bcde768e25 Refactored some of the hardware monitoring code and fixed a few code inspection warnings. 2010-09-21 20:32:36 +00:00
Michael Möller 7752670742 Fixed some Code Analysis warnings. 2010-09-08 19:29:58 +00:00
Michael Möller 39600d1cf3 Added a desktop gadget implementation. 2010-09-06 19:53:13 +00:00
Michael Möller 2071610bbe Fixed some Code Analysis warnings. 2010-08-15 14:46:58 +00:00
Michael Möller 2ec18bf862 Changed the project files to Visual Studio 2010. Fixed some Code Analysis warnings. 2010-08-12 20:53:27 +00:00
Michael Möller a2650ba983 Refactored the hardware monitoring code into a library (Issue 101). 2010-08-08 13:57:26 +00:00
Michael Möller e30e42ebf0 Improved the support for Nvidia GPUs. 2010-06-27 10:24:27 +00:00
Michael Möller dd67a0aa5c Fixed Issue 69. 2010-06-06 11:07:57 +00:00
Michael Möller ea228677db Fixed an EntryPointNotFoundException in the NVAPI wrapper:
System.EntryPointNotFoundException: Não é possível localizar um ponto de entrada denominado 'nvapi_QueryInterface' na DLL 'nvapi.dll'.
   em PInvokeDelegateFactoryInternalWrapperType38.nvapi_QueryInterface(UInt32 id)
   em OpenHardwareMonitor.Hardware.Nvidia.NVAPI.GetDelegate[T](UInt32 id, T& newDelegate)
   em OpenHardwareMonitor.Hardware.Nvidia.NVAPI..cctor()
2010-05-18 19:16:55 +00:00
Michael Möller 9b0113e6b0 Fixed the following NullReferenceException:
System.NullReferenceException: 
   in OpenHardwareMonitor.Hardware.Nvidia.NvidiaGroup..ctor()
   in OpenHardwareMonitor.Hardware.Computer.Open()
   in OpenHardwareMonitor.GUI.MainForm..ctor()
   in OpenHardwareMonitor.Program.Main()
2010-05-15 11:20:50 +00:00
Michael Möller 4cd9cd9125 Refactored the hardware code and added the visitor pattern for operations on the computer/hardware/sensor/parameter tree. 2010-05-09 16:22:13 +00:00
Michael Möller a49919717e Added an Identifier class for IHardware, ISensor and IParameter Identifier properties. 2010-05-06 19:20:38 +00:00
Michael Möller 160f0bd783 Fixed a few more crash causing bugs. 2010-04-26 19:22:42 +00:00
Michael Möller 4248689d75 NVAPI interop struct packing improved. 2010-02-22 20:54:49 +00:00
Michael Möller 2cde9eff61 Fintek super I/O chips with base address 0x..5 are detected now as well. Set Pack = 1 for NVAPI struct interop (should fix GPU enumeration). 2010-02-22 09:57:02 +00:00
Michael Möller bcb19ae527 Improved Winbond temperature reading. Temperatures create by adding PECI Agent values (delta to TCC Activation Temperature) to a (possibly uncalibrated) TBase are not read. Direct reading temperatures from sensor report register if available. Added lower bound for temperatures on Winbond chips. Nvidia GPUs are now displayed even if they do not have any sensors. 2010-02-20 19:51:10 +00:00
Michael Möller 0cc5a578c3 Added support for NVIDIA fan rpm. Changed NVIDIA GPU enumeration. 2010-02-09 19:42:33 +00:00
Michael Möller 2e34c0a7b0 Added NVAPI report output. 2010-02-08 20:23:24 +00:00
Michael Möller 8fc7a41776 Release version 0.1.2. First implementation for Fintek F71882FG chips. Fixed Intel Core i7 temperature reading. Changed Nvidia GPU enumeration. 2010-01-28 23:29:39 +00:00
Michael Möller 39ca26510c Initial commit. 2010-01-26 22:37:48 +00:00