Fix support for Nvidia and Battery when running as a 32-bit process #1144
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes two issues related to LibreHardwareMonitorLib running as a 32-bit process:
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 acbSize
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:
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.