Geist
Geist

Reputation: 197

NSIS read registry key returns empty for postgresql

using the NSIS example for read registry keys, I tried to read postgres registry keys but always returns empty, I verified that the path is correct but NSIS ReadRegStr shows empty with quotes, without quotes. ( The original example reads from Software\Microsoft\Windows\CurrentVersion and it recovers the key,value correctly)

loop1:
    ClearErrors
    EnumRegValue $1 HKLM "SOFTWARE\PostgreSQL\Installations\postgresql-x64-10" $0
    IfErrors done
    IntOp $0 $0 + 1
    ReadRegStr $2 HKLM SOFTWARE\PostgreSQL\Installations\postgresql-x64-10 $1
    MessageBox MB_YESNO|MB_ICONQUESTION "$1 = $2$\n$\nMore?" IDYES loop1
done:

any suggestion? thanks

Upvotes: 1

Views: 349

Answers (1)

Anders
Anders

Reputation: 101559

64-bit versions of Windows has two registry views.

The registry redirector isolates 32-bit and 64-bit applications by providing separate logical views of certain portions of the registry on WOW64. The registry redirector intercepts 32-bit and 64-bit registry calls to their respective logical registry views and maps them to the corresponding physical registry location. The redirection process is transparent to the application. Therefore, a 32-bit application can access registry data as if it were running on 32-bit Windows even if the data is stored in a different location on 64-bit Windows.

Use SetRegView to read from the 64-bit view in NSIS:

Section
SetRegView 64
ReadRegStr ...
SetRegView lastused
SectionEnd

Upvotes: 2

Related Questions