Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 15th May 2005, 15:57   #1
playwin2
Junior Member
 
Join Date: May 2005
Posts: 25
Some questions about macro InstallLib

Hi,

Some questions about macro InstallLib:

(Q1Why the case1 gives troubles when case2 operates smoothly?

case1
------
code:

; 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:
code:

!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?

(Q2What 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
playwin2 is offline   Reply With Quote
Old 17th May 2005, 19:39   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
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:
code:
!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


NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is online now   Reply With Quote
Old 17th May 2005, 21:52   #3
playwin2
Junior Member
 
Join Date: May 2005
Posts: 25
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
playwin2 is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump