Search code examples
registrynsis

NSIS 2.46 Reading registry: "." in subkey lets ReadRegStr fail


I have a problem with the command ReadRegStr, using 2016." in the subkey as seen below:

ReadRegStr 
   $INSTDIR2016_5x64 
   "HKLM"
   "SOFTWARE\Autodesk\Maya\2016.5\Setup\InstallPath" "MAYA_INSTALL_LOCATION"

It works fine without the ., so it works for Maya 2016. ;)

So the . seems to be the problem.

Anybody any idea? Thanks!


Solution

  • NSIS does not parse the registry path, it is passed directly to the Windows registry functions:

    Section
    # Write example value
    WriteRegStr HKCU "SOFTWARE\NSIS\Test\Maya\2016.5\Setup\InstallPath" "MAYA_INSTALL_LOCATION" "c:\foo\bar"
    # Read it
    ReadRegStr $0 HKCU "SOFTWARE\NSIS\Test\Maya\2016.5\Setup\InstallPath" "MAYA_INSTALL_LOCATION"
    DetailPrint MAYA_INSTALL_LOCATION=$0
    # Clean up
    DeleteRegKey HKCU "SOFTWARE\NSIS\Test"
    SectionEnd
    

    It is possible that you are seeing a 64-bit vs 32-bit registry issue or registry virtualization/redirection. Download Process Monitor to verify that you are accessing the correct key...