Commit Graph
73 Commits
Author SHA1 Message Date
MadLongTomandPhyxionNL aa7c8be02f feat: Add Native AOT compilation support for LibreHardwareMonitorLib (#2280)
* feat: Add Native AOT compilation support for LibreHardwareMonitorLib

- Replace non-generic Marshal.GetDelegateForFunctionPointer with generic versions
  (NvApi.cs, NvidiaML.cs, OpCode.cs)
- Replace non-generic Marshal.PtrToStructure/SizeOf with generic versions
  (AtiAdlxx.cs, AmdGpu.cs, Ipmi.cs)
- Replace reflection-based Mono.Posix calls with direct Syscall for non-NETFRAMEWORK
  (OpCode.cs)
- Add DynamicallyAccessedMembers annotations for trim-safe generic marshaling
  (MsiCoreLiquidController.cs, WireViewPro2.cs)
- Add IsAotCompatible, IsTrimmable, and AOT/trim analyzers to csproj for net8.0+
- All changes maintain full backward compatibility with net472/netstandard2.0

Tested: dotnet publish with PublishAot=true on net10.0 win-x64 succeeds.
AOT binary correctly enumerates all hardware and sensors without errors.

* feat: Add conditional compilation for .NET 5.0 or greater in various classes

* feat: Add AOT test project and update workflows for AOT compilation

* Drop test project

* NET5_0_OR_GREATER > NET

---------

Co-authored-by: PhyxionNL <7643972+PhyxionNL@users.noreply.github.com>
2026-04-07 13:38:41 +02:00
Blacktempel 44d3263b27 Support new firmware and fix possible freeze. (#2261) 2026-03-09 12:52:11 +01:00
Blacktempel 273b47b462 Fix build for Linux (#2257)
* Fix build for Linux.

* Fix Linux runtime issues.

* PR review + fix for Windows.
2026-03-05 14:09:21 +01:00
Blacktempel 315a767fa0 Fix same memory for different GPUs. (#2232)
* Fix same memory for different GPUs.

* Status check
2026-02-19 16:21:49 +01:00
kyranmcdonnellandCursor 1564a69c52 fix: skip integrated GPU in IGCL enumeration to prevent duplicate hardware entries (#2217)
IGCL's ctlEnumerateDevices returns all Intel graphics devices including
the integrated GPU, but IntelDiscreteGpu was created for every device
without filtering. This caused the iGPU to appear twice: once from the
IGCL path (as IntelDiscreteGpu) and once from the D3D path (as
IntelIntegratedGpu), with overlapping sensors.

Check the CTL_ADAPTER_PROPERTIES_FLAG_INTEGRATED flag on each device's
graphics_adapter_properties and skip integrated adapters, since they are
already handled by IntelIntegratedGpu via D3D enumeration.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-13 18:16:37 +01:00
Blacktempel e2e0d1c9ad Updates for TG WVP2 (#2215)
* Implement Fan control for TG WVP2.
Calculate approximate fan speed.

Catch two exceptions.
Remove leftover close in ReadConfig.

* Support for multi device detection

* Add more data to report

* Add group for power monitors and remove from GenericGpu.

* Move files.
Add option for Power Monitor in Computer + UI.
2026-02-13 18:15:24 +01:00
Blacktempel cdb0c65b4c TG WireView Pro 2: Changes for firmware update (#2193)
* Changes for firmware update.

* Undo SharedSerialPort.Open signature change.
2026-02-03 11:46:37 +01:00
BlacktempelandPhyxionNL df9e0a5131 Add support for Thermal Grizzly WireView Pro 2. (#2171)
* Add support for Thermal Grizzly WireView Pro 2.

* Process PR comments.

* PR comments.

* Add private keyword.

* PR comments.

* Replace WMI with SetupAPI.

Some first updates according to Thermal Grizzly code.

* Add report.

* Further improve implementation according to code of Thermal Grizzly (thanks !).

* No connection check for welcome message.

* Rename class + change SerialPort to SharedSerialPort for guard - fixing mutex issues.

* PR comments.

* Remove SP_DEVINFO_DATA from NativeMethods.txt

* Update WireViewPro2.cs

* Rename hasMutex to _hasMutex for consistency

* Formatting

* Fix build

---------

Co-authored-by: PhyxionNL <7643972+PhyxionNL@users.noreply.github.com>
2026-01-27 13:20:07 +01:00
TimotejandPhyxionNL 6f9ac5aece Add sensors for Astral GPUs (#2168)
* Add sensors for Astral GPUs

* Clean up imports

* Code clean-up

---------

Co-authored-by: PhyxionNL <7643972+PhyxionNL@users.noreply.github.com>
2026-01-22 10:00:23 +01:00
Blacktempel 24218b0703 Add core voltage for NVIDIA GPU. (#2175) 2026-01-20 17:21:06 +01:00
Blacktempel c542e856d4 Replace Storage implementation with CrystalDiskInfo based implementation (#2015)
* Replace Storage implementation with CrystalDiskInfo based implementation.

* Formatting.

* Code review.

* Code review.

* Increase space for attribute name in report.

* Implement dynamic disk handling for usage sensor.

Disable unused warnings.

* Further cleanup in NativeMethods.txt and referenced.
2025-11-08 10:53:43 +01:00
PhyxionNL 2bbecff220 Fix build 2025-10-09 21:23:05 +02:00
Carlos BederiánandPhyxionNL fe9857c2ed Intel discrete GPU support (#1822)
* Intel discrete GPU support through Intel GCL library

* Formatting

---------

Co-authored-by: PhyxionNL <7643972+PhyxionNL@users.noreply.github.com>
2025-10-09 20:11:02 +02:00
PhyxionNL e2227e2d94 Fixes #1919 2025-10-01 10:42:01 +02:00
PhyxionNL d594734225 Move remainder to CsWin32 (#1918) 2025-09-30 18:58:21 +02:00
PhyxionNL 1d7b3223c9 Move more to CsWin32 (#1917) 2025-09-30 16:50:44 +02:00
PhyxionNLandCopilot ee60348eac Use CsWin32 (#1912)
* Use CsWin32

* Update LibreHardwareMonitorLib/Hardware/Cpu/CpuLoad.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update LibreHardwareMonitorLib/Hardware/Battery/BatteryGroup.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update pull requests.yml

* Update pull requests.yml

* Update master.yml

* A couple more to CsWin32

* Restore PawnIO defaults

Fixes #1910

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-09-29 18:48:00 +02:00
Teemu KorhonenandPhyxionNL c56cf3f042 Use PawnIO driver directly in LibreHardwareMonitorLib (#1908)
* Use PawnIO driver directly.

- Implemented PawnIO library in C#
- Builds in AnyCPU, x64 and x86
- Fixes #1895

* Implement review changes for PawnIO.

- Use existing Kernel32.CreateFile import.
- Move new DeviceIOControl to Kernel32.
- Replace Lazy Version loading with static property.
- Remove bin resource cache.
- Add constant for function name length.

* More review changes for PawnIO.

- Replace redundant internal checks with IsLoaded.
- Convert Win32 error code to HRESULT before returning it in
  ExecuteHR()

* Drop KernelDriver

---------

Co-authored-by: PhyxionNL <7643972+PhyxionNL@users.noreply.github.com>
2025-09-29 16:41:57 +02:00
辉夜andPhyxionNL 3023089017 Changed NvApi lifecycle (#1885)
* Changed NvApi lifecycle

* Changed from public to internal

* Revert unnecessary changes.
Reinitialize() -> Initialize().

* Refactor try-catch blocks for NVML device methods

---------

Co-authored-by: PhyxionNL <7643972+PhyxionNL@users.noreply.github.com>
2025-09-26 10:34:20 +02:00
namazsoandPhyxionNL eb5e1a20be Swap WinRing0 to PawnIO (#1857)
* Replace WinRing0 with PawnIO

* Update RAMSPDToolkit

* Add install check + cleanup

* Move folder + formatting

* Add back missing TryLoadDll

* Update PawnIo.cs

* Add third party notices file

* Remove the how to apply section

* Drop silent

* Don't crash if PawnIO isn't installed

* Formatting

---------

Co-authored-by: PhyxionNL <7643972+PhyxionNL@users.noreply.github.com>
2025-09-16 11:58:31 +02:00
BlacktempelandPhyxionNL 5027bd9d57 Add DIMM Temperature to LHM. (#1743)
* Add DIMM Temperature to LHM.

* Remove RAMSPDToolkit as submodule and use nuget package instead.
Upgrade System.Management assembly (required for nuget package).
Implement retry mechanism for RAM detection due to possible issue at system boot.

* Change to static field.

* Driver now back in LHM.
Ring0 replaced with OLS implementation.

* Update package version.

* Undo most of changes.
Implement IDriver interface.

* Change package to new one.

* Review changes.
Explicitly set UseWMI (current default is also false).

* PR comments:
Now having one DimmMemory instance per RAM stick.
Separated memory sensors into two new classes.

* PR feedback

---------

Co-authored-by: PhyxionNL <7643972+PhyxionNL@users.noreply.github.com>
2025-06-23 11:31:17 +02:00
Blacktempel 9cefa1c93a Samsung NVME now being detected properly. (#1762) 2025-06-21 15:04:31 +02:00
EMN-CSharp 4961d4f0a4 Improvements to battery monitoring (#1158)
* Check whether battery values are available

* Rename _degradationPercentage to _degradationLevel

* Add support for temperature monitoring

* Include the battery device name and tag in the hardware identifier

* Set sensor index value properly

* Fix temperature conversion

The returned temperature value must be divided, not multiplied.

* Disable sensors that have a "null" value

* Fix random symbols in battery device name and manufacturer
2024-11-24 11:49:46 +01:00
sebastian-dev b665144692 Direct3D Bugfix (#1472)
https://github.com/LibreHardwareMonitor/LibreHardwareMonitor/issues/1251
wrong structure definition, only had an effect in 32 bit mode
2024-09-27 11:25:41 +02:00
Emerson Pinter 3959e8e3c0 Fix AMD Overdrive, update ADL methods to ADL2 variants (#1332)
After the change of ADL2_Main_Control_Create in commit 07234e3,
overdrive api checks and sensors broke. Updating to ADL2_ variants fixes
the problem.
2024-05-15 19:21:11 +02:00
Emerson Pinter 92bfa55f12 Add memory info for Amd GPUs (#1326)
* Add DedicatedVideoMemorySize to D3D

* Add memory info for Amd GPUs
2024-05-02 23:55:39 +02:00
Emerson Pinter 07234e3594 Avoid multiple initializations of AmdGpu (#1324)
ADL finds multiple logical gpus, this commit avoids multiple
unneeded initializations of AmdGpu class. The main control is moved to
AmdGpuGroup and the ADL_* calls are updated to ADL2_*, using the
context. Adapters using PMlog should be initialized only if sensors are
detected, adapters that pmlog is not enabled or doesn't work, should
fallback previous logic.
2024-05-02 21:42:22 +02:00
Emerson PinterandPhyxionNL 0c3ebb1933 Refactor ADL sensors update (#1317)
* Refactor ADL sensors update

- Check support for each sensor, on OD8 and new PMLog.
- Exclude cards before Vega10 from using PMLog
- Better validation for individual sensor support (for now asic-power/board-power)
- Validate pmlog struct using the lastUpdate, there are situations the
  sensors values are corrupted, maybe because something blocking the pointer access to
  the struct, but this needs to be verified.

* Update AmdGpu.cs

---------

Co-authored-by: PhyxionNL <7643972+PhyxionNL@users.noreply.github.com>
2024-04-27 13:47:50 +02:00
Emerson PinterandPhyxionNL 331d334aef Add ADL pmlog support, fix metrics on newer gpus (#1308)
* Add ADL pmlog support, fix metrics on newer gpus

Newer GPUs needs this to show performance metrics properly. Sample rate
is hard coded (1000ms).

* Clean up

---------

Co-authored-by: PhyxionNL <7643972+PhyxionNL@users.noreply.github.com>
2024-04-09 11:00:16 +02:00
Iksas 20b7394e96 fix heap corruption caused by incorrect pointer size in calls to Ftd2xx.dll (#1302) 2024-03-28 19:34:52 +01:00
sebastian-dev ea5d28166c Bugfix: Crash when access to nvml api is unavailable (#1252) 2024-03-25 17:08:15 +01:00
dde9e52823 reading the proposed Total Board Power for RX 7000 Cards (#1123)
* reading the proposed Total Board Power for RX 7000 Cards

* undo requested changes

* Update AmdGpu.cs

---------

Co-authored-by: Peter Hindelang <PHindelang@artiso.com>
Co-authored-by: PhyxionNL <7643972+PhyxionNL@users.noreply.github.com>
2023-08-31 10:14:40 +02:00
Corey Shuman 6743fd3bc8 fix support for x86 32-bit process builds (#1144) 2023-08-24 10:26:38 +02:00
PhyxionNL 77f2e4b399 Don't request all access for OpenSCManager 2023-03-23 10:46:55 +01:00
PhyxionNL e236d7c9a0 Add support for IPMI sensors and Supermicro IPMI fan control (#1024)
* Add support for IPMI sensors and Supermicro IPMI fan control

Closes #958, thanks to @lukefor
2023-03-21 19:14:10 +01:00
PhyxionNL 50d7adb9ba Fixes #948 2023-03-15 19:11:17 +01:00
PhyxionNL 76245c9a32 Read storage performance sensors without WMI 2023-03-15 18:00:38 +01:00
Arnold Vink 6a1a28a893 Fix for Windows 11 22H2 (22621) incorrect total CPU load issue. (#933)
* Fix for Windows 11 22H2 (22621) incorrect total CPU load issue.

* Fix for Windows 11 22H2 (22621) incorrect total CPU load issue.
2022-12-19 18:55:10 +01:00
PhyxionNL c4ec54e1cf Thread affinity
Don't set thread affinity in IsValid.
Remove SetThreadAffinityMask fallback as SetThreadGroupAffinity is available in W7 and up.
2022-11-07 15:00:44 +01:00
PhyxionNL 58cef111a1 Use file-scoped namespaces (#842) 2022-10-09 13:22:57 +02:00
PhyxionNL 3ac329f247 Fix some code analysis issues (#841) 2022-10-09 13:16:31 +02:00
PhyxionNL 38b97e10d0 Update editorconfig + changes (#771) 2022-06-29 19:38:57 +02:00
PhyxionNL 47f33f91d9 Update Interop
[ci skip]
2022-06-29 18:17:49 +02:00
EMN-CSharp 8d8d84af22 Add battery remaining time sensor (#660) 2022-02-11 19:41:56 +01:00
EMN-CSharp 5152b435fc Add support for battery monitoring (#612)
Thanks to @EMN-CSharp.
2022-02-07 17:05:36 +01:00
Tim Sirmovics 1701eb91b2 Nvidia Hotspot / VRAM temps (#583)
Thanks to @TimSirmovics
2021-10-27 16:34:07 +02:00
Pomian 3cf5fe92fd [Feature] Update library documentation (#580)
* Minor IHardware doc fixes

* Add XML with documentation to NuGet and output

* Update Software namespace docs

* Update some internal classes

* Update main Computer class docs

* Update interfaces docs

* Update Computer class documentation

* Update motherboard docs

* Update hardware docs

* Fix code formatting

* Update SensorVisitor handler doc
2021-10-18 13:23:43 +02:00
PhyxionNL 8c01e4b21b NV API changes (#553)
* NV API changes

Restores parts of https://github.com/LibreHardwareMonitor/LibreHardwareMonitor/commit/eea8558825cc0d5a76aa3e57fcc862b5d6f22100 while implementing the missing bits from the original implementation.

Fixes #524.
2021-09-29 11:34:13 +02:00
javguit 0fd00e27bb Fixed compatibility with older AMD/ATI cards when calling ADL2_Adapter_FrameMetrics_Caps (#535) 2021-09-10 11:02:39 +02:00
PhyxionNL eea8558825 Use NvAPIWrapper (#479)
From https://github.com/falahati/NvAPIWrapper
2021-06-21 19:02:10 +02:00