Archive: check for specific install path or version


check for specific install path or version
hi all,

I've written a plugin for another program and want to use NSIS as installer. Problem is that there are several versions of this other software and I need the installer to decide on the path. It is vitally important for me to find the version number.

The version of the other software is written in the registry and would look something like this:
software\program\v1\
Not a key, but a path.

the next version of the software would be this:
software\program\v2


Optimistically, I was hoping that I could just assign the value to a string and fill the string with the last value it finds:

InstallDirRegKey HKLM "Software\program\v1" "Installdir"
InstallDirRegKey HKLM "Software\program\v2" "Installdir"
InstallDirRegKey HKLM "Software\program\v3" "Installdir"

So if the end-user only has v2 installed, no value would be found and so we would know that version 2 is installed. But this doesnt work.

Does anyone have a quick fix for this. This is the only thing that I need to get it working on the installer side.


http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.2.5

Please try reading the manual first, it exists for a reason.


Yes boss


Right, I've tried every possible combination but I cant figure out how to read the DATA part of the key.



StrCpy $1 "Software\program\"
StrCpy $2 "version2" ;this is obtained earlier
StrCpy $3 "\installdir"
StrCpy $4 $1$2$3
;this gives me "Software\program\version2\installdir"

but now I need to know how to query the value of this key.
I tried:

EnumRegValue $5 HKLM $4 "path"
;path is a REG_SZ name but i want it's value
It's only returning "path"

What am I doing wrong?

Thanks for any help.


ok, I've got it.

ReadRegStr $5 HKLM $4 "Installdir"


Got there in the end.