Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 19th February 2002, 16:28   #1
CodeSquid
Member
 
Join Date: Dec 2001
Posts: 89
Improved UpgradeDLL macro

The improved UpgradeDLL macro can upgrades DLLs that are in use.

!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 regnoreboot
regreboot:
WriteRegStr HKLM Software\Microsoft\Windows\CurrentVersion\RunOnce $0 "$SYSDIR\regsvr32 /s $0"
goto regrebootfinish
regnoreboot:
RegDLL $0
regrebootfinish:
noupgrade_${DLL_NAME}:
Pop $5
Pop $4
Pop $3
Pop $2
Pop $1
Pop $0
!undef DLL_NAME
!macroend
CodeSquid is offline   Reply With Quote
Old 28th February 2002, 18:47   #2
Bugge T. Jensen
Junior Member
 
Join Date: Nov 2001
Posts: 22
Be aware theres a bug in this macro.

You will never execute
IntCmpU $2 $4 noupgrade_${DLL_NAME}

Se my fix elsewhere in the forum
Bugge T. Jensen is offline   Reply With Quote
Old 26th March 2002, 23:29   #3
mmullikin
Junior Member
 
Join Date: Mar 2002
Posts: 16
Send a message via AIM to mmullikin Send a message via Yahoo to mmullikin
Beyond the issue reported by B. Jensen there is an additional bug in your code for Windows 9X users (not sure about NT/2000/XP). The code:

delete /REBOOTOK $0
rename /REBOOTOK $5 $0

does not produce desired results when the files are in use and need to be manipulated during reboot. On Win 9X systems NSIS uses the WININIT.INI file to do this. In the above sequence, somehow (NSIS bug?) the rename code gets put in BEFORE the delete code and the DLL is therefore missing when the boot is complete. To fix, just skip the delete command and let the rename take care of it.

Regards,

mmullikin
mmullikin is offline   Reply With Quote
Old 27th May 2002, 21:01   #4
mingfa
Junior Member
 
Join Date: May 2002
Posts: 1
Question UpgradeDLL on Win9X

As mmullikin said, there is a bug in the following code on win9x

delete /REBOOTOK $0
rename /REBOOTOK $5 $0

However, mmullikin's suggestion that only using the second line doesn't work on my test either.

Could anyone provide me the UpgradeDLL which can work on win9x?
I mean it can upgrade dll being used on win9x.
mingfa is offline   Reply With Quote
Old 28th May 2002, 08:53   #5
CodeSquid
Member
 
Join Date: Dec 2001
Posts: 89
What about the following workaround?
Detect the Windows version in the script and if it's Win9x use
rename /REBOOTOK $5 $0
delete /REBOOTOK $0
else use
delete /REBOOTOK $0
rename /REBOOTOK $5 $0

However, I've not tesed it!! Use at own risk.
CodeSquid 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