Skip to content
⌘ NSIS Forum Archive

DLL register / unregister

3 posts

volpolo#

DLL register / unregister

Hi, please help me with this problem.

Some my applications use the same SHARED DLL and/or OCX:

-installing one or more of them, Reg Counters seems NOT change (i found the same values after each installation)
- the first application I un-install CLEAR all REG Values (de-register) and delete the DLL

Here my code

Section /o "Vr Client" SecClient

StrCpy $Version 0
ReadRegDWord $Version ${UMUI_PARAMS_REGISTRY_ROOT} "${UMUI_PARAMS_REGISTRY_KEY}" "VR CLIENT"

StrCmp $Version 1 ClientOLD ClientNEW
ClientNEW:
StrCpy $ALREADY_INSTALLED 0
Goto ClientSTOP
ClientOLD:
StrCpy $ALREADY_INSTALLED 1
Goto ClientSTOP
ClientSTOP:
Nop

!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_PROTECTED \
"Client\Support\XPCONTROLS.OCX" "$SysDir\XPCONTROLS.OCX" "$SysDir"


WriteRegDWord ${UMUI_PARAMS_REGISTRY_ROOT} "${UMUI_PARAMS_REGISTRY_KEY}" "VR CLIENT" 1

SectionEnd

Section /o "Vr Sportello" SecSportello

StrCpy $Version 0
ReadRegDWord $Version ${UMUI_PARAMS_REGISTRY_ROOT} "${UMUI_PARAMS_REGISTRY_KEY}" "VR SPORTELLO"

StrCmp $Version 1 SportelloOLD SportelloNEW
SportelloNEW:
StrCpy $ALREADY_INSTALLED 0
Goto SportelloSTOP
SportelloOLD:
StrCpy $ALREADY_INSTALLED 1
Goto SportelloSTOP
SportelloSTOP:
Nop


!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_PROTECTED \
"Sportello\Support\XPCONTROLS.OCX" "$SysDir\XPCONTROLS.OCX" "$SysDir"

WriteRegDWord ${UMUI_PARAMS_REGISTRY_ROOT} "${UMUI_PARAMS_REGISTRY_KEY}" "VR SPORTELLO" 1

SectionEnd


Function ${un}CLIENT

IfFileExists $INSTDIR\$PathClient\VR_CLIENT.exe 0 Fine3

!insertmacro UnInstallLib REGDLL SHARED REBOOT_PROTECTED "$SysDir\XPCONTROLS.OCX"

DeleteRegValue ${UMUI_PARAMS_REGISTRY_ROOT} "${UMUI_PARAMS_REGISTRY_KEY}" "VR CLIENT"


Fine3:
Nop

FunctionEnd

Function ${un}SPORTELLO

IfFileExists $INSTDIR\$PathSportello\VR_SPORTELLO.exe 0 Fine4

!insertmacro UnInstallLib REGDLL SHARED REBOOT_PROTECTED "$SysDir\XPCONTROLS.OCX"

DeleteRegValue ${UMUI_PARAMS_REGISTRY_ROOT} "${UMUI_PARAMS_REGISTRY_KEY}" "VR SPORTELLO"
Fine4:
Nop

FunctionEnd

---------------------- STOP

Please help me,I don't undersrtand what to do

Tks
kichik#
If $ALREADY_INSTALLED is not empty, it won't increase the share count as your installer has probably already done it the last time it installed your application.
volpolo#
First of all, thanks for your replya.

Please, verify my code.

I want to install 2 different application (Section SecClient, Section SecSportello), and individually un-install. In this way each application must manage the share count.

If my code in OK for my idea, what else dosn't works?

Thansk again for a new reply