;Configuration
;General
- SetCompressor bzip2
+ SetCompressor lzma
!ifndef DEBUG
OutFile "MITKerberosForWindows.exe"
!else
!define KFW_PRODUCT_NAME "${PROGRAM_NAME}"
!define KFW_REGKEY_ROOT "Software\MIT\Kerberos\"
CRCCheck force
+ !define REPLACEDLL_NOREGISTER
;Folder selection page
InstallDir "$PROGRAMFILES\MIT\Kerberos" ; Install to shorter path
!define KFW_INSTALL_DIR "${KFW_TARGETDIR}\install"
!define SYSTEMDIR "$%SystemRoot%\System32"
+
;--------------------------------
;Modern UI Configuration
;Only useful for BZIP2 compression
!insertmacro MUI_RESERVEFILE_LANGDLL
+;--------------------------------
+; Load Macros
+!include "utils.nsi"
;--------------------------------
;Installer Sections
; Do client components
SetOutPath "$INSTDIR\bin"
- File "${KFW_BIN_DIR}\aklog.exe"
- File "${KFW_BIN_DIR}\comerr32.dll"
- File "${KFW_BIN_DIR}\gss.exe"
- File "${KFW_BIN_DIR}\gss-client.exe"
- File "${KFW_BIN_DIR}\gss-server.exe"
- File "${KFW_BIN_DIR}\gssapi32.dll"
- File "${KFW_BIN_DIR}\k524init.exe"
- File "${KFW_BIN_DIR}\kclnt32.dll"
- File "${KFW_BIN_DIR}\kdestroy.exe"
- File "${KFW_BIN_DIR}\kinit.exe"
- File "${KFW_BIN_DIR}\klist.exe"
- File "${KFW_BIN_DIR}\kvno.exe"
- File "${KFW_BIN_DIR}\krb5_32.dll"
- File "${KFW_BIN_DIR}\krb524.dll"
- File "${KFW_BIN_DIR}\krbcc32.dll"
- File "${KFW_BIN_DIR}\krbcc32s.exe"
- File "${KFW_BIN_DIR}\krbv4w32.dll"
- File "${KFW_BIN_DIR}\leash32.exe"
-!ifdef OLDHELP
- File "${KFW_BIN_DIR}\leash32.hlp"
-!else
- File "${KFW_BIN_DIR}\leash32.chm"
-!endif
- File "${KFW_BIN_DIR}\leashw32.dll"
- File "${KFW_BIN_DIR}\ms2mit.exe"
- File "${KFW_BIN_DIR}\wshelp32.dll"
- File "${KFW_BIN_DIR}\xpprof32.dll"
+ !insertmacro ReplaceDLL "${KFW_BIN_DIR}\aklog.exe" "$INSTDIR\bin\aklog.exe" "$INSTDIR"
+ !insertmacro ReplaceDLL "${KFW_BIN_DIR}\comerr32.dll" "$INSTDIR\bin\comerr32.dll" "$INSTDIR"
+ !insertmacro ReplaceDLL "${KFW_BIN_DIR}\gss.exe" "$INSTDIR\bin\gss.exe" "$INSTDIR"
+ !insertmacro ReplaceDLL "${KFW_BIN_DIR}\gss-client.exe" "$INSTDIR\bin\gss-client.exe" "$INSTDIR"
+ !insertmacro ReplaceDLL "${KFW_BIN_DIR}\gss-server.exe" "$INSTDIR\bin\gss-server.exe" "$INSTDIR"
+ !insertmacro ReplaceDLL "${KFW_BIN_DIR}\gssapi32.dll" "$INSTDIR\bin\gssapi32.dll" "$INSTDIR"
+ !insertmacro ReplaceDLL "${KFW_BIN_DIR}\k524init.exe" "$INSTDIR\bin\k524init.exe" "$INSTDIR"
+ !insertmacro ReplaceDLL "${KFW_BIN_DIR}\kclnt32.dll" "$INSTDIR\bin\kclnt32.dll" "$INSTDIR"
+ !insertmacro ReplaceDLL "${KFW_BIN_DIR}\kdestroy.exe" "$INSTDIR\bin\kdestroy.exe" "$INSTDIR"
+ !insertmacro ReplaceDLL "${KFW_BIN_DIR}\kinit.exe" "$INSTDIR\bin\kinit.exe" "$INSTDIR"
+ !insertmacro ReplaceDLL "${KFW_BIN_DIR}\klist.exe" "$INSTDIR\bin\klist.exe" "$INSTDIR"
+ !insertmacro ReplaceDLL "${KFW_BIN_DIR}\kpasswd.exe" "$INSTDIR\bin\kpasswd.exe" "$INSTDIR"
+ !insertmacro ReplaceDLL "${KFW_BIN_DIR}\kvno.exe" "$INSTDIR\bin\kvno.exe" "$INSTDIR"
+ !insertmacro ReplaceDLL "${KFW_BIN_DIR}\krb5_32.dll" "$INSTDIR\bin\krb5_32.dll" "$INSTDIR"
+ !insertmacro ReplaceDLL "${KFW_BIN_DIR}\krb524.dll" "$INSTDIR\bin\krb524.dll" "$INSTDIR"
+ !insertmacro ReplaceDLL "${KFW_BIN_DIR}\krbcc32.dll" "$INSTDIR\bin\krbcc32.dll" "$INSTDIR"
+ !insertmacro ReplaceDLL "${KFW_BIN_DIR}\krbcc32s.exe" "$INSTDIR\bin\krbcc32s.exe" "$INSTDIR"
+ !insertmacro ReplaceDLL "${KFW_BIN_DIR}\krbv4w32.dll" "$INSTDIR\bin\krbv4w32.dll" "$INSTDIR"
+ !insertmacro ReplaceDLL "${KFW_BIN_DIR}\leash32.exe" "$INSTDIR\bin\leash32.exe" "$INSTDIR"
+!ifdef OLDHELP
+ !insertmacro ReplaceDLL "${KFW_BIN_DIR}\leash32.hlp" "$INSTDIR\bin\leash32.hlp" "$INSTDIR"
+!else
+ !insertmacro ReplaceDLL "${KFW_BIN_DIR}\leash32.chm" "$INSTDIR\bin\leash32.chm" "$INSTDIR"
+!endif
+ !insertmacro ReplaceDLL "${KFW_BIN_DIR}\leashw32.dll" "$INSTDIR\bin\leashw32.dll" "$INSTDIR"
+ !insertmacro ReplaceDLL "${KFW_BIN_DIR}\ms2mit.exe" "$INSTDIR\bin\ms2mit.exe" "$INSTDIR"
+ !insertmacro ReplaceDLL "${KFW_BIN_DIR}\wshelp32.dll" "$INSTDIR\bin\wshelp32.dll" "$INSTDIR"
+ !insertmacro ReplaceDLL "${KFW_BIN_DIR}\xpprof32.dll" "$INSTDIR\bin\xpprof32.dll" "$INSTDIR"
!ifdef DEBUG
File "${KFW_BIN_DIR}\aklog.pdb"
File "${KFW_BIN_DIR}\kdestroy.pdb"
File "${KFW_BIN_DIR}\kinit.pdb"
File "${KFW_BIN_DIR}\klist.pdb"
+ File "${KFW_BIN_DIR}\kpasswd.pdb"
File "${KFW_BIN_DIR}\kvno.pdb"
File "${KFW_BIN_DIR}\krb5_32.pdb"
File "${KFW_BIN_DIR}\krb524.pdb"
File "${KFW_BIN_DIR}\xpprof32.pdb"
!IFDEF CL_1310
- File "${SYSTEMDIR}\msvcr71d.dll"
- File "${SYSTEMDIR}\msvcr71d.pdb"
- File "${SYSTEMDIR}\msvcp71d.dll"
- File "${SYSTEMDIR}\msvcp71d.pdb"
- File "${SYSTEMDIR}\mfc71d.dll"
- File "${SYSTEMDIR}\mfc71d.pdb"
- File "${SYSTEMDIR}\MFC71CHS.DLL"
- File "${SYSTEMDIR}\MFC71CHT.DLL"
- File "${SYSTEMDIR}\MFC71DEU.DLL"
- File "${SYSTEMDIR}\MFC71ENU.DLL"
- File "${SYSTEMDIR}\MFC71ESP.DLL"
- File "${SYSTEMDIR}\MFC71FRA.DLL"
- File "${SYSTEMDIR}\MFC71ITA.DLL"
- File "${SYSTEMDIR}\MFC71JPN.DLL"
- File "${SYSTEMDIR}\MFC71KOR.DLL"
-!ELSE
-!IFDEF CL_1300
- File "${SYSTEMDIR}\msvcr70d.dll"
- File "${SYSTEMDIR}\msvcr70d.pdb"
- File "${SYSTEMDIR}\msvcp70d.dll"
- File "${SYSTEMDIR}\msvcp70d.pdb"
- File "${SYSTEMDIR}\mfc70d.dll"
- File "${SYSTEMDIR}\mfc70d.pdb"
- File "${SYSTEMDIR}\MFC70CHS.DLL"
- File "${SYSTEMDIR}\MFC70CHT.DLL"
- File "${SYSTEMDIR}\MFC70DEU.DLL"
- File "${SYSTEMDIR}\MFC70ENU.DLL"
- File "${SYSTEMDIR}\MFC70ESP.DLL"
- File "${SYSTEMDIR}\MFC70FRA.DLL"
- File "${SYSTEMDIR}\MFC70ITA.DLL"
- File "${SYSTEMDIR}\MFC70JPN.DLL"
- File "${SYSTEMDIR}\MFC70KOR.DLL"
-!ELSE
- File "${SYSTEMDIR}\mfc42d.dll"
- File "${SYSTEMDIR}\mfc42d.pdb"
- File "${SYSTEMDIR}\msvcp60d.dll"
- File "${SYSTEMDIR}\msvcp60d.pdb"
- File "${SYSTEMDIR}\msvcrtd.dll"
- File "${SYSTEMDIR}\msvcrtd.pdb"
-!ENDIF
-!ENDIF
-!ELSE
-!IFDEF CL_1310
- File "${SYSTEMDIR}\mfc71.dll"
- File "${SYSTEMDIR}\msvcr71.dll"
- File "${SYSTEMDIR}\msvcp71.dll"
- File "${SYSTEMDIR}\MFC71CHS.DLL"
- File "${SYSTEMDIR}\MFC71CHT.DLL"
- File "${SYSTEMDIR}\MFC71DEU.DLL"
- File "${SYSTEMDIR}\MFC71ENU.DLL"
- File "${SYSTEMDIR}\MFC71ESP.DLL"
- File "${SYSTEMDIR}\MFC71FRA.DLL"
- File "${SYSTEMDIR}\MFC71ITA.DLL"
- File "${SYSTEMDIR}\MFC71JPN.DLL"
- File "${SYSTEMDIR}\MFC71KOR.DLL"
-!ELSE
-!IFDEF CL_1300
- File "${SYSTEMDIR}\mfc70.dll"
- File "${SYSTEMDIR}\msvcr70.dll"
- File "${SYSTEMDIR}\msvcp70.dll"
- File "${SYSTEMDIR}\MFC70CHS.DLL"
- File "${SYSTEMDIR}\MFC70CHT.DLL"
- File "${SYSTEMDIR}\MFC70DEU.DLL"
- File "${SYSTEMDIR}\MFC70ENU.DLL"
- File "${SYSTEMDIR}\MFC70ESP.DLL"
- File "${SYSTEMDIR}\MFC70FRA.DLL"
- File "${SYSTEMDIR}\MFC70ITA.DLL"
- File "${SYSTEMDIR}\MFC70JPN.DLL"
- File "${SYSTEMDIR}\MFC70KOR.DLL"
-!ELSE
- File "${SYSTEMDIR}\mfc42.dll"
- File "${SYSTEMDIR}\msvcp60.dll"
- File "${SYSTEMDIR}\msvcrt.dll"
-!ENDIF
-!ENDIF
-!ENDIF
- File "${SYSTEMDIR}\psapi.dll"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcr71d.dll" "$INSTDIR\bin\msvcr71d.dll" "$INSTDIR"
+ File "${SYSTEMDIR}\msvcr71d.pdb"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcp71d.dll" "$INSTDIR\bin\msvcp71d.dll" "$INSTDIR"
+ File "${SYSTEMDIR}\msvcp71d.pdb"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\mfc71d.dll" "$INSTDIR\bin\mfc71d.dll" "$INSTDIR"
+ File "${SYSTEMDIR}\mfc71d.pdb"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71CHS.DLL" "$INSTDIR\bin\MFC71CHS.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71CHT.DLL" "$INSTDIR\bin\MFC71CHT.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71DEU.DLL" "$INSTDIR\bin\MFC71DEU.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71ENU.DLL" "$INSTDIR\bin\MFC71ENU.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71ESP.DLL" "$INSTDIR\bin\MFC71ESP.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71FRA.DLL" "$INSTDIR\bin\MFC71FRA.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71ITA.DLL" "$INSTDIR\bin\MFC71ITA.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71JPN.DLL" "$INSTDIR\bin\MFC71JPN.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71KOR.DLL" "$INSTDIR\bin\MFC71KOR.DLL" "$INSTDIR"
+!ELSE
+!IFDEF CL_1300
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcr70d.dll" "$INSTDIR\bin\msvcr70d.dll" "$INSTDIR"
+ File "${SYSTEMDIR}\msvcr70d.pdb"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcp70d.dll" "$INSTDIR\bin\msvcp70d.dll" "$INSTDIR"
+ File "${SYSTEMDIR}\msvcp70d.pdb"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\mfc70d.dll" "$INSTDIR\bin\mfc70d.dll" "$INSTDIR"
+ File "${SYSTEMDIR}\mfc70d.pdb"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70CHS.DLL" "$INSTDIR\bin\MFC70CHS.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70CHT.DLL" "$INSTDIR\bin\MFC70CHT.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70DEU.DLL" "$INSTDIR\bin\MFC70DEU.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70ENU.DLL" "$INSTDIR\bin\MFC70ENU.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70ESP.DLL" "$INSTDIR\bin\MFC70ESP.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70FRA.DLL" "$INSTDIR\bin\MFC70FRA.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70ITA.DLL" "$INSTDIR\bin\MFC70ITA.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70JPN.DLL" "$INSTDIR\bin\MFC70JPN.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70KOR.DLL" "$INSTDIR\bin\MFC70KOR.DLL" "$INSTDIR"
+!ELSE
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\mfc42d.dll" "$INSTDIR\bin\mfc42d.dll" "$INSTDIR"
+ File "${SYSTEMDIR}\mfc42d.pdb"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcp60d.dll" "$INSTDIR\bin\msvcp60d.dll" "$INSTDIR"
+ File "${SYSTEMDIR}\msvcp60d.pdb"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcrtd.dll" "$INSTDIR\bin\msvcrtd.dll" "$INSTDIR"
+ File "${SYSTEMDIR}\msvcrtd.pdb"
+!ENDIF
+!ENDIF
+!ELSE
+!IFDEF CL_1310
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\mfc71.dll" "$INSTDIR\bin\mfc71.dll" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcr71.dll" "$INSTDIR\bin\msvcr71.dll" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcp71.dll" "$INSTDIR\bin\msvcp71.dll" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71CHS.DLL" "$INSTDIR\bin\MFC71CHS.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71CHT.DLL" "$INSTDIR\bin\MFC71CHT.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71DEU.DLL" "$INSTDIR\bin\MFC71DEU.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71ENU.DLL" "$INSTDIR\bin\MFC71ENU.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71ESP.DLL" "$INSTDIR\bin\MFC71ESP.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71FRA.DLL" "$INSTDIR\bin\MFC71FRA.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71ITA.DLL" "$INSTDIR\bin\MFC71ITA.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71JPN.DLL" "$INSTDIR\bin\MFC71JPN.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71KOR.DLL" "$INSTDIR\bin\MFC71KOR.DLL" "$INSTDIR"
+!ELSE
+!IFDEF CL_1300
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\mfc70.dll" "$INSTDIR\bin\mfc70.dll" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcr70.dll" "$INSTDIR\bin\msvcr70.dll" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcp70.dll" "$INSTDIR\bin\msvcp70.dll" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70CHS.DLL" "$INSTDIR\bin\MFC70CHS.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70CHT.DLL" "$INSTDIR\bin\MFC70CHT.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70DEU.DLL" "$INSTDIR\bin\MFC70DEU.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70ENU.DLL" "$INSTDIR\bin\MFC70ENU.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70ESP.DLL" "$INSTDIR\bin\MFC70ESP.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70FRA.DLL" "$INSTDIR\bin\MFC70FRA.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70ITA.DLL" "$INSTDIR\bin\MFC70ITA.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70JPN.DLL" "$INSTDIR\bin\MFC70JPN.DLL" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70KOR.DLL" "$INSTDIR\bin\MFC70KOR.DLL" "$INSTDIR"
+!ELSE
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\mfc42.dll" "$INSTDIR\bin\mfc42.dll" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcp60.dll" "$INSTDIR\bin\msvcp60.dll" "$INSTDIR"
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcrt.dll" "$INSTDIR\bin\msvcrt.dll" "$INSTDIR"
+!ENDIF
+!ENDIF
+!ENDIF
+ !insertmacro ReplaceDLL "${SYSTEMDIR}\psapi.dll" "$INSTDIR\bin\psapi.dll" "$INSTDIR"
; Do WINDOWSDIR components
;SetOutPath "$WINDOWSDIR"
Delete /REBOOTOK "$INSTDIR\bin\kdestroy.exe"
Delete /REBOOTOK "$INSTDIR\bin\kinit.exe"
Delete /REBOOTOK "$INSTDIR\bin\klist.exe"
+ Delete /REBOOTOK "$INSTDIR\bin\kpasswd.exe"
Delete /REBOOTOK "$INSTDIR\bin\kvno.exe"
Delete /REBOOTOK "$INSTDIR\bin\krb5_32.dll"
Delete /REBOOTOK "$INSTDIR\bin\krb524.dll"
Delete /REBOOTOK "$INSTDIR\bin\kdestroy.pdb"
Delete /REBOOTOK "$INSTDIR\bin\kinit.pdb"
Delete /REBOOTOK "$INSTDIR\bin\klist.pdb"
+ Delete /REBOOTOK "$INSTDIR\bin\kpasswd.pdb"
Delete /REBOOTOK "$INSTDIR\bin\kvno.pdb"
Delete /REBOOTOK "$INSTDIR\bin\krb5_32.pdb"
Delete /REBOOTOK "$INSTDIR\bin\krb524.pdb"
FunctionEnd
+;--------------------------------
+; Macros
+
;--------------------------------
; Macros
; Macro - Upgrade DLL File
- ; Written by Joost Verburg
- ; ------------------------
- ;
- ; Example of usage:
- ; !insertmacro UpgradeDLL "dllname.dll" "$SYSDIR\dllname.dll"
- ;
- ; !define UPGRADEDLL_NOREGISTER if you want to upgrade a DLL which cannot be registered
- ;
- ; Note that this macro sets overwrite to ON (the default) when it has been inserted.
- ; If you are using another setting, set it again after inserting the macro.
+; Written by Joost Verburg
+; ------------------------
+;
+; Parameters:
+; LOCALFILE - Location of the new DLL file (on the compiler system)
+; DESTFILE - Location of the DLL file that should be upgraded
+; (on the user's system)
+; TEMPBASEDIR - Directory on the user's system to store a temporary file
+; when the system has to be rebooted.
+; For Win9x support, this should be on the same volume as the
+; DESTFILE!
+; The Windows temp directory could be located on any volume,
+; so you cannot use this directory.
+;
+; Define REPLACEDLL_NOREGISTER if you want to upgrade a DLL that does not
+; have to be registered.
+;
+; Note: If you want to support Win9x, you can only use
+; short filenames (8.3).
+;
+; Example of usage:
+; !insertmacro ReplaceDLL "dllname.dll" "$SYSDIR\dllname.dll" "$SYSDIR"
+;
+!macro ReplaceDLL LOCALFILE DESTFILE TEMPBASEDIR
- !macro UpgradeDLL LOCALFILE DESTFILE
+ Push $R0
+ Push $R1
+ Push $R2
+ Push $R3
+ Push $R4
+ Push $R5
- Push $R0
- Push $R1
- Push $R2
- Push $R3
+ ;------------------------
+ ;Unique number for labels
- ;------------------------
- ;Check file and version
+ !define REPLACEDLL_UNIQUE ${__LINE__}
+
+ ;------------------------
+ ;Copy the parameters used on run-time to a variable
+ ;This allows the usage of variables as paramter
- IfFileExists "${DESTFILE}" "" "copy_${LOCALFILE}"
+ StrCpy $R4 "${DESTFILE}"
+ StrCpy $R5 "${TEMPBASEDIR}"
- ClearErrors
- GetDLLVersionLocal "${LOCALFILE}" $R0 $R1
- GetDLLVersion "${DESTFILE}" $R2 $R3
- IfErrors "upgrade_${LOCALFILE}"
+ ;------------------------
+ ;Check file and version
+ ;
+ IfFileExists $R4 0 replacedll.copy_${REPLACEDLL_UNIQUE}
+
+ ;ClearErrors
+ ; GetDLLVersionLocal "${LOCALFILE}" $R0 $R1
+ ; GetDLLVersion $R4 $R2 $R3
+ ;IfErrors replacedll.upgrade_${REPLACEDLL_UNIQUE}
+ ;
+ ;IntCmpU $R0 $R2 0 replacedll.done_${REPLACEDLL_UNIQUE} \
+ ; replacedll.upgrade_${REPLACEDLL_UNIQUE}
+ ;IntCmpU $R1 $R3 replacedll.done_${REPLACEDLL_UNIQUE} \
+ ; replacedll.done_${REPLACEDLL_UNIQUE} \
+ ; replacedll.upgrade_${REPLACEDLL_UNIQUE}
- IntCmpU $R0 $R2 "" "done_${LOCALFILE}" "upgrade_${LOCALFILE}"
- IntCmpU $R1 $R3 "done_${LOCALFILE}" "done_${LOCALFILE}" "upgrade_${LOCALFILE}"
+ ;------------------------
+ ;Let's replace the DLL!
- ;------------------------
- ;Let's upgrade the DLL!
+ SetOverwrite try
- SetOverwrite try
+ ;replacedll.upgrade_${REPLACEDLL_UNIQUE}:
+ !ifndef REPLACEDLL_NOREGISTER
+ ;Unregister the DLL
+ UnRegDLL $R4
+ !endif
- "upgrade_${LOCALFILE}:"
- !ifndef UPGRADEDLL_NOREGISTER
- ;Unregister the DLL
- UnRegDLL "${DESTFILE}"
- !endif
+ ;------------------------
+ ;Try to copy the DLL directly
- ;------------------------
- ;Try to copy the DLL directly
+ ClearErrors
+ StrCpy $R0 $R4
+ Call :replacedll.file_${REPLACEDLL_UNIQUE}
+ IfErrors 0 replacedll.noreboot_${REPLACEDLL_UNIQUE}
- ClearErrors
- StrCpy $R0 "${DESTFILE}"
- Call ":file_${LOCALFILE}"
- IfErrors "" "noreboot_${LOCALFILE}"
+ ;------------------------
+ ;DLL is in use. Copy it to a temp file and Rename it on reboot.
- ;------------------------
- ;DLL is in use. Copy it to a temp file and Rename it on reboot.
+ GetTempFileName $R0 $R5
+ Call :replacedll.file_${REPLACEDLL_UNIQUE}
+ Rename /REBOOTOK $R0 $R4
- GetTempFileName $R0
- Call ":file_${LOCALFILE}"
- Rename /REBOOTOK $R0 "${DESTFILE}"
+ ;------------------------
+ ;Register the DLL on reboot
- ;------------------------
- ;Register the DLL on reboot
+ !ifndef REPLACEDLL_NOREGISTER
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" \
+ "Register $R4" 'rundll32.exe "$R4",DllRegisterServer'
+ !endif
- !ifndef UPGRADEDLL_NOREGISTER
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" \
- "Register ${DESTFILE}" '"$SYSDIR\rundll32.exe" "${DESTFILE},DllRegisterServer"'
- !endif
+ Goto replacedll.done_${REPLACEDLL_UNIQUE}
- Goto "done_${LOCALFILE}"
+ ;------------------------
+ ;DLL does not exist - just extract
- ;------------------------
- ;DLL does not exist - just extract
+ replacedll.copy_${REPLACEDLL_UNIQUE}:
+ StrCpy $R0 $R4
+ Call :replacedll.file_${REPLACEDLL_UNIQUE}
- "copy_${LOCALFILE}:"
- StrCpy $R0 "${DESTFILE}"
- Call ":file_${LOCALFILE}"
+ ;------------------------
+ ;Register the DLL
- ;------------------------
- ;Register the DLL
+ replacedll.noreboot_${REPLACEDLL_UNIQUE}:
+ !ifndef REPLACEDLL_NOREGISTER
+ RegDLL $R4
+ !endif
- "noreboot_${LOCALFILE}:"
- !ifndef UPGRADEDLL_NOREGISTER
- RegDLL "${DESTFILE}"
- !endif
+ ;------------------------
+ ;Done
- ;------------------------
- ;Done
+ replacedll.done_${REPLACEDLL_UNIQUE}:
- "done_${LOCALFILE}:"
+ Pop $R5
+ Pop $R4
+ Pop $R3
+ Pop $R2
+ Pop $R1
+ Pop $R0
- Pop $R3
- Pop $R2
- Pop $R1
- Pop $R0
+ ;------------------------
+ ;End
- ;------------------------
- ;End
+ Goto replacedll.end_${REPLACEDLL_UNIQUE}
- Goto "end_${LOCALFILE}"
+ ;------------------------
+ ;Called to extract the DLL
- ;------------------------
- ;Called to extract the DLL
+ replacedll.file_${REPLACEDLL_UNIQUE}:
+ File /oname=$R0 "${LOCALFILE}"
+ Return
- "file_${LOCALFILE}:"
- File /oname=$R0 "${LOCALFILE}"
- Return
+ replacedll.end_${REPLACEDLL_UNIQUE}:
- "end_${LOCALFILE}:"
+ ;------------------------
+ ;Restore settings
- ;------------------------
- ;Set overwrite to default
- ;(was set to TRY above)
+ SetOverwrite lastused
+
+ !undef REPLACEDLL_UNIQUE
- SetOverwrite on
+!macroend
- !macroend
; GetParameters
; input, none