Archive: Overwright Dll in system folder


Overwright Dll in system folder
  I have a dll which gets registered properly on installation, But when i made a few changes to dll, replaced in setup and tried to install old dll is not getting replaced by new one in system folder.
It is not any system dll also it is used by another application so i cannot delete it on uninstall.
I registered it using follwing code:

!insertmacro InstallLib REGDLL $ALREADY_INSTALLED  REBOOT_PROTECTED "C:\Folder1\Usercontrol1.ocx" "$SysDir\Usercontrol1.ocx" "$SysDir"


what can i do so that new dll will replace the old one in system folder.
Thanks

i never got this part really answered http://forums.winamp.com/showthread.php?t=216212
so i still use my own script

;----------------------------------------

;
Usage:
;push dirname+dllname
>; call unload
>;rename existant dllname
>;and delete on next reboot
>Function unload
Exch $R1
Push $R2
Push $R3
;$R1=oldname
;$R2=newname
;$R3=counter
StrCpy $R3 0

;try unregister dll
ExecWait '"$SYSDIR\regsvr32.exe" /u /s "$R1"'
Sleep 300
UnRegDLL $R1
Sleep 300
Delete $R1

;if file does not exist skip all
IfFileExists $R1 0 done

loop:
StrCpy $R2 $R1.$R3.tmp
IfFileExists $R2 loop1 found
Delete $R2
IfFileExists $R2 0 found
loop1:
IntOp $R3 $R3 + 1
Goto loop

found:
;dllname was found > now rename it
Rename $R1 $R2
;delete old dll-file on next boot
Delete/REBOOTOK $R2

done:
Pop $R3
Pop $R2
Pop $R1
FunctionEnd
>;----------------------------------------