Old 15th May 2002, 13:34   #1
Suha
Registered User
 
Join Date: May 2002
Posts: 2
Question 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.
Suha is offline   Reply With Quote
Old 15th May 2002, 18:43   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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}:

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 16th May 2002, 06:53   #3
Suha
Registered User
 
Join Date: May 2002
Posts: 2
Yes, that was the soln I just found. Eg:

code:

!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

Suha is offline   Reply With Quote
Old 16th May 2002, 14:27   #4
mmullikin
Junior Member
 
Join Date: Mar 2002
Posts: 16
Send a message via AIM to mmullikin Send a message via Yahoo to mmullikin
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
mmullikin is offline   Reply With Quote
Old 16th May 2002, 16:16   #5
rainwater
Senior Member
 
Join Date: Aug 2000
Posts: 397
Send a message via ICQ to rainwater
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.
rainwater is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast 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