EVGA

EVGA Precision v1.2.0.0 not escaping path variables properly

Author
Coldblackice
New Member
  • Total Posts : 65
  • Reward points : 0
  • Joined: 2010/08/08 03:48:29
  • Status: offline
  • Ribbons : 0
2021/05/29 08:26:06 (permalink)
Although Precision X1 v1.2.0.0 claims to fix the "missing nvml.dll" error, I still receive the error after reinstalling. I know how to manually bypass it, but for any future others' sake, I rolled up my debugging sleeves and watched it with procmon --
 
The gist of the problem is when Precision goes looking for nvml.dll, Precision doesn't properly "escape" separation between system/user path variables when it transitions to checking hardcoded locations for nvml.dll, namely "C:\Program Files\NVIDIA Corporation\NVSMI". Here's the location Precision tries to access that folder at:
 

 
You can see Precision is concatenating the last USER path location with this folder, and obviously won't find it there. I first thought maybe Precision was tripping up on a character in my (extensive) path, but two hours of path mangling and debugging later, I've found the actual source is Precision not properly handling registry value data type "REG_EXPAND_SZ":
 

 
 
Windows 10 automatically converts an environment variable (like "Path") from "REG_SZ" type to "REG_EXPAND_SZ" if an expandable environment variable is used anywhere within it. I first thought maybe Precision wasn't properly handling expandable env variables, but testing showed it could: I edited the registry paths directly, sidestepping Windows automatically changing types via System Properties/Settings, and then added expandable env variables to the paths: Precision properly understood and found those locations.
 
So that left the REG_EXPAND_SZ type. The issue is that Precision loses the final semicolon on the last USER path location and doesn't know where that path ends and the first hardcoded directory begins:
 

 
This can be sidestepped by inserting an additional semicolon at the end of the final USER path variable (i.e., when the jump to hardcoded locations begins), however, this can't be done through Windows system properties dialogs since it won't allow a double semicolon, it will instead convert it to a string and semicolon the string, which Precision will trip up on. Only if you manually edit the registry path variable directly and add the double semicolon does it work, like so:
 

 
All this wind aside, the real solution is a Precision update so it can properly handle the type/path variable splitting and not lose that final semicolon when REG_EXPAND_SZ type is used.
 
tl;dr
If you get the "Can't find nvml.dll" error, find and copy the .dll into any directory of your path ...besides the final directory of the User path! Just note it's not good form to be adhoc pasting random .dll's for one off purposes into misc. path locations just to jury-rig something to work, since that floating .dll won't ever get updated unless you manually remember to update it yourself by hand.
post edited by Coldblackice - 2021/05/29 08:28:49

Attached Image(s)

#1

2 Replies Related Threads

    koitsu
    New Member
    • Total Posts : 16
    • Reward points : 0
    • Joined: 2006/04/01 06:12:49
    • Status: offline
    • Ribbons : 0
    Re: EVGA Precision v1.2.0.0 not escaping path variables properly 2021/05/30 23:59:45 (permalink)
    You omitted useful analysis information, so I'm having to make some assumptions.  Why is Precision X1 doing such string concatenation to begin with?  NVML.DLL's location is C:\Program Files\NVIDIA Corporation\NVSMI for x64/64-bit machines, and I presume either the same path for x86/32-bit machines or under "Program Files (x86)" instead.  No need to even rely on %ProgramFiles% or %ProgramFiles(x86)% expandos either.  The software should not need to iterate over multitudes of paths/directories from a semicolon-delimited string of any kind.  Refer to https://forums.developer.nvidia.com/t/cant-find-nvml-dll-in-display-drivers/27648/4 for a real-world example.  Otherwise, if there is justification, then EVGA's programmers should be having a very quick/simple discussion with appropriate folks at NVIDIA who can tell them how to do this reliably/properly.  Hard-coding the full path is really not a problem.
    post edited by koitsu - 2021/05/31 00:02:57
    #2
    JimmyPapers
    New Member
    • Total Posts : 2
    • Reward points : 0
    • Joined: 2016/08/12 11:10:52
    • Status: offline
    • Ribbons : 0
    Re: EVGA Precision v1.2.0.0 not escaping path variables properly 2021/06/29 11:34:03 (permalink)
    I would simply add C:\Program Files\NVIDIA Corporation\NVSMI to your System Path. This way when Nvidia updates their libraries, PX will load the new one without you having to copy it somewhere after the update. The driver installer does not remove the custom path token, therefore it's still resident after an uninstall/reinstall. The driver loads just fine from that path. i have employed and tested this fix.
    #3
    Jump to:
  • Back to Mobile