Skip to content
⌘ NSIS Forum Archive

ReadRegStr for "(value not set)"

4 posts

machiel#

ReadRegStr for "(value not set)"

With the following code, the first check fails, but the
second works. This is because inside the
registry, "MyTest1" has the value "(value not set)".
Unfortunately, a lot of software is installed like this:
with the main directory set to "(value not set)". Is there
a way to verify these dirs exist, despite the empty value,
and without having to check the files inside these
directories?


WriteRegStr HKLM Software\MYTEST1\SUBDIR "MYTEST1" "An actual value"

ReadRegStr $1 HKLM Software\MYTEST1\ ""
IfErrors 0 +3
MessageBox MB_OK "ERROR MYTEST1 = $1"
Goto +2
MessageBox MB_OK "NO ERROR MYTEST1 = $1"

ReadRegStr $2 HKLM Software\MYTEST1\SUBDIR\ "MYTEST1"
IfErrors 0 +3
MessageBox MB_OK "ERROR MYTEST1 AGAIN = $2"
Goto +2
MessageBox MB_OK "NO ERROR MYTEST1 AGAIN = $2"
Afrow UK#
Note that you need an extra parameter there on the end to specify the index to enumerate (i.e. 0 being the first).

Stu