Archive: Some questions about macro InstallLib


Some questions about macro InstallLib
Hi,

Some questions about macro InstallLib:

(Q1:)Why the case1 gives troubles when case2 operates smoothly?

case1
------


; HM NIS Edit Wizard helper defines
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\MyApp.exe"
.....
.....

!include "Library.nsh"
.....
.....

InstallDir "$PROGRAMFILES\MyApp"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
....

Var ALREADY_INSTALLED
Var IsPresent

Function .onInit
....
;Check if product already installed...
ReadRegStr $IsPresent HKLM "${PRODUCT_DIR_REGKEY}" ""
....
FunctionEnd

Section -System
StrCmp $IsPresent "" +2 0
StrCpy $ALREADY_INSTALLED 1

!define LIBRARY_COM

!insertmacro InstallLib REGDLLTLB $ALREADY_INSTALLED REBOOT_NOTPROTECTED \
"E:\MyDLLS\MyDll.dll" "$INSTDIR\MyDll.dll" "$INSTDIR"
SectionEnd

Section APP
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
;... other app. files here...

.....
SectionEnd


case2
------
Only the following line is different, all other things are same as case1:

!insertmacro InstallLib REGDLLTLB $ALREADY_INSTALLED REBOOT_NOTPROTECTED \
"E:\MyDLLS\MyDll.dll" "$SYSDIR\MyDll.dll" "$SYSDIR"


There is no problem with case2.
In case of case1, the (-)system section fails (actually skipped as the log says...), when the installer is ruuning for the first time. However on 2nd time (or 3rd, 4th...etc.) it behave correctly. So what's gone wrong in 1st. time?

(Q2:)What to do if I have to install and uninstall both COM and NO-COM dlls at the same time?

------------
NSIS:2.0.6
OS:Win98SE
------------

Thanks,
playwin2

You must create $INSTDIR before you try to install DLLs in it. Use SetOutPath or CreateDirectory.

To use the InstallLib macro for COM for some DLLs and for non-COM for others, simply define LIBRARY_COM before calling InstallLib that installs COM DLLs and undefine it before call InstallLib that installs non-COM DLLs. For example:

!define LIBRARY_COM
!insertmacro InstallLib ... com.dll
!insertmacro InstallLib ... com2.dll
!undef LIBRARY_COM
!insertmacro InstallLib ... noncom.dll
!insertmacro InstallLib ... noncom2.dll
!define LIBRARY_COM
!insertmacro InstallLib ... com3.dll

Thank you.

For the 1st. part, if I got you right, that you are saying that if target dir. is not $INSTDIR, then only I can skip the creation of $INSTDIR for dlls. Okay I will keep that in mind.

Thanks again,
playwin2