Suha
15th May 2002 14:34 UTC
Any example/doc on macro usage?
When i use the modified UpgradeDLL macro in my nsi script, it performs the first DLL ok, however when a second DLL is process MAkeNSIS says that the first of the goto brances (namely: regreboot) is defined twice.
Possible i am misusing the macro.
Is there any document/example about macro usage?
Thanks,
Suha.
kichik
15th May 2002 19:43 UTC
Sounds like a bug in the macro to me...
Try adding the DLL defined name to the regreboot label.
For example, if you define or send the DLL name as ${DLLNAME} use regreboot_${DLLNAME}:
Suha
16th May 2002 07:53 UTC
Yes, that was the soln I just found. Eg:
!macro UpgradeDLL
Exch $0
Push $1
Push $2
Push $3
Push $4
Push $5
ClearErrors
GetDLLVersionLocal ${DLL_NAME} $1 $2
GetDLLVersion $0 $3 $4
IfErrors upgrade_${DLL_NAME}
IntCmpU $1 $3 noupgrade_${DLL_NAME} noupgrade_${DLL_NAME} upgrade_${DLL_NAME}
IntCmpU $2 $4 noupgrade_${DLL_NAME} noupgrade_${DLL_NAME}
upgrade_${DLL_NAME}:
GetTempFileName $5
File /oname=$5 ${DLL_NAME}
UnRegDLL $0
delete /REBOOTOK $0
rename /REBOOTOK $5 $0
IfRebootFlag regreboot_${DLL_NAME} regnoreboot_${DLL_NAME}
regreboot_${DLL_NAME}:
WriteRegStr HKLM Software\Microsoft\Windows\CurrentVersion\RunOnce $0 "$SYSDIR\regsvr32 /s $0"
goto regrebootfinish_${DLL_NAME}
regnoreboot_${DLL_NAME}:
RegDLL $0
regrebootfinish_${DLL_NAME}:
noupgrade_${DLL_NAME}:
Pop $5
Pop $4
Pop $3
Pop $2
Pop $1
Pop $0
!undef DLL_NAME
!macroend
mmullikin
16th May 2002 15:27 UTC
FYI - Your macro has a couple flaws. 1.) The second "IntCmpU" statement will NEVER be executed! 2.) The "DELETE" followed by the "RENAME" will fail (they get reversed) on Win95 machines when the DLL is in use.
Here is a thread with a fix.
http://forums.winamp.com/showthread....threadid=77771
rainwater
16th May 2002 17:16 UTC
All a macro does is insert the exact text. So if you use it twice and you have labels in the macro, they will get defined twice.