View Full Version : Active X Installation
THEMike
15th May 2001, 13:24
Can someone show me the code they use to update an active x dll?
Handling needing a re-boot etc.
Cheers.
yazno
15th May 2001, 17:11
hi mike,
you could do it like this: (untested)
Function RegisterActiveX
StrCpy $0 "to_be_upd.dll"
StrCpy $1 "new.dll"
CompareDLLVersions $0 $1 lbl_end lbl_upd
lbl_upd:
UnRegDLL $0
File $1
RegDLL $1
lbl_end:
nop;
FunctionEnd
cu yzo
Koen van de Sande
15th May 2001, 17:51
Uh-oh. Do you need to UnReg it first !?!?!
(O MY GOD!)
And shouldn't you check if the file already exists? If it doesn't, does CompareDLLVersions go to the right spot?
yazno
15th May 2001, 20:44
hi,
whops .. sure.
like i said .. untested :)
maybe it is better like this: (still untested)
Function RegisterActiveX
StrCpy $0 "to_be_upd.dll"
StrCpy $1 "new.dll"
IfFileExists $0 lbl_compare lbl_end
lbl_compare:
CompareDLLVersions $0 $1 lbl_end lbl_upd
;goto lbl_end if versions are
;the same or an error occures(?)
GoTo lbl_end
lbl_upd:
;UnRegDLL $0 ;is that ok, dunno.
File $1
RegDLL $1
lbl_end:
nop;
FunctionEnd
cu yzo
Edgewize
16th May 2001, 02:02
It's really simple ... if you want to update 'whatever.dll' and you keep your copy in 'C:\Distrib' when you are building your NSIS executable:
CompareDLLVersions /STOREFROM "$SYSDIR\whatever.dll" "C:\Distrib\whatever.dll" lblSkip lblCopy
lblCopy:
File /ONAME="$SYSDIR\whatever.dll" "C:\Distrib\whatever.dll"
RegDll "$SYSDIR\whatever.dll"
lblSkip:
Nop
This works because CompareDLLVersions continues without a goto if the target DLL doesn't exist. And the best part is that it works without changing the current output directory.
The only time you need to UnReg is when you remove a DLL, not update it to a new version.
Edgewize
16th May 2001, 02:05
Oh, the File command automatically handles the copy-on-reboot thing. It's the default, if I remember right. Just add a message at the end of the installer saying "You may have to reboot before XXXXX will work correctly." Someday Justin will add reboot prompting support and then you won't even need that :p
THEMike
20th May 2001, 09:23
Ok you can't do:
File /oname="$SYSDIR\whatever.dll" c:\distrib\whatever.dll
it is
SetOutPath $SYSDIR
File /oname="whatever.dll" c:\distrib\whatever.dll
or MakeNSIS pukes.
Is this behaviour of file documented? I can't find anymention of that...
THEMike
20th May 2001, 11:56
Oh Dear.
I spoke to justin. File doesn't handle anything to do with re-booting. Bum.
Edgewize
20th May 2001, 15:33
Hrm...
I lost my copy of the code in a HD crash last week, but from what I remember, File *does* have support for using 'wininit.ini' to copy files on reboot. It just doesn't tell you if you need to reboot or not.
That is, unless Justin changed it, or I misread the code. Both are highly possible.
vBulletin® v3.8.6, Copyright ©2000-2013, Jelsoft Enterprises Ltd.