Archive: ReadRegStr for "(value not set)"


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"


Use EnumRegKey e.g.

EnumRegKey $1 HKLM Software\MYTEST1

Note that you need an extra parameter there on the end to specify the index to enumerate (i.e. 0 being the first).

Stu


Thank you, this works.