Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix support for Nvidia and Battery when running as a 32-bit process #1144

Merged

Conversation

coreyshuman
Copy link
Contributor

This PR fixes two issues related to LibreHardwareMonitorLib running as a 32-bit process:

  • Nvidia GPU support would not work when the process ran through Windows x86 emulation on a 64-bit machine.
  • Battery monitoring would not work on native or emulated 32-bit machines.

For the Nvidia case, the app must load the correct NvAPI DLL depending on if the application is running as a 32- or 64-bit process. Nvidia ships both versions of the DLL for their drivers on 64-bit Windows, so this change allows for maximum compatibility.

This issue was encounter by myself and by another user as reported here:
#987

Nvidia support used to work on x86 emulation but was broken in this commit when the DLLExists() function was added.
47f33f9
There wasn't much context provided in this commit so I can't be sure if these changes were intentional to fix some other issue that I haven't encountered. If there are other edge cases, let me know and I'm happy to look into them.

For the Battery fix, the call to SetupDiGetDeviceInterfaceDetail expects a cbSize value of 8 on 64-bit machines and 4 + 2 on 32-bit machines using Unicode. Here are some references discussing this:
https://stackoverflow.com/a/9247377/15588729
http://www.janaxelson.com/forum/index.php?topic=656.0

I verified the following cases with these changes:

  • 64-bit process running on a 64-bit OS
  • 32-bit process running on a 64-bit OS
  • 32-bit process running on a 32-bit OS

Here is a screenshot showing an RTX GPU working with these changes. The left window is a 32-bit process, which would not show the GPU at all without these changes. The right window is a 64-bit process. Note there are differences in the supported sensors because NvidiaML does not support 32-bit.

libre x86 on left

@PhyxionNL PhyxionNL merged commit 6743fd3 into LibreHardwareMonitor:master Aug 24, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants