Archive: A few registry questions


A few registry questions
Hi,

I would like my end users to be able to install many instances of my application.

For example they might want to have the same application at 3 different locations.

1: C:\application1\app.exe
2: C:\application2\app.exe
3: C:\application3\app.exe

My problem is that application2 is writing over application1 in the registry and so forth. Also, the uninstaller is removing all sections from the registry, even if its not supposed to.

What is the best way to increment entries in the registry? Or increment uninstall entries in the registry? How do I approach finding out which entry is the correct one to remove during the uninstallation?

Thanks,


you could keep a refrence count and only delete the entries if it is less than 1, or if they should not share settings, store with a hash of the path maybe (HKCU\Software\Company\Appname\%HASH%\)


Hello,

I have the same need as jrolling but don't know how to do it even with Anders' response.
Installer name is the same (so registry markers are the same according to the wizard) but install directory is different and i have different installoptions parameters for each install.
When the uninstaller is launched is it possible to have a page that lists installed components to uninstall (checkboxes)?


You need to figure out a way to make the registry entries unique. One very simple thing to do is to have something

WriteRegStr HKLM "${REGKEY}\$INSTDIR\Components" Common 1

This way you know which entry to delete during uninstall and you can have. I would only recommend this for short time use until you come up with something better.

You can make a custom uninstall page and during the un.init you can read your registry entry to find out which components are installed for that particular installation. Take a look at custom pages if you haven't already.


I manage to have unique registry entries for installed components (ServiceName$nbpavi) and the number of installed components (InstalledPavi) by doing :


ReadRegStr $nbpavi HKLM "${REGKEY}\Components" "InstalledPavi"
Strcmp $nbpavi "" NoPavi OneMorePavi
NoPavi:
StrCpy $nbpavi 1
WriteRegStr HKLM "${REGKEY}\Components" "InstalledPavi" 1
goto EndPavi
OneMorePavi:
IntOp $nbpavi $nbpavi + 1
WriteRegStr HKLM "${REGKEY}\Components" "InstalledPavi" $nbpavi
EndPavi:

WriteRegStr HKLM "${REGKEY}\Components" "ServiceName$nbpavi" $0


I also manage to add a components page to the uninstall :


!insertmacro MUI_UNPAGE_COMPONENTS


For exemple, when running the installer twice i can have :

c:\Program Files\Pavi1
c:\Program Files\Pavi2

registry :
"InstalledPavi" "2"
"ServiceName1" "PAVI1"
"ServiceName2" "PAVI2"

My problem now is to know how to set "ServiceNameX" as uninstall sections in order to uninstall only selected services.
If anyone as a clue.
Thanks

i changed some things :

i use


UninstPage custom un.CustomPageB

instead of

!insertmacro MUI_UNPAGE_COMPONENTS


Then on un.onInit i use

!insertmacro MUI_INSTALLOPTIONS_EXTRACT "unsetup.ini"
ReadRegStr $nbpavi HKLM "${REGKEY}\Components" "InstalledPavi"
StrCpy $0 0
StrCpy $2 ""


unsetup.ini contains a droplist that will be filled in function un.CustomPageB by looping values in the registry.


Function un.CustomPageB
loop:
IntCmp $0 $nbpavi done_loop 0 done_loop
IntOp $0 $0 + 1
ReadRegStr $1 HKLM "${REGKEY}\Components" "ServiceName$0"
Strcpy $2 "$2|$1"
Goto loop
done_loop:
!insertmacro MUI_INSTALLOPTIONS_WRITE "unsetup_pavi.ini" "Field 1" "ListItems" "$2|Tous"
!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "unsetup_pavi.ini"
FunctionEnd


i know i could use push and pop but i m not very comfortable with these...
I have not finished yet but hope this is a good way to solve my need.