From 8f28d6aac5109199f321fc2f90e5e0fea8654505 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Wed, 31 Mar 2004 08:32:28 +0000 Subject: [PATCH] 2004-03-31 Jeffrey Altman Add the KFW 2.6 NSIS installer scripts to the repository ticket: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16216 dc483132-0cff-0310-8789-dd5450dbe970 --- src/windows/installer/nsis/ChangeLog | 4 + src/windows/installer/nsis/KfWConfigPage.ini | 59 + src/windows/installer/nsis/KfWConfigPage2.ini | 28 + src/windows/installer/nsis/kfw-fixed.nsi | 1406 +++++++++++++++++ src/windows/installer/nsis/kfw.ico | Bin 0 -> 25214 bytes src/windows/installer/nsis/kfw.nsi | 17 + src/windows/installer/nsis/killer.cpp | 380 +++++ src/windows/installer/nsis/licenses.rtf | 98 ++ src/windows/installer/nsis/nsi-includes.nsi | 8 + src/windows/installer/nsis/site-local.nsi | 10 + src/windows/installer/nsis/utils.nsi | 779 +++++++++ 11 files changed, 2789 insertions(+) create mode 100644 src/windows/installer/nsis/ChangeLog create mode 100644 src/windows/installer/nsis/KfWConfigPage.ini create mode 100644 src/windows/installer/nsis/KfWConfigPage2.ini create mode 100644 src/windows/installer/nsis/kfw-fixed.nsi create mode 100644 src/windows/installer/nsis/kfw.ico create mode 100644 src/windows/installer/nsis/kfw.nsi create mode 100644 src/windows/installer/nsis/killer.cpp create mode 100644 src/windows/installer/nsis/licenses.rtf create mode 100644 src/windows/installer/nsis/nsi-includes.nsi create mode 100644 src/windows/installer/nsis/site-local.nsi create mode 100644 src/windows/installer/nsis/utils.nsi diff --git a/src/windows/installer/nsis/ChangeLog b/src/windows/installer/nsis/ChangeLog new file mode 100644 index 000000000..da4ab982d --- /dev/null +++ b/src/windows/installer/nsis/ChangeLog @@ -0,0 +1,4 @@ +2004-03-31 Jeffrey Altman + +* Add the NSIS installer for KFW 2.6 to the repository + diff --git a/src/windows/installer/nsis/KfWConfigPage.ini b/src/windows/installer/nsis/KfWConfigPage.ini new file mode 100644 index 000000000..abc0ed63b --- /dev/null +++ b/src/windows/installer/nsis/KfWConfigPage.ini @@ -0,0 +1,59 @@ +[Settings] +NumFields=7 + +[Field 1] +Type=label +Text=The Kerberos Client may utilize configuration files to assist in contacting KDCs. Where do you want to get these files? +Left=0 +Right=-1 +Top=0 +Bottom=20 + +[Field 2] +Type=RadioButton +Text=Use existing configuration files from a previous installation. +Left=10 +Right=-1 +Top=25 +Bottom=35 + +[Field 3] +Type=RadioButton +Text=Use packaged configuration files. +Left=10 +Right=-1 +Top=40 +Bottom=50 + +[Field 4] +type=RadioButton +Text=Download from web path: +State=0 +Left=10 +Right=-1 +Top=55 +Bottom=65 + +[Field 5] +type=Text +State= +Left=20 +Right=-1 +Top=70 +Bottom=80 + +[Field 6] +type=radioButton +text=Select a directory +Left=10 +Right=-1 +Top=85 +Bottom=95 + +[Field 7] +type=DirRequest +Flags=PATH_MUST_EXIST +Left=20 +Right=-40 +Top=100 +Bottom=110 diff --git a/src/windows/installer/nsis/KfWConfigPage2.ini b/src/windows/installer/nsis/KfWConfigPage2.ini new file mode 100644 index 000000000..ffa3d78d7 --- /dev/null +++ b/src/windows/installer/nsis/KfWConfigPage2.ini @@ -0,0 +1,28 @@ +[Settings] +NumFields=3 + +[Field 1] +Type=label +Text=The Leash ticket manager maybe installed with the following optional functionality. Please check those items you wish activated. +Left=0 +Right=-1 +Top=0 +Bottom=20 + +[Field 2] +Type=CheckBox +Text=Autostart the Leash ticket manager each time you login to Windows. +State=1 +Left=10 +Right=-1 +Top=25 +Bottom=35 + +[Field 3] +Type=CheckBox +Text=Ensure that Kerberos tickets are available throughout the Windows logon session [-autoinit]. +State=1 +Left=10 +Right=-1 +Top=40 +Bottom=60 diff --git a/src/windows/installer/nsis/kfw-fixed.nsi b/src/windows/installer/nsis/kfw-fixed.nsi new file mode 100644 index 000000000..6c027f878 --- /dev/null +++ b/src/windows/installer/nsis/kfw-fixed.nsi @@ -0,0 +1,1406 @@ +;----------------------------------------------------------------- +; KfW defines and functionality +; Copyright (c) 2004 Massachusetts Institute of Technology + +!define KFW_VERSION "${KFW_MAJORVERSION}.${KFW_MINORVERSION}" + +!define PROGRAM_NAME "Kerberos for Windows" +!ifdef RELEASE +!ifndef DEBUG ; !DEBUG on v2.0b4 +Name "MIT ${PROGRAM_NAME} ${KFW_VERSION}" +!else ; DEBUG on v2.0b4 +Name "MIT ${PROGRAM_NAME} ${KFW_VERSION} Checked/Debug" +!endif ; End DEBUG/!DEBUG +!else +!ifdef BETA +!ifndef DEBUG ; !DEBUG on v2.0b4 +Name "MIT ${PROGRAM_NAME} ${KFW_VERSION} Beta ${BETA}" +!else ; DEBUG on v2.0b4 +Name "MIT ${PROGRAM_NAME} ${KFW_VERSION} Beta ${BETA} Checked/Debug" +!endif ; End DEBUG/!DEBUG +!else +!ifndef DEBUG ; !DEBUG on v2.0b4 +Name "MIT ${PROGRAM_NAME} ${KFW_VERSION} ${__DATE__} ${__TIME__}" +!else ; DEBUG on v2.0b4 +Name "MIT ${PROGRAM_NAME} ${KFW_VERSION} ${__DATE__} ${__TIME__} Checked/Debug" +!endif ; End DEBUG/!DEBUG +!endif +!endif +VIProductVersion "${KFW_MAJORVERSION}.${KFW_MINORVERSION}.${KFW_PATCHLEVEL}.00" +VIAddVersionKey "ProductName" "${PROGRAM_NAME}" +VIAddVersionKey "CompanyName" "Massachusetts Institute of Technology" +VIAddVersionKey "ProductVersion" ${VIProductVersion} +VIAddVersionKey "FileVersion" ${VIProductVersion} +VIAddVersionKey "FileDescription" "MIT Kerberos for Windows Installer" +VIAddVersionKey "LegalCopyright" "(C)2004" +!ifdef DEBUG +VIAddVersionKey "PrivateBuild" "Checked/Debug" +!endif ; End DEBUG + + +;-------------------------------- +;Configuration + + ;General + SetCompressor bzip2 +!ifndef DEBUG + OutFile "MITKerberosForWindows.exe" +!else + OutFile "MITKerberosForWindows-DEBUG.exe" +!endif + SilentInstall normal + ShowInstDetails show + XPStyle on + !define MUI_ICON "kfw.ico" + !define MUI_UNICON "kfw.ico" + !define KFW_COMPANY_NAME "Massachusetts Institute of Technology" + !define KFW_PRODUCT_NAME "${PROGRAM_NAME}" + !define KFW_REGKEY_ROOT "Software\MIT\Kerberos\" + CRCCheck force + + ;Folder selection page + InstallDir "$PROGRAMFILES\MIT\Kerberos" ; Install to shorter path + + ;Remember install folder + InstallDirRegKey HKLM "${KFW_REGKEY_ROOT}" "" + + ;Remember the installer language + !define MUI_LANGDLL_REGISTRY_ROOT "HKLM" + !define MUI_LANGDLL_REGISTRY_KEY "${KFW_REGKEY_ROOT}" + !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language" + + ;Where are the files? + !define KFW_BIN_DIR "${KFW_TARGETDIR}\bin\i386" + !define KFW_DOC_DIR "${KFW_TARGETDIR}\doc" + !define KFW_INC_DIR "${KFW_TARGETDIR}\inc" + !define KFW_LIB_DIR "${KFW_TARGETDIR}\lib\i386" + !define KFW_INSTALL_DIR "${KFW_TARGETDIR}\install" + !define SYSTEMDIR "$%SystemRoot%\System32" + +;-------------------------------- +;Modern UI Configuration + + !define MUI_LICENSEPAGE + !define MUI_CUSTOMPAGECOMMANDS + !define MUI_WELCOMEPAGE + !define MUI_COMPONENTSPAGE + !define MUI_COMPONENTSPAGE_SMALLDESC + !define MUI_DIRECTORYPAGE + + !define MUI_ABORTWARNING + !define MUI_FINISHPAGE + + !define MUI_UNINSTALLER + !define MUI_UNCONFIRMPAGE + + + !insertmacro MUI_PAGE_WELCOME + !insertmacro MUI_PAGE_LICENSE "Licenses.rtf" + !insertmacro MUI_PAGE_COMPONENTS + !insertmacro MUI_PAGE_DIRECTORY + Page custom KFWPageGetConfigFiles + Page custom KFWPageGetStartupConfig + !insertmacro MUI_PAGE_INSTFILES + !insertmacro MUI_PAGE_FINISH + +;-------------------------------- +;Languages + + !insertmacro MUI_LANGUAGE "English" + +;-------------------------------- +;Language Strings + + ;Descriptions + LangString DESC_SecCopyUI ${LANG_ENGLISH} "${PROGRAM_NAME}: English" + + LangString DESC_secClient ${LANG_ENGLISH} "Client: Allows you to utilize MIT Kerberos from your Windows PC." + + LangString DESC_secSDK ${LANG_ENGLISH} "SDK: Allows you to build MIT Kerberos aware applications." + + LangString DESC_secDocs ${LANG_ENGLISH} "Documentation: Release Notes and User Manuals." + +; Popup error messages + LangString RealmNameError ${LANG_ENGLISH} "You must specify a realm name for your client to use." + + LangString ConfigFileError ${LANG_ENGLISH} "You must specify a valid configuration file location from which files can be copied during the install" + + LangString URLError ${LANG_ENGLISH} "You must specify a URL if you choose the option to download the config files." + +; Upgrade/re-install strings + LangString UPGRADE_CLIENT ${LANG_ENGLISH} "Upgrade Kerberos Client" + LangString REINSTALL_CLIENT ${LANG_ENGLISH} "Re-install Kerberos Client" + LangString DOWNGRADE_CLIENT ${LANG_ENGLISH} "Downgrade Kerberos Client" + + LangString UPGRADE_SDK ${LANG_ENGLISH} "Upgrade Kerberos SDK" + LangString REINSTALL_SDK ${LANG_ENGLISH} "Re-install Kerberos SDK" + LangString DOWNGRADE_SDK ${LANG_ENGLISH} "Downgrade Kerberos SDK" + + LangString UPGRADE_DOCS ${LANG_ENGLISH} "Upgrade Kerberos Documentation" + LangString REINSTALL_DOCS ${LANG_ENGLISH} "Re-install Kerberos Documentation" + LangString DOWNGRADE_DOCS ${LANG_ENGLISH} "Downgrade Kerberos Documentation" + + ReserveFile "${KFW_CONFIG_DIR}\krb.con" + ReserveFile "${KFW_CONFIG_DIR}\krbrealm.con" + ReserveFile "${KFW_CONFIG_DIR}\krb5.ini" + !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS ;InstallOptions plug-in + !insertmacro MUI_RESERVEFILE_LANGDLL ;Language selection dialog + +;-------------------------------- +;Reserve Files + + ;Things that need to be extracted on first (keep these lines before any File command!) + ;Only useful for BZIP2 compression + !insertmacro MUI_RESERVEFILE_LANGDLL + + +;-------------------------------- +;Installer Sections + +;---------------------- +; Kerberos for Windows CLIENT +Section "KfW Client" secClient + + SetShellVarContext all + ; Stop any running services or we can't replace the files + ; Stop the running processes + GetTempFileName $R0 + File /oname=$R0 "Killer.exe" ; Might not have the C Runtime Library to run + nsExec::Exec '$R0 leash32.exe' + nsExec::Exec '$R0 krbcc32s.exe' + nsExec::Exec '$R0 k95.exe' + nsExec::Exec '$R0 k95g.exe' + nsExec::Exec '$R0 krb5.exe' + nsExec::Exec '$R0 gss.exe' + + RMDir /r "$INSTDIR\bin" + + ; 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}\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}\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" + +!ifdef DEBUG + File "${KFW_BIN_DIR}\aklog.pdb" + File "${KFW_BIN_DIR}\comerr32.pdb" + File "${KFW_BIN_DIR}\gss.pdb" + File "${KFW_BIN_DIR}\gssapi32.pdb" + File "${KFW_BIN_DIR}\k524init.pdb" + File "${KFW_BIN_DIR}\kclnt32.pdb" + File "${KFW_BIN_DIR}\kdestroy.pdb" + File "${KFW_BIN_DIR}\kinit.pdb" + File "${KFW_BIN_DIR}\klist.pdb" + File "${KFW_BIN_DIR}\krb5_32.pdb" + File "${KFW_BIN_DIR}\krb524.pdb" + File "${KFW_BIN_DIR}\krbcc32.pdb" + File "${KFW_BIN_DIR}\krbcc32s.pdb" + File "${KFW_BIN_DIR}\krbv4w32.pdb" + File "${KFW_BIN_DIR}\leashw32.pdb" + File "${KFW_BIN_DIR}\leash32.pdb" + File "${KFW_BIN_DIR}\ms2mit.pdb" + File "${KFW_BIN_DIR}\wshelp32.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" + + ; Do WINDOWSDIR components + ;SetOutPath "$WINDOWSDIR" +!ifdef DEBUG +!endif + + ; Do Windows SYSDIR (Control panel) + ;SetOutPath "$SYSDIR" +!ifdef DEBUG +!endif + + ; Get Kerberos config files + Call kfw.GetConfigFiles + + Call KFWCommon.Install + + ; KfW Reg entries + DeleteRegKey HKLM "${KFW_REGKEY_ROOT}\Client\CurrentVersion" + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\Client\CurrentVersion" "VersionString" ${KFW_VERSION} + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\Client\CurrentVersion" "Title" "KfW" + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\Client\CurrentVersion" "Description" "${PROGRAM_NAME}" + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\Client\CurrentVersion" "PathName" "$INSTDIR" + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\Client\CurrentVersion" "Software Type" "Authentication" + WriteRegDWORD HKLM "${KFW_REGKEY_ROOT}\Client\CurrentVersion" "MajorVersion" ${KFW_MAJORVERSION} + WriteRegDWORD HKLM "${KFW_REGKEY_ROOT}\Client\CurrentVersion" "MinorVersion" ${KFW_MINORVERSION} + WriteRegDWORD HKLM "${KFW_REGKEY_ROOT}\Client\CurrentVersion" "PatchLevel" ${KFW_PATCHLEVEL} + + DeleteRegKey HKLM "${KFW_REGKEY_ROOT}\Client\${KFW_VERSION}" + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\Client\${KFW_VERSION}" "VersionString" ${KFW_VERSION} + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\Client\${KFW_VERSION}" "Title" "KfW" + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\Client\${KFW_VERSION}" "Description" "${PROGRAM_NAME}" + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\Client\${KFW_VERSION}" "PathName" "$INSTDIR" + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\Client\${KFW_VERSION}" "Software Type" "Authentication" + WriteRegDWORD HKLM "${KFW_REGKEY_ROOT}\Client\${KFW_VERSION}" "MajorVersion" ${KFW_MAJORVERSION} + WriteRegDWORD HKLM "${KFW_REGKEY_ROOT}\Client\${KFW_VERSION}" "MinorVersion" ${KFW_MINORVERSION} + WriteRegDWORD HKLM "${KFW_REGKEY_ROOT}\Client\${KFW_VERSION}" "PatchLevel" ${KFW_PATCHLEVEL} + WriteRegDWORD HKLM "${KFW_REGKEY_ROOT}\Client\${KFW_VERSION}" "PatchLevel" ${KFW_PATCHLEVEL} + + ;Write start menu entries + CreateDirectory "$SMPROGRAMS\${PROGRAM_NAME}" + SetOutPath "$INSTDIR\bin" + CreateShortCut "$SMPROGRAMS\${PROGRAM_NAME}\Uninstall ${PROGRAM_NAME}.lnk" "$INSTDIR\Uninstall.exe" + + ReadINIStr $R0 $1 "Field 2" "State" ; startup + ReadINIStr $R1 $1 "Field 3" "State" ; autoinit + + StrCmp $R1 "0" noauto + CreateShortCut "$SMPROGRAMS\${PROGRAM_NAME}\Leash Kerberos Ticket Manager.lnk" "$INSTDIR\bin\leash32.exe" "-autoinit" "$INSTDIR\bin\leash32.exe" + goto startshort +noauto: + CreateShortCut "$SMPROGRAMS\${PROGRAM_NAME}\Leash Kerberos Ticket Manager.lnk" "$INSTDIR\bin\leash32.exe" "" "$INSTDIR\bin\leash32.exe" + +startshort: + StrCmp $R0 "0" nostart + StrCmp $R1 "0" nostartauto + CreateShortCut "$SMSTARTUP\Leash Kerberos Ticket Manager.lnk" "$INSTDIR\bin\leash32.exe" "-autoinit" "$INSTDIR\bin\leash32.exe" 0 SW_SHOWMINIMIZED + goto checkconflicts +nostartauto: + CreateShortCut "$SMSTARTUP\Leash Kerberos Ticket Manager.lnk" "$INSTDIR\bin\leash32.exe" "" "$INSTDIR\bin\leash32.exe" 0 SW_SHOWMINIMIZED + goto checkconflicts + +nostart: + Delete "$SMSTARTUP\Leash Kerberos Ticket Manager.lnk" + +checkconflicts: + Call GetSystemPath + Push "krb5_32.dll" + Call SearchPath + Pop $R0 + StrCmp $R0 "" addpath + + Push $R0 + Call GetParent + Pop $R0 + StrCmp $R0 "$INSTDIR\bin" addpath + MessageBox MB_OK|MB_ICONINFORMATION|MB_TOPMOST "A previous installation of MIT Kerberos for Windows binaries has been found in folder $R0. This may interfere with the use of the current installation." + +addpath: + ; Add kfw bin to path + Push "$INSTDIR\bin" + Call AddToSystemPath + + Call GetWindowsVersion + Pop $R0 + StrCmp $R0 "2003" addAllowTgtKey + StrCmp $R0 "2000" addAllowTgtKey + StrCmp $R0 "XP" addAllowTgtKey + goto skipAllowTgtKey + +addAllowTgtKey: + ReadRegDWORD $R0 HKLM "SYSTEM\CurrentControlSet\Control\Lsa\Kerberos\Parameters" "AllowTGTSessionKey" + WriteRegDWORD HKLM "${KFW_REGKEY_ROOT}\Client\${KFW_VERSION}" "AllowTGTSessionKeyBackup" $R0 + WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Control\Lsa\Kerberos\Parameters" "AllowTGTSessionKey" "1" +skipAllowTgtKey: + +SectionEnd + +;---------------------- +; Kerberos for Windows SDK +Section "KfW SDK" secSDK + + RMDir /r "$INSTDIR\inc" + RMDir /r "$INSTDIR\lib" + RMDir /r "$INSTDIR\install" + + SetOutPath "$INSTDIR\inc\kclient" + File /r "${KFW_INC_DIR}\kclient\*" + + SetOutPath "$INSTDIR\inc\krb4" + File /r "${KFW_INC_DIR}\krb4\*" + + SetOutPath "$INSTDIR\inc\krb5" + File /r "${KFW_INC_DIR}\krb5\*" + + SetOutPath "$INSTDIR\inc\krbcc" + File /r "${KFW_INC_DIR}\krbcc\*" + + SetOutPath "$INSTDIR\inc\leash" + File /r "${KFW_INC_DIR}\leash\*" + + SetOutPath "$INSTDIR\inc\loadfuncs" + File /r "${KFW_INC_DIR}\loadfuncs\*" + + SetOutPath "$INSTDIR\inc\wshelper" + File /r "${KFW_INC_DIR}\wshelper\*" + + SetOutPath "$INSTDIR\lib\i386" + File /r "${KFW_LIB_DIR}\*" + + SetOutPath "$INSTDIR\install" + File "${KFW_INSTALL_DIR}\*" + + Call KFWCommon.Install + + ; KfW Reg entries + DeleteRegKey HKLM "${KFW_REGKEY_ROOT}\SDK\CurrentVersion" + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\SDK\CurrentVersion" "VersionString" ${KFW_VERSION} + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\SDK\CurrentVersion" "Title" "KfW" + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\SDK\CurrentVersion" "Description" "${PROGRAM_NAME}" + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\SDK\CurrentVersion" "PathName" "$INSTDIR" + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\SDK\CurrentVersion" "Software Type" "Authentication" + WriteRegDWORD HKLM "${KFW_REGKEY_ROOT}\SDK\CurrentVersion" "MajorVersion" ${KFW_MAJORVERSION} + WriteRegDWORD HKLM "${KFW_REGKEY_ROOT}\SDK\CurrentVersion" "MinorVersion" ${KFW_MINORVERSION} + WriteRegDWORD HKLM "${KFW_REGKEY_ROOT}\SDK\CurrentVersion" "PatchLevel" ${KFW_PATCHLEVEL} + + DeleteRegKey HKLM "${KFW_REGKEY_ROOT}\SDK\${KFW_VERSION}" + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\SDK\${KFW_VERSION}" "VersionString" ${KFW_VERSION} + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\SDK\${KFW_VERSION}" "Title" "KfW" + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\SDK\${KFW_VERSION}" "Description" "${PROGRAM_NAME}" + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\SDK\${KFW_VERSION}" "PathName" "$INSTDIR" + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\SDK\${KFW_VERSION}" "Software Type" "Authentication" + WriteRegDWORD HKLM "${KFW_REGKEY_ROOT}\SDK\${KFW_VERSION}" "MajorVersion" ${KFW_MAJORVERSION} + WriteRegDWORD HKLM "${KFW_REGKEY_ROOT}\SDK\${KFW_VERSION}" "MinorVersion" ${KFW_MINORVERSION} + WriteRegDWORD HKLM "${KFW_REGKEY_ROOT}\SDK\${KFW_VERSION}" "PatchLevel" ${KFW_PATCHLEVEL} + WriteRegDWORD HKLM "${KFW_REGKEY_ROOT}\SDK\${KFW_VERSION}" "PatchLevel" ${KFW_PATCHLEVEL} + +SectionEnd + +;---------------------- +; Kerberos for Windows Documentation +Section "KfW Documentation" secDocs + + RMDir /r "$INSTDIR\doc" + + SetOutPath "$INSTDIR\doc" + File "${KFW_DOC_DIR}\relnotes.html" + File "${KFW_DOC_DIR}\leash_userdoc.pdf" + + Call KFWCommon.Install + + ; KfW Reg entries + DeleteRegKey HKLM "${KFW_REGKEY_ROOT}\Documentation\CurrentVersion" + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\Documentation\CurrentVersion" "VersionString" ${KFW_VERSION} + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\Documentation\CurrentVersion" "Title" "KfW" + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\Documentation\CurrentVersion" "Description" "${PROGRAM_NAME}" + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\Documentation\CurrentVersion" "PathName" "$INSTDIR" + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\Documentation\CurrentVersion" "Software Type" "Authentication" + WriteRegDWORD HKLM "${KFW_REGKEY_ROOT}\Documentation\CurrentVersion" "MajorVersion" ${KFW_MAJORVERSION} + WriteRegDWORD HKLM "${KFW_REGKEY_ROOT}\Documentation\CurrentVersion" "MinorVersion" ${KFW_MINORVERSION} + WriteRegDWORD HKLM "${KFW_REGKEY_ROOT}\Documentation\CurrentVersion" "PatchLevel" ${KFW_PATCHLEVEL} + + DeleteRegKey HKLM "${KFW_REGKEY_ROOT}\Documentation\${KFW_VERSION}" + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\Documentation\${KFW_VERSION}" "VersionString" ${KFW_VERSION} + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\Documentation\${KFW_VERSION}" "Title" "KfW" + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\Documentation\${KFW_VERSION}" "Description" "${PROGRAM_NAME}" + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\Documentation\${KFW_VERSION}" "PathName" "$INSTDIR" + WriteRegStr HKLM "${KFW_REGKEY_ROOT}\Documentation\${KFW_VERSION}" "Software Type" "Authentication" + WriteRegDWORD HKLM "${KFW_REGKEY_ROOT}\Documentation\${KFW_VERSION}" "MajorVersion" ${KFW_MAJORVERSION} + WriteRegDWORD HKLM "${KFW_REGKEY_ROOT}\Documentation\${KFW_VERSION}" "MinorVersion" ${KFW_MINORVERSION} + WriteRegDWORD HKLM "${KFW_REGKEY_ROOT}\Documentation\${KFW_VERSION}" "PatchLevel" ${KFW_PATCHLEVEL} + WriteRegDWORD HKLM "${KFW_REGKEY_ROOT}\Documentation\${KFW_VERSION}" "PatchLevel" ${KFW_PATCHLEVEL} + + ;Write start menu entries + CreateDirectory "$SMPROGRAMS\${PROGRAM_NAME}" + SetOutPath "$INSTDIR\doc" + CreateShortCut "$SMPROGRAMS\${PROGRAM_NAME}\Release Notes.lnk" "$INSTDIR\doc\relnotes.html" + CreateShortCut "$SMPROGRAMS\${PROGRAM_NAME}\Leash User Documentation.lnk" "$INSTDIR\doc\leash_userdoc.pdf" + +SectionEnd + +;Display the Finish header +;Insert this macro after the sections if you are not using a finish page +;!insertmacro MUI_SECTIONS_FINISHHEADER + +;-------------------------------- +;Installer Functions + +Function .onInit + !insertmacro MUI_LANGDLL_DISPLAY + + ; Set the default install options + Push $0 + + Call IsUserAdmin + Pop $R0 + StrCmp $R0 "true" checkVer + + MessageBox MB_OK|MB_ICONSTOP|MB_TOPMOST "You must be an administrator of this machine to install this software." + Abort + +checkVer: + ; Check Version of Windows. Do not install onto Windows 95 + Call GetWindowsVersion + Pop $R0 + StrCmp $R0 "95" wrongVersion + goto checkIPHLPAPI + +wrongVersion: + MessageBox MB_OK|MB_ICONSTOP|MB_TOPMOST "MIT ${PROGRAM_NAME} requires Microsoft Windows 98 or higher." + Abort + +checkIPHLPAPI: + ClearErrors + ReadEnvStr $R0 "WinDir" + GetDLLVersion "$R0\System32\iphlpapi.dll" $R1 $R2 + IfErrors +1 +3 + GetDLLVersion "$R0\System\iphlpapi.dll" $R1 $R2 + IfErrors iphlperror + IntOp $R3 $R2 / 0x00010000 + IntCmpU $R3 1952 iphlpwarning checkprevious checkprevious + +iphlperror: + MessageBox MB_OK|MB_ICONSTOP|MB_TOPMOST "MIT ${PROGRAM_NAME} requires Internet Explorer version 5.01 or higher. IPHLPAPI.DLL is missing." + Abort + +iphlpwarning: + MessageBox MB_OK|MB_ICONINFORMATION|MB_TOPMOST "IPHLPAPI.DLL must be upgraded. Please install Internet Explorer 5.01 or higher." + +checkprevious: + ClearErrors + ReadRegStr $R0 HKLM \ + "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_NAME}" \ + "DisplayVersion" + IfErrors contInstall + StrCmp $R0 "${KFW_VERSION}" contInstall + + MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \ + "${PROGRAM_NAME} is already installed. $\n$\nClick `OK` to remove the \ + previous version or `Cancel` to cancel this upgrade or downgrade." \ + IDOK uninst + Abort + +;Run the uninstaller +uninst: + ReadRegStr $R0 HKLM \ + "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_NAME}" \ + "UninstallString" + ClearErrors + ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file + + IfErrors no_remove_uninstaller + ;You can either use Delete /REBOOTOK in the uninstaller or add some code + ;here to remove the uninstaller. Use a registry key to check + ;whether the user has chosen to uninstall. If you are using an uninstaller + ;components page, make sure all sections are uninstalled. + + Push $R1 + Call RestartRequired + Exch $R1 + StrCmp $R1 "1" RestartRequired RestartNotRequired + +RestartRequired: + MessageBox MB_OK|MB_ICONSTOP|MB_TOPMOST "Please reboot and then restart the installer." + Abort + +RestartNotRequired: +no_remove_uninstaller: + +contInstall: + ; Our logic should be like this. + ; 1) If no KfW components are installed, we do a clean install with default options. (Client/Docs) + ; 2) If existing modules are installed, we keep them selected + ; 3) If it is an upgrade, we set the text accordingly, else we mark it as a re-install + ; TODO: Downgrade? + Call IsAnyKfWInstalled + Pop $R0 + StrCmp $R0 "0" DefaultOptions + + Call ShouldClientInstall + Pop $R2 + + StrCmp $R2 "0" NoClient + StrCmp $R2 "1" ReinstallClient + StrCmp $R2 "2" UpgradeClient + StrCmp $R2 "3" DowngradeClient + + SectionGetFlags ${secClient} $0 + IntOp $0 $0 | ${SF_SELECTED} + SectionSetFlags ${secClient} $0 + ;# !insertmacro SelectSection ${secClient} + goto skipClient +NoClient: + ;StrCpy $1 ${secClient} ; Gotta remember which section we are at now... + SectionGetFlags ${secClient} $0 + IntOp $0 $0 & ${SECTION_OFF} + SectionSetFlags ${secClient} $0 + goto skipClient +UpgradeClient: + SectionGetFlags ${secClient} $0 + IntOp $0 $0 | ${SF_SELECTED} + SectionSetFlags ${secClient} $0 + SectionSetText ${secClient} $(UPGRADE_CLIENT) + goto skipClient +ReinstallClient: + SectionGetFlags ${secClient} $0 + IntOp $0 $0 | ${SF_SELECTED} + SectionSetFlags ${secClient} $0 + SectionSetText ${secClient} $(REINSTALL_CLIENT) + goto skipClient +DowngradeClient: + SectionGetFlags ${secClient} $0 + IntOp $0 $0 | ${SF_SELECTED} + SectionSetFlags ${secClient} $0 + SectionSetText ${secClient} $(DOWNGRADE_CLIENT) + goto skipClient + + +skipClient: + + Call ShouldSDKInstall + Pop $R2 + StrCmp $R2 "0" NoSDK + StrCmp $R2 "1" ReinstallSDK + StrCmp $R2 "2" UpgradeSDK + StrCmp $R2 "3" DowngradeSDK + + SectionGetFlags ${secSDK} $0 + IntOp $0 $0 | ${SF_SELECTED} + SectionSetFlags ${secSDK} $0 + ;# !insertmacro UnselectSection ${secSDK} + goto skipSDK + +UpgradeSDK: + SectionGetFlags ${secSDK} $0 + IntOp $0 $0 | ${SF_SELECTED} + SectionSetFlags ${secSDK} $0 + SectionSetText ${secSDK} $(UPGRADE_SDK) + goto skipSDK + +ReinstallSDK: + SectionGetFlags ${secSDK} $0 + IntOp $0 $0 | ${SF_SELECTED} + SectionSetFlags ${secSDK} $0 + SectionSetText ${secSDK} $(REINSTALL_SDK) + goto skipSDK + +DowngradeSDK: + SectionGetFlags ${secSDK} $0 + IntOp $0 $0 | ${SF_SELECTED} + SectionSetFlags ${secSDK} $0 + SectionSetText ${secSDK} $(DOWNGRADE_SDK) + goto skipSDK + +NoSDK: + SectionGetFlags ${secSDK} $0 + IntOp $0 $0 & ${SECTION_OFF} + SectionSetFlags ${secSDK} $0 + ;# !insertmacro UnselectSection ${secSDK} + goto skipSDK + +skipSDK: + + Call ShouldDocumentationInstall + Pop $R2 + StrCmp $R2 "0" NoDocumentation + StrCmp $R2 "1" ReinstallDocumentation + StrCmp $R2 "2" UpgradeDocumentation + StrCmp $R2 "3" DowngradeDocumentation + + SectionGetFlags ${secDocs} $0 + IntOp $0 $0 | ${SF_SELECTED} + SectionSetFlags ${secDocs} $0 + ;# !insertmacro UnselectSection ${secDocs} + goto skipDocumentation + +UpgradeDocumentation: + SectionGetFlags ${secDocs} $0 + IntOp $0 $0 | ${SF_SELECTED} + SectionSetFlags ${secDocs} $0 + SectionSetText ${secDocs} $(UPGRADE_DOCS) + goto skipDocumentation + +ReinstallDocumentation: + SectionGetFlags ${secDocs} $0 + IntOp $0 $0 | ${SF_SELECTED} + SectionSetFlags ${secDocs} $0 + SectionSetText ${secDocs} $(REINSTALL_DOCS) + goto skipDocumentation + +DowngradeDocumentation: + SectionGetFlags ${secDocs} $0 + IntOp $0 $0 | ${SF_SELECTED} + SectionSetFlags ${secDocs} $0 + SectionSetText ${secDocs} $(DOWNGRADE_DOCS) + goto skipDocumentation + +NoDocumentation: + SectionGetFlags ${secDocs} $0 + IntOp $0 $0 & ${SECTION_OFF} + SectionSetFlags ${secDocs} $0 + ;# !insertmacro UnselectSection ${secDocs} + goto skipDocumentation + +skipDocumentation: + goto end + +DefaultOptions: + ; Client Selected + SectionGetFlags ${secClient} $0 + IntOp $0 $0 | ${SF_SELECTED} + SectionSetFlags ${secClient} $0 + + ; SDK NOT selected + SectionGetFlags ${secSDK} $0 + IntOp $0 $0 & ${SECTION_OFF} + SectionSetFlags ${secSDK} $0 + + ; Documentation selected + SectionGetFlags ${secDocs} $0 + IntOp $0 $0 | ${SF_SELECTED} + SectionSetFlags ${secDocs} $0 + goto end + +end: + Pop $0 + + Push $R0 + + ; See if we can set a default installation path... + ReadRegStr $R0 HKLM "${KFW_REGKEY_ROOT}\Client\CurrentVersion" "PathName" + StrCmp $R0 "" TrySDK + StrCpy $INSTDIR $R0 + goto Nope + +TrySDK: + ReadRegStr $R0 HKLM "${KFW_REGKEY_ROOT}\SDK\CurrentVersion" "PathName" + StrCmp $R0 "" TryDocs + StrCpy $INSTDIR $R0 + goto Nope + +TryDocs: + ReadRegStr $R0 HKLM "${KFW_REGKEY_ROOT}\Documentation\CurrentVersion" "PathName" + StrCmp $R0 "" TryRoot + StrCpy $INSTDIR $R0 + goto Nope + +TryRoot: + ReadRegStr $R0 HKLM "${KFW_REGKEY_ROOT}" "InstallDir" + StrCmp $R0 "" Nope + StrCpy $INSTDIR $R0 + +Nope: + Pop $R0 + + GetTempFilename $0 + File /oname=$0 KfWConfigPage.ini + GetTempFilename $1 + File /oname=$1 KfWConfigPage2.ini + +FunctionEnd + + +;-------------------------------- +; These are our cleanup functions +Function .onInstFailed +Delete $0 +Delete $1 +FunctionEnd + +Function .onInstSuccess +Delete $0 +Delete $1 +FunctionEnd + + +;-------------------------------- +;Descriptions + + !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN + !insertmacro MUI_DESCRIPTION_TEXT ${secClient} $(DESC_secClient) + !insertmacro MUI_DESCRIPTION_TEXT ${secSDK} $(DESC_secSDK) + !insertmacro MUI_DESCRIPTION_TEXT ${secDocs} $(DESC_secDocs) + !insertmacro MUI_FUNCTION_DESCRIPTION_END + +;-------------------------------- +;Uninstaller Section + +Section "Uninstall" + ; Make sure the user REALLY wants to do this, unless they did a silent uninstall, in which case...let them! + IfSilent StartRemove ; New in v2.0b4 + MessageBox MB_YESNO "Are you sure you want to remove MIT ${PROGRAM_NAME} from this machine?" IDYES StartRemove + abort + +StartRemove: + + SetShellVarContext all + ; Stop the running processes + GetTempFileName $R0 + File /oname=$R0 "Killer.exe" + nsExec::Exec '$R0 leash32.exe' + nsExec::Exec '$R0 krbcc32s.exe' + + Push "$INSTDIR\bin" + Call un.RemoveFromSystemPath + + ; Delete documentation + Delete "$INSTDIR\doc\relnotes.html" + Delete "$INSTDIR\doc\leash_userdoc.pdf" + + Delete /REBOOTOK "$INSTDIR\bin\aklog.exe" + Delete /REBOOTOK "$INSTDIR\bin\comerr32.dll" + Delete /REBOOTOK "$INSTDIR\bin\gss.exe" + Delete /REBOOTOK "$INSTDIR\bin\gssapi32.dll" + Delete /REBOOTOK "$INSTDIR\bin\k524init.exe" + Delete /REBOOTOK "$INSTDIR\bin\kclnt32.dll" + Delete /REBOOTOK "$INSTDIR\bin\kdestroy.exe" + Delete /REBOOTOK "$INSTDIR\bin\kinit.exe" + Delete /REBOOTOK "$INSTDIR\bin\klist.exe" + Delete /REBOOTOK "$INSTDIR\bin\krb5_32.dll" + Delete /REBOOTOK "$INSTDIR\bin\krb524.dll" + Delete /REBOOTOK "$INSTDIR\bin\krbcc32.dll" + Delete /REBOOTOK "$INSTDIR\bin\krbcc32s.exe" + Delete /REBOOTOK "$INSTDIR\bin\krbv4w32.dll" +!ifdef OLDHELP + Delete /REBOOTOK "$INSTDIR\bin\leash32.hlp" +!else + Delete /REBOOTOK "$INSTDIR\bin\leash32.chm" +!endif + Delete /REBOOTOK "$INSTDIR\bin\leashw32.dll" + Delete /REBOOTOK "$INSTDIR\bin\ms2mit.exe" + Delete /REBOOTOK "$INSTDIR\bin\wshelp32.dll" + Delete /REBOOTOK "$INSTDIR\bin\xpprof32.dll" + +!IFDEF DEBUG + Delete /REBOOTOK "$INSTDIR\bin\aklog.pdb" + Delete /REBOOTOK "$INSTDIR\bin\comerr32.pdb" + Delete /REBOOTOK "$INSTDIR\bin\gss.pdb" + Delete /REBOOTOK "$INSTDIR\bin\gssapi32.pdb" + Delete /REBOOTOK "$INSTDIR\bin\k524init.pdb" + Delete /REBOOTOK "$INSTDIR\bin\kclnt32.pdb" + Delete /REBOOTOK "$INSTDIR\bin\kdestroy.pdb" + Delete /REBOOTOK "$INSTDIR\bin\kinit.pdb" + Delete /REBOOTOK "$INSTDIR\bin\klist.pdb" + Delete /REBOOTOK "$INSTDIR\bin\krb5_32.pdb" + Delete /REBOOTOK "$INSTDIR\bin\krb524.pdb" + Delete /REBOOTOK "$INSTDIR\bin\krbcc32.pdb" + Delete /REBOOTOK "$INSTDIR\bin\krbcc32s.pdb" + Delete /REBOOTOK "$INSTDIR\bin\krbv4w32.pdb" + Delete /REBOOTOK "$INSTDIR\bin\leashw32.pdb" + Delete /REBOOTOK "$INSTDIR\bin\ms2mit.pdb" + Delete /REBOOTOK "$INSTDIR\bin\wshelp32.pdb" + Delete /REBOOTOK "$INSTDIR\bin\xpprof32.pdb" + +!IFDEF CL_1310 + Delete /REBOOTOK "$INSTDIR\bin\msvcr71d.dll" + Delete /REBOOTOK "$INSTDIR\bin\msvcr71d.pdb" + Delete /REBOOTOK "$INSTDIR\bin\msvcp71d.dll" + Delete /REBOOTOK "$INSTDIR\bin\msvcp71d.pdb" + Delete /REBOOTOK "$INSTDIR\bin\mfc71d.dll" + Delete /REBOOTOK "$INSTDIR\bin\mfc71d.pdb" +!ELSE +!IFDEF CL_1300 + Delete /REBOOTOK "$INSTDIR\bin\msvcr70d.dll" + Delete /REBOOTOK "$INSTDIR\bin\msvcr70d.pdb" + Delete /REBOOTOK "$INSTDIR\bin\msvcp70d.dll" + Delete /REBOOTOK "$INSTDIR\bin\msvcp70d.pdb" + Delete /REBOOTOK "$INSTDIR\bin\mfc70d.dll" + Delete /REBOOTOK "$INSTDIR\bin\mfc70d.pdb" +!ELSE + Delete /REBOOTOK "$INSTDIR\bin\mfc42d.dll" + Delete /REBOOTOK "$INSTDIR\bin\mfc42d.pdb" + Delete /REBOOTOK "$INSTDIR\bin\msvcp60d.dll" + Delete /REBOOTOK "$INSTDIR\bin\msvcp60d.pdb" + Delete /REBOOTOK "$INSTDIR\bin\msvcrtd.dll" + Delete /REBOOTOK "$INSTDIR\bin\msvcrtd.pdb" +!ENDIF +!ENDIF +!ELSE +!IFDEF CL_1310 + Delete /REBOOTOK "$INSTDIR\bin\mfc71.dll" + Delete /REBOOTOK "$INSTDIR\bin\msvcr71.dll" + Delete /REBOOTOK "$INSTDIR\bin\msvcp71.dll" + Delete /REBOOTOK "$INSTDIR\bin\MFC71CHS.DLL" + Delete /REBOOTOK "$INSTDIR\bin\MFC71CHT.DLL" + Delete /REBOOTOK "$INSTDIR\bin\MFC71DEU.DLL" + Delete /REBOOTOK "$INSTDIR\bin\MFC71ENU.DLL" + Delete /REBOOTOK "$INSTDIR\bin\MFC71ESP.DLL" + Delete /REBOOTOK "$INSTDIR\bin\MFC71FRA.DLL" + Delete /REBOOTOK "$INSTDIR\bin\MFC71ITA.DLL" + Delete /REBOOTOK "$INSTDIR\bin\MFC71JPN.DLL" + Delete /REBOOTOK "$INSTDIR\bin\MFC71KOR.DLL" +!ELSE +!IFDEF CL_1300 + Delete /REBOOTOK "$INSTDIR\bin\mfc70.dll" + Delete /REBOOTOK "$INSTDIR\bin\msvcr70.dll" + Delete /REBOOTOK "$INSTDIR\bin\msvcp70.dll" + Delete /REBOOTOK "$INSTDIR\bin\MFC70CHS.DLL" + Delete /REBOOTOK "$INSTDIR\bin\MFC70CHT.DLL" + Delete /REBOOTOK "$INSTDIR\bin\MFC70DEU.DLL" + Delete /REBOOTOK "$INSTDIR\bin\MFC70ENU.DLL" + Delete /REBOOTOK "$INSTDIR\bin\MFC70ESP.DLL" + Delete /REBOOTOK "$INSTDIR\bin\MFC70FRA.DLL" + Delete /REBOOTOK "$INSTDIR\bin\MFC70ITA.DLL" + Delete /REBOOTOK "$INSTDIR\bin\MFC70JPN.DLL" + Delete /REBOOTOK "$INSTDIR\bin\MFC70KOR.DLL" +!ELSE + Delete /REBOOTOK "$INSTDIR\bin\mfc42.dll" + Delete /REBOOTOK "$INSTDIR\bin\msvcp60.dll" + Delete /REBOOTOK "$INSTDIR\bin\msvcrt.dll" +!ENDIF +!ENDIF +!ENDIF + Delete /REBOOTOK "$INSTDIR\bin\psapi.dll" + + RMDir "$INSTDIR\bin" + RmDir "$INSTDIR\doc" + RmDir "$INSTDIR\lib" + RmDir "$INSTDIR\inc" + RmDir "$INSTDIR\install" + RMDir "$INSTDIR" + + Delete "$SMPROGRAMS\${PROGRAM_NAME}\Uninstall ${PROGRAM_NAME}.lnk" + Delete "$SMPROGRAMS\${PROGRAM_NAME}\Leash Kerberos Ticket Manager.lnk" + Delete "$SMPROGRAMS\${PROGRAM_NAME}\Release Notes.lnk" + Delete "$SMPROGRAMS\${PROGRAM_NAME}\Leash User Documentation.lnk" + RmDir "$SMPROGRAMS\${PROGRAM_NAME}" + Delete "$SMSTARTUP\Leash Kerberos Ticket Manager.lnk" + + IfSilent SkipAsk +; IfFileExists "$WINDIR\krb5.ini" CellExists SkipDelAsk +; RealmExists: + MessageBox MB_YESNO "Would you like to keep your configuration files?" IDYES SkipDel + SkipAsk: + Delete "$WINDIR\krb5.ini" + Delete "$WINDIR\krb.con" + Delete "$WINDIR\krbrealm.con" + + SkipDel: + Delete "$INSTDIR\Uninstall.exe" + + ; Restore previous value of AllowTGTSessionKey + ReadRegDWORD $R0 HKLM "${KFW_REGKEY_ROOT}\Client\${KFW_VERSION}" "AllowTGTSessionKeyBackup" + WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Control\Lsa\Kerberos\Parameters" "AllowTGTSessionKey" $R0 + + DeleteRegKey HKLM "${KFW_REGKEY_ROOT}\Client\CurrentVersion" + DeleteRegKey HKLM "${KFW_REGKEY_ROOT}\Client" + DeleteRegKey HKLM "${KFW_REGKEY_ROOT}\Documentation\CurrentVersion" + DeleteRegKey HKLM "${KFW_REGKEY_ROOT}\Documentation" + DeleteRegKey HKLM "${KFW_REGKEY_ROOT}\SDK\CurrentVersion" + DeleteRegKey HKLM "${KFW_REGKEY_ROOT}\SDK" + DeleteRegKey /ifempty HKLM "${KFW_REGKEY_ROOT}" + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_NAME}" + + RMDir "$INSTDIR" + +SectionEnd + +;-------------------------------- +;Uninstaller Functions + +Function un.onInit + + ;Get language from registry + ReadRegStr $LANGUAGE ${MUI_LANGDLL_REGISTRY_ROOT} "${MUI_LANGDLL_REGISTRY_KEY}" "${MUI_LANGDLL_REGISTRY_VALUENAME}" + +FunctionEnd + +Function un.onUninstSuccess + + MessageBox MB_OK "Please reboot your machine to complete uninstallation of the software" + +FunctionEnd + +;------------------------------ +; Get the Configurations files from the Internet + +Function kfw.GetConfigFiles + +;Check if we should download Config Files +ReadINIStr $R0 $0 "Field 4" "State" +StrCmp $R0 "1" DoDownload + +;Do nothing if we're keeping the existing file +ReadINIStr $R0 $0 "Field 2" "State" +StrCmp $R0 "1" done + +ReadINIStr $R0 $0 "Field 3" "State" +StrCmp $R0 "1" UsePackaged + +; If none of these, grab file from other location +goto CheckOther + +DoDownload: + ReadINIStr $R0 $0 "Field 5" "State" + NSISdl::download "$R0/krb5.ini" "$WINDIR\krb5.ini" + NSISdl::download "$R0/krb.con" "$WINDIR\krb.con" + NSISdl::download "$R0/krbrealm.con" "$WINDIR\krbrealm.con" + Pop $R0 ;Get the return value + StrCmp $R0 "success" done + MessageBox MB_OK|MB_ICONSTOP "Download failed: $R0" + goto done + +UsePackaged: + SetOutPath "$WINDIR" + File "${KFW_CONFIG_DIR}\krb5.ini" + File "${KFW_CONFIG_DIR}\krb.con" + File "${KFW_CONFIG_DIR}\krbrealm.con" + goto done + +CheckOther: + ReadINIStr $R0 $0 "Field 7" "State" + StrCmp $R0 "" done + CopyFiles "$R0\krb5.ini" "$WINDIR\krb5.ini" + CopyFiles "$R0\krb.con" "$WINDIR\krb.con" + CopyFiles "$R0\krbrealm.con" "$WINDIR\krbrealm.con" + +done: + +FunctionEnd + + + +;------------------------------- +;Do the page to get the Config files + +Function KFWPageGetConfigFiles + ; Skip this page if we are not installing the client + SectionGetFlags ${secClient} $R0 + IntOp $R0 $R0 & ${SF_SELECTED} + StrCmp $R0 "0" Skip + + ; Set the install options here + +startOver: + WriteINIStr $0 "Field 2" "Flags" "DISABLED" + WriteINIStr $0 "Field 3" "State" "1" + WriteINIStr $0 "Field 4" "State" "0" + WriteINIStr $0 "Field 6" "State" "0" + WriteINIStr $0 "Field 3" "Text" "Use packaged configuration files for the ${SAMPLE_CONFIG_REALM} realm." + WriteINIStr $0 "Field 5" "State" "${HTTP_CONFIG_URL}" + + ; If there is an existing krb5.ini file, allow the user to choose it and make it default + IfFileExists "$WINDIR\krb5.ini" +1 notpresent + WriteINIStr $0 "Field 2" "Flags" "ENABLED" + WriteINIStr $0 "Field 2" "State" "1" + WriteINIStr $0 "Field 3" "State" "0" + + notpresent: + + !insertmacro MUI_HEADER_TEXT "Kerberos Configuration" "Please choose a method for installing the Kerberos Configuration files:" + InstallOptions::dialog $0 + Pop $R1 + StrCmp $R1 "cancel" exit + StrCmp $R1 "back" done + StrCmp $R1 "success" done +exit: Quit +done: + + ; Check that if a file is set, a valid filename is entered... + ReadINIStr $R0 $0 "Field 6" "State" + StrCmp $R0 "1" CheckFileName + + ;Check if a URL is specified, one *IS* specified + ReadINIStr $R0 $0 "Field 4" "State" + StrCmp $R0 "1" CheckURL Skip + + CheckURL: + ReadINIStr $R0 $0 "Field 5" "State" + StrCmp $R0 "" +1 Skip + MessageBox MB_OK|MB_ICONSTOP $(URLError) + WriteINIStr $0 "Field 4" "State" "0" + goto startOver + + CheckFileName: + ReadINIStr $R0 $0 "Field 7" "State" + IfFileExists "$R0\krb5.ini" Skip + + MessageBox MB_OK|MB_ICONSTOP $(ConfigFileError) + WriteINIStr $0 "Field 6" "State" "0" + goto startOver + + Skip: + +FunctionEnd + + +;------------------------------- +;Do the page to get the Startup Configuration + +Function KFWPageGetStartupConfig + ; Skip this page if we are not installing the client + SectionGetFlags ${secClient} $R0 + IntOp $R0 $R0 & ${SF_SELECTED} + StrCmp $R0 "0" Skip + + ; Set the install options here + + !insertmacro MUI_HEADER_TEXT "Leash Ticket Manager Setup" "Please select Leash ticket manager setup options:" + InstallOptions::dialog $1 + Pop $R1 + StrCmp $R1 "cancel" exit + StrCmp $R1 "back" done + StrCmp $R1 "success" done +exit: + Quit +done: +skip: + +FunctionEnd + + +;------------- +; Common install routines for each module +Function KFWCommon.Install + + WriteRegStr HKLM "${KFW_REGKEY_ROOT}" "InstallDir" $INSTDIR + + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_NAME}" "DisplayName" "${PROGRAM_NAME}" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_NAME}" "UninstallString" "$INSTDIR\uninstall.exe" +!ifndef DEBUG + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_NAME}" "DisplayVersion" "${KFW_VERSION}" +!else + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_NAME}" "DisplayVersion" "${KFW_VERSION} Checked/Debug" +!endif + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_NAME}" "URLInfoAbout" "http://web.mit.edu/kerberos/" + +!ifdef DEBUG + WriteRegDWORD HKLM "${KFW_REGKEY_ROOT}\CurrentVersion" "Debug" 1 + WriteRegDWORD HKLM "${KFW_REGKEY_ROOT}\${KFW_VERSION}" "Debug" 1 +!else + ; Delete the DEBUG string + DeleteRegValue HKLM "${KFW_REGKEY_ROOT}\CurrentVersion" "Debug" + DeleteRegValue HKLM "${KFW_REGKEY_ROOT}\${KFW_VERSION}" "Debug" +!endif + + WriteUninstaller "$INSTDIR\Uninstall.exe" +FunctionEnd + + +;------------------------------- +; Check if the client should be checked for default install +Function ShouldClientInstall + Push $R0 + StrCpy $R2 "Client" + Call GetInstalledVersion + Pop $R0 + + StrCmp $R0 "" NotInstalled + ; Now we see if it's an older or newer version + + Call GetInstalledVersionMajor + Pop $R0 + IntCmpU $R0 ${KFW_MAJORVERSION} +1 Upgrade Downgrade + + Call GetInstalledVersionMinor + Pop $R0 + IntCmpU $R0 ${KFW_MINORVERSION} +1 Upgrade Downgrade + + Call GetInstalledVersionPatch + Pop $R0 + IntCmpU $R0 ${KFW_PATCHLEVEL} Reinstall Upgrade Downgrade + +Reinstall: + StrCpy $R0 "1" + Exch $R0 + goto end + +Upgrade: + StrCpy $R0 "2" + Exch $R0 + goto end + +Downgrade: + StrCpy $R0 "3" + Exch $R0 + goto end + +NotInstalled: + StrCpy $R0 "0" + Exch $R0 +end: +FunctionEnd + +;------------------------------- +; Check how the Documentation options should be set +Function ShouldDocumentationInstall + Push $R0 + StrCpy $R2 "Documentation" + Call GetInstalledVersion + Pop $R0 + + StrCmp $R0 "" NotInstalled + ; Now we see if it's an older or newer version + + Call GetInstalledVersionMajor + Pop $R0 + IntCmpU $R0 ${KFW_MAJORVERSION} +1 Upgrade Downgrade + + Call GetInstalledVersionMinor + Pop $R0 + IntCmpU $R0 ${KFW_MINORVERSION} +1 Upgrade Downgrade + + Call GetInstalledVersionPatch + Pop $R0 + IntCmpU $R0 ${KFW_PATCHLEVEL} Reinstall Upgrade Downgrade + +Reinstall: + StrCpy $R0 "1" + Exch $R0 + goto end + +Upgrade: + StrCpy $R0 "2" + Exch $R0 + goto end + +Downgrade: + StrCpy $R0 "3" + Exch $R0 + goto end + + +NotInstalled: + StrCpy $R0 "0" + Exch $R0 +end: +FunctionEnd + + +;------------------------------- +; Check how the SDK options should be set +Function ShouldSDKInstall + Push $R0 + StrCpy $R2 "SDK" + Call GetInstalledVersion + Pop $R0 + + StrCmp $R0 "" NotInstalled + ; Now we see if it's an older or newer version + + Call GetInstalledVersionMajor + Pop $R0 + IntCmpU $R0 ${KFW_MAJORVERSION} +1 Upgrade Downgrade + + Call GetInstalledVersionMinor + Pop $R0 + IntCmpU $R0 ${KFW_MINORVERSION} +1 Upgrade Downgrade + + Call GetInstalledVersionPatch + Pop $R0 + IntCmpU $R0 ${KFW_PATCHLEVEL} Reinstall Upgrade Downgrade + +Reinstall: + StrCpy $R0 "1" + Exch $R0 + goto end + +Upgrade: + StrCpy $R0 "2" + Exch $R0 + goto end + +Downgrade: + StrCpy $R0 "3" + Exch $R0 + goto end + + +NotInstalled: + StrCpy $R0 "0" + Exch $R0 +end: +FunctionEnd + +; See if KfW SDK is installed +; Returns: "1" if it is, 0 if it is not (on the stack) +Function IsSDKInstalled + Push $R0 + StrCpy $R2 "SDK" + Call GetInstalledVersion + Pop $R0 + + StrCmp $R0 "" NotInstalled + + StrCpy $R0 "1" + Exch $R0 + goto end + +NotInstalled: + StrCpy $R0 "0" + Exch $R0 +end: +FunctionEnd + + +; See if KfW Client is installed +; Returns: "1" if it is, 0 if it is not (on the stack) +Function IsClientInstalled + Push $R0 + StrCpy $R2 "Client" + Call GetInstalledVersion + Pop $R0 + + StrCmp $R0 "" NotInstalled + + StrCpy $R0 "1" + Exch $R0 + goto end + +NotInstalled: + StrCpy $R0 "0" + Exch $R0 +end: +FunctionEnd + + + +; See if KfW Documentation is installed +; Returns: "1" if it is, 0 if it is not (on the stack) +Function IsDocumentationInstalled + Push $R0 + StrCpy $R2 "Documentation" + Call GetInstalledVersion + Pop $R0 + + StrCmp $R0 "" NotInstalled + + StrCpy $R0 "1" + Exch $R0 + goto end + +NotInstalled: + StrCpy $R0 "0" + Exch $R0 +end: +FunctionEnd + + + +;Check to see if any KfW component is installed +;Returns: Value on stack: "1" if it is, "0" if it is not +Function IsAnyKfWInstalled + Push $R0 + Push $R1 + Push $R2 + Call IsClientInstalled + Pop $R0 + Call IsSDKInstalled + Pop $R1 + Call IsDocumentationInstalled + Pop $R2 + ; Now we must see if ANY of the $Rn values are 1 + StrCmp $R0 "1" SomethingInstalled + StrCmp $R1 "1" SomethingInstalled + StrCmp $R2 "1" SomethingInstalled + ;Nothing installed + StrCpy $R0 "0" + goto end +SomethingInstalled: + StrCpy $R0 "1" +end: + Pop $R2 + Pop $R1 + Exch $R0 +FunctionEnd + +;-------------------------------- +;Handle what must and what must not be installed +Function .onSelChange + ; If they install the SDK, they MUST install the client + SectionGetFlags ${secSDK} $R0 + IntOp $R0 $R0 & ${SF_SELECTED} + StrCmp $R0 "1" MakeClientSelected + goto end + +MakeClientSelected: + SectionGetFlags ${secClient} $R0 + IntOp $R0 $R0 | ${SF_SELECTED} + SectionSetFlags ${secClient} $R0 + +end: +FunctionEnd + diff --git a/src/windows/installer/nsis/kfw.ico b/src/windows/installer/nsis/kfw.ico new file mode 100644 index 0000000000000000000000000000000000000000..9ef4f96ffcb8230f5111a031e4a4bbf17481f5b9 GIT binary patch literal 25214 zcmeHv34DxK+x|0|Bs1CfglrQLNkl?Ih<##!ei_MM{)vE1^oOs*^@!O62}u_cKc-i?7Su_x*m~@BbdI=bY=T_qor0o+l#+62VD` zkN1RaFN|{(gw=u|goT;-k9LAk4nI#%6OWb%!W}08@dd<}3%lI~!QF-9o4H&Nj@IV* zCO*zV5Qc|a;)e;l>j}cCC`){B#GBO95Q7qAzL&j{5VGS@s78pTE z6fouGisB(33)F-Z#eyIuvWQhmrJ~bEHboHR#swArNnGFJ{j5ou(WFdcb~Z9mu>S{Q zz)Uz{;7P?z67YOdoHRv{O)=$SB;(9l=`J52_=$ojJI8<+FgXxG5L}w*kqWRVyOf@= z{|80K;iatbM^)i1%PAK9*k8jBHjr6^3O6z_v#v`QpeM*pUi?&=bO_fJK~xqMYuNwc zSbo}?Vy*~1GD&X}P?W6%vu48~N;CO6qE53 zD`|;t5--O}#k~0;R>x>kwAB+1jYecjJWcu#DdLM+7`fhJQnNReYS>lE{-REpRTv0c zqbW7DM71!3wf>cZN^Kg{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ZS zhUU$9afp9nX0hPB8W*hX9w#+R+=;mVYTbp6>({$4UAlDm+*ju)k>4}VDl?`{=oK8A zfbZCnsYyb|Yf({kRfx~?-QTV|(h3(ZT(CQL<_zzP|3|ZF)20@24I-aJ)QhA^FHaqh z$gFohL;RmG_yH>o?ho)6Vc5);V}b$rr*jSH<+-Rqx(O243@IZQ{jd-)U_XI_3`2p5 zh@nJs5ttyAlrCOXXv*!7ts|~}+yRBe1o4UzfATJv4uN5?B?3SHwh2JWuE0p37tjdc zGaQeZKk5sPZIaurLAS&q_K0dXxi*KR5voJ$j?6za=X!>wD~k*!3ykQovi6QbZmbH`L{)S=d8Ko zGJADM`YmPDOw6(-bNR{@e0#oy#_u>z3Uv;7g+yA@28RXzo|u%#byonQ{;yuS7=149 ztK)a>-xoL5<=9K#DJ`YJ*Kd=s?gR1L9mEy$=$O)p_16w?1*~T8zJ1R1q9O~rrgWxe zO`4Ej2>nE_fTj38=|PCXOCB z*9pI>#x(7hD3U%dp9$p1rKRLH+3ENE887lii$|!;7!Xo?bV+ZeFXF%~J+- zOalYpC6JH!3HhkF7^~r5oC2_o+>*gzhpWpUdzokc? zCN^rY41STov&t6crKR +; based on the OpenAFS installer written by Rob Murawski +; +;Based on: +;NSIS Modern User Interface version 1.63 +;MultiLanguage Example Script +;Written by Joost Verburg +; +; This version compiles with NSIS v2.0b4 + +!include site-local.nsi +!include "MUI.nsh" +!include Sections.nsh +!include "kfw-fixed.nsi" +!include "utils.nsi" diff --git a/src/windows/installer/nsis/killer.cpp b/src/windows/installer/nsis/killer.cpp new file mode 100644 index 000000000..7ba27fc20 --- /dev/null +++ b/src/windows/installer/nsis/killer.cpp @@ -0,0 +1,380 @@ +/* + Process Killer for NSIS script + + Rob Murawski + + Released under terms of IBM Open Source agreement for OpenAFS + + */ + + +#include +#include +#include +#include + +char strProcessName[256]; + +typedef BOOL (CALLBACK *PROCENUMPROC)(DWORD, WORD, LPSTR, LPARAM); + +typedef struct { + DWORD dwPID; + PROCENUMPROC lpProc; + DWORD lParam; + BOOL bEnd; +} EnumInfoStruct; + +BOOL WINAPI EnumProcs(PROCENUMPROC lpProc, LPARAM lParam); + +BOOL WINAPI Enum16(DWORD dwThreadId, WORD hMod16, WORD hTask16, + PSZ pszModName, PSZ pszFileName, LPARAM lpUserDefined); + +// +// The EnumProcs function takes a pointer to a callback function +// that will be called once per process with the process filename +// and process ID. +// +// lpProc -- Address of callback routine. +// +// lParam -- A user-defined LPARAM value to be passed to +// the callback routine. +// +// Callback function definition: +// BOOL CALLBACK Proc(DWORD dw, WORD w, LPCSTR lpstr, LPARAM lParam); +// +BOOL WINAPI EnumProcs(PROCENUMPROC lpProc, LPARAM lParam) { + + OSVERSIONINFO osver; + HINSTANCE hInstLib = NULL; + HINSTANCE hInstLib2 = NULL; + HANDLE hSnapShot = NULL; + LPDWORD lpdwPIDs = NULL; + PROCESSENTRY32 procentry; + BOOL bFlag; + DWORD dwSize; + DWORD dwSize2; + DWORD dwIndex; + HMODULE hMod; + HANDLE hProcess; + char szFileName[MAX_PATH]; + EnumInfoStruct sInfo; + + // ToolHelp Function Pointers. + HANDLE (WINAPI *lpfCreateToolhelp32Snapshot)(DWORD, DWORD); + BOOL (WINAPI *lpfProcess32First)(HANDLE, LPPROCESSENTRY32); + BOOL (WINAPI *lpfProcess32Next)(HANDLE, LPPROCESSENTRY32); + + // PSAPI Function Pointers. + BOOL (WINAPI *lpfEnumProcesses)(DWORD *, DWORD, DWORD *); + BOOL (WINAPI *lpfEnumProcessModules)(HANDLE, HMODULE *, DWORD, + LPDWORD); + DWORD (WINAPI *lpfGetModuleBaseName)(HANDLE, HMODULE, LPTSTR, DWORD); + + // VDMDBG Function Pointers. + INT (WINAPI *lpfVDMEnumTaskWOWEx)(DWORD, TASKENUMPROCEX, LPARAM); + + // Retrieve the OS version + osver.dwOSVersionInfoSize = sizeof(osver); + if (!GetVersionEx(&osver)) + return FALSE; + + // If Windows NT 4.0 + if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT + && osver.dwMajorVersion == 4) { + + __try { + + // Get the procedure addresses explicitly. We do + // this so we don't have to worry about modules + // failing to load under OSes other than Windows NT 4.0 + // because references to PSAPI.DLL can't be resolved. + hInstLib = LoadLibraryA("PSAPI.DLL"); + if (hInstLib == NULL) + __leave; + + hInstLib2 = LoadLibraryA("VDMDBG.DLL"); + if (hInstLib2 == NULL) + __leave; + + // Get procedure addresses. + lpfEnumProcesses = (BOOL (WINAPI *)(DWORD *, DWORD, DWORD*)) + GetProcAddress(hInstLib, "EnumProcesses"); + + lpfEnumProcessModules = (BOOL (WINAPI *)(HANDLE, HMODULE *, + DWORD, LPDWORD)) GetProcAddress(hInstLib, + "EnumProcessModules"); + + lpfGetModuleBaseName = (DWORD (WINAPI *)(HANDLE, HMODULE, + LPTSTR, DWORD)) GetProcAddress(hInstLib, + "GetModuleBaseNameA"); + + lpfVDMEnumTaskWOWEx = (INT (WINAPI *)(DWORD, TASKENUMPROCEX, + LPARAM)) GetProcAddress(hInstLib2, "VDMEnumTaskWOWEx"); + + if (lpfEnumProcesses == NULL + || lpfEnumProcessModules == NULL + || lpfGetModuleBaseName == NULL + || lpfVDMEnumTaskWOWEx == NULL) + __leave; + + // + // Call the PSAPI function EnumProcesses to get all of the + // ProcID's currently in the system. + // + // NOTE: In the documentation, the third parameter of + // EnumProcesses is named cbNeeded, which implies that you + // can call the function once to find out how much space to + // allocate for a buffer and again to fill the buffer. + // This is not the case. The cbNeeded parameter returns + // the number of PIDs returned, so if your buffer size is + // zero cbNeeded returns zero. + // + // NOTE: The "HeapAlloc" loop here ensures that we + // actually allocate a buffer large enough for all the + // PIDs in the system. + // + dwSize2 = 256 * sizeof(DWORD); + do { + + if (lpdwPIDs) { + HeapFree(GetProcessHeap(), 0, lpdwPIDs); + dwSize2 *= 2; + } + + lpdwPIDs = (LPDWORD) HeapAlloc(GetProcessHeap(), 0, + dwSize2); + if (lpdwPIDs == NULL) + __leave; + + if (!lpfEnumProcesses(lpdwPIDs, dwSize2, &dwSize)) + __leave; + + } while (dwSize == dwSize2); + + // How many ProcID's did we get? + dwSize /= sizeof(DWORD); + + // Loop through each ProcID. + for (dwIndex = 0; dwIndex < dwSize; dwIndex++) { + + szFileName[0] = 0; + + // Open the process (if we can... security does not + // permit every process in the system to be opened). + hProcess = OpenProcess( + PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, + FALSE, lpdwPIDs[dwIndex]); + if (hProcess != NULL) { + + // Here we call EnumProcessModules to get only the + // first module in the process. This will be the + // EXE module for which we will retrieve the name. + if (lpfEnumProcessModules(hProcess, &hMod, + sizeof(hMod), &dwSize2)) { + + // Get the module name + if (!lpfGetModuleBaseName(hProcess, hMod, + szFileName, sizeof(szFileName))) + szFileName[0] = 0; + } + CloseHandle(hProcess); + } + // Regardless of OpenProcess success or failure, we + // still call the enum func with the ProcID. + if (!lpProc(lpdwPIDs[dwIndex], 0, szFileName, lParam)) + break; + + // Did we just bump into an NTVDM? + if (_stricmp(szFileName, "NTVDM.EXE") == 0) { + + // Fill in some info for the 16-bit enum proc. + sInfo.dwPID = lpdwPIDs[dwIndex]; + sInfo.lpProc = lpProc; + sInfo.lParam = (DWORD) lParam; + sInfo.bEnd = FALSE; + + // Enum the 16-bit stuff. + lpfVDMEnumTaskWOWEx(lpdwPIDs[dwIndex], + (TASKENUMPROCEX) Enum16, (LPARAM) &sInfo); + + // Did our main enum func say quit? + if (sInfo.bEnd) + break; + } + } + + } __finally { + + if (hInstLib) + FreeLibrary(hInstLib); + + if (hInstLib2) + FreeLibrary(hInstLib2); + + if (lpdwPIDs) + HeapFree(GetProcessHeap(), 0, lpdwPIDs); + } + + // If any OS other than Windows NT 4.0. + } else if (osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS + || (osver.dwPlatformId == VER_PLATFORM_WIN32_NT + && osver.dwMajorVersion > 4)) { + + __try { + + hInstLib = LoadLibraryA("Kernel32.DLL"); + if (hInstLib == NULL) + __leave; + + // If NT-based OS, load VDMDBG.DLL. + if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT) { + hInstLib2 = LoadLibraryA("VDMDBG.DLL"); + if (hInstLib2 == NULL) + __leave; + } + + // Get procedure addresses. We are linking to + // these functions explicitly, because a module using + // this code would fail to load under Windows NT, + // which does not have the Toolhelp32 + // functions in KERNEL32.DLL. + lpfCreateToolhelp32Snapshot = + (HANDLE (WINAPI *)(DWORD,DWORD)) + GetProcAddress(hInstLib, "CreateToolhelp32Snapshot"); + + lpfProcess32First = + (BOOL (WINAPI *)(HANDLE,LPPROCESSENTRY32)) + GetProcAddress(hInstLib, "Process32First"); + + lpfProcess32Next = + (BOOL (WINAPI *)(HANDLE,LPPROCESSENTRY32)) + GetProcAddress(hInstLib, "Process32Next"); + + if (lpfProcess32Next == NULL + || lpfProcess32First == NULL + || lpfCreateToolhelp32Snapshot == NULL) + __leave; + + if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT) { + lpfVDMEnumTaskWOWEx = (INT (WINAPI *)(DWORD, TASKENUMPROCEX, + LPARAM)) GetProcAddress(hInstLib2, "VDMEnumTaskWOWEx"); + if (lpfVDMEnumTaskWOWEx == NULL) + __leave; + } + + // Get a handle to a Toolhelp snapshot of all processes. + hSnapShot = lpfCreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + if (hSnapShot == INVALID_HANDLE_VALUE) { + FreeLibrary(hInstLib); + return FALSE; + } + + // Get the first process' information. + procentry.dwSize = sizeof(PROCESSENTRY32); + bFlag = lpfProcess32First(hSnapShot, &procentry); + + // While there are processes, keep looping. + while (bFlag) { + + // Call the enum func with the filename and ProcID. + if (lpProc(procentry.th32ProcessID, 0, + procentry.szExeFile, lParam)) { + + // Did we just bump into an NTVDM? + if (_stricmp(procentry.szExeFile, "NTVDM.EXE") == 0) { + + // Fill in some info for the 16-bit enum proc. + sInfo.dwPID = procentry.th32ProcessID; + sInfo.lpProc = lpProc; + sInfo.lParam = (DWORD) lParam; + sInfo.bEnd = FALSE; + + // Enum the 16-bit stuff. + lpfVDMEnumTaskWOWEx(procentry.th32ProcessID, + (TASKENUMPROCEX) Enum16, (LPARAM) &sInfo); + + // Did our main enum func say quit? + if (sInfo.bEnd) + break; + } + + procentry.dwSize = sizeof(PROCESSENTRY32); + bFlag = lpfProcess32Next(hSnapShot, &procentry); + + } else + bFlag = FALSE; + } + + } __finally { + + if (hInstLib) + FreeLibrary(hInstLib); + + if (hInstLib2) + FreeLibrary(hInstLib2); + } + + } else + return FALSE; + + // Free the library. + FreeLibrary(hInstLib); + + return TRUE; +} + + +BOOL WINAPI Enum16(DWORD dwThreadId, WORD hMod16, WORD hTask16, + PSZ pszModName, PSZ pszFileName, LPARAM lpUserDefined) { + + BOOL bRet; + + EnumInfoStruct *psInfo = (EnumInfoStruct *)lpUserDefined; + + bRet = psInfo->lpProc(psInfo->dwPID, hTask16, pszFileName, + psInfo->lParam); + + if (!bRet) + psInfo->bEnd = TRUE; + + return !bRet; +} + + +BOOL CALLBACK MyProcessEnumerator(DWORD dwPID, WORD wTask, + LPCSTR szProcess, LPARAM lParam) { + + /*if (wTask == 0) + printf("%5u %s\n", dwPID, szProcess); + else + printf(" %5u %s\n", wTask, szProcess);*/ + + if(stricmp(szProcess,strProcessName)==0) + { + HANDLE hProcess=OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwPID); + if(hProcess!=NULL) + TerminateProcess(hProcess,0); + CloseHandle(hProcess); + } + + return TRUE; +} + + +void main(int argc, char *argv[]) +{ + if(argc<2) + { + printf("Please specify the process name to kill\n"); + + return; + } + + if(strlen((argv[1]))<255) + strcpy(strProcessName,(argv[1])); + else + return; + + EnumProcs((PROCENUMPROC) MyProcessEnumerator, 0); + +} diff --git a/src/windows/installer/nsis/licenses.rtf b/src/windows/installer/nsis/licenses.rtf new file mode 100644 index 000000000..d5c43e2a3 --- /dev/null +++ b/src/windows/installer/nsis/licenses.rtf @@ -0,0 +1,98 @@ +{\rtf1\ansi\ansicpg1252\deff0\deflang1033\deflangfe1033{\fonttbl{\f0\fmodern\fprq1\fcharset0 Courier New;}{\f1\froman\fprq2\fcharset0 Times New Roman;}} +{\*\generator Msftedit 5.41.15.1503;}\viewkind4\uc1\pard\tx916\tx1832\tx2748\tx3664\tx4580\tx5496\tx6412\tx7328\tx8244\tx9160\tx10076\tx10992\tx11908\tx12824\tx13740\tx14656\f0\fs20 Copyright Notice and Legal Administrivia\par +----------------------------------------\par +\par +Copyright (C) 1985-2004 by the Massachusetts Institute of Technology.\par +\par +All rights reserved.\par +\par +Export of this software from the United States of America may require a specific license from the United States Government. It is the responsibility of any person or organization contemplating export to obtain such a license before exporting.\par +\par +WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and\par +this permission notice appear in supporting documentation, and that the name of M.I.T. not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Furthermore if you modify this software you must label your software as modified software and not distribute it in such a fashion that it might be confused with the original MIT software. M.I.T. makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.\par +\par +THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.\par +\par +Individual source code files are copyright MIT, Cygnus Support, OpenVision, Oracle, Sun Soft, FundsXpress, and others.\par +\par +Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira, and Zephyr are trademarks of the Massachusetts Institute of Technology (MIT). No commercial use of these trademarks may be made without prior written permission of MIT.\par +\par +"Commercial use" means use of a name in a product or other for-profit manner. It does NOT prevent a commercial firm from referring to the MIT trademarks in order to convey information (although in doing so, recognition of their trademark status should be given).\par +\par +----\par +\par +The following copyright and permission notice applies to the OpenVision Kerberos Administration system located in kadmin/create, kadmin/dbutil, kadmin/passwd, kadmin/server, lib/kadm5, and portions of lib/rpc:\par +\par +Copyright, OpenVision Technologies, Inc., 1996, All Rights Reserved\par +\par +WARNING: Retrieving the OpenVision Kerberos Administration system source code, as described below, indicates your acceptance of the following terms. If you do not agree to the following terms, do not retrieve the OpenVision Kerberos administration system.\par +\par +You may freely use and distribute the Source Code and Object Code compiled from it, with or without modification, but this Source Code is provided to you "AS IS" EXCLUSIVE OF ANY WARRANTY, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, OR ANY OTHER WARRANTY, WHETHER EXPRESS OR IMPLIED. IN NO EVENT WILL OPENVISION HAVE ANY LIABILITY FOR ANY LOST PROFITS, LOSS OF DATA OR COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, INCLUDING, WITHOUT LIMITATION, THOSE RESULTING FROM THE USE OF THE SOURCE CODE, OR THE FAILURE OF THE SOURCE CODE TO PERFORM, OR FOR ANY OTHER REASON.\par +\par +OpenVision retains all copyrights in the donated Source Code. OpenVision also retains copyright to derivative works of the Source Code, whether created by OpenVision or by a third party. The OpenVision copyright notice must be preserved if derivative works are made based on the donated Source Code.\par +\par +OpenVision Technologies, Inc. has donated this Kerberos Administration system to MIT for inclusion in the standard Kerberos 5 distribution. This donation underscores our commitment to continuing Kerberos technology development and our gratitude for the valuable work which has been performed by MIT and the Kerberos community.\par +\par +----\par +\par +Portions contributed by Matt Crawford were work performed at Fermi National Accelerator Laboratory, which is operated by Universities Research Association, Inc., under contract DE-AC02-76CHO3000 with the U.S. Department of Energy.\par +\par +---- The implementation of the Yarrow pseudo-random number generator in src/lib/crypto/yarrow has the following copyright:\par +\par +Copyright 2000 by Zero-Knowledge Systems, Inc.\par +\par +Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Zero-Knowledge Systems, Inc. not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Zero-Knowledge Systems, Inc. makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.\par +\par +ZERO-KNOWLEDGE SYSTEMS, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL ZERO-KNOWLEDGE SYSTEMS, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\par +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\par +\par +---- The implementation of the AES encryption algorithm in src/lib/crypto/aes has the following copyright:\par +\par +Copyright (c) 2001, Dr Brian Gladman , Worcester, UK.\par +All rights reserved.\par +\par +LICENSE TERMS\par +\par +The free distribution and use of this software in both source and binary form is allowed (with or without changes) provided that:\par +\par +1. distributions of this source code include the above copyright notice, this list of conditions and the following disclaimer;\par +\par +2. distributions in binary form include the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other associated materials;\par +\par +3. the copyright holder's name is not used to endorse products built using this software without specific written permission. \par +\par +DISCLAIMER\par +\par +This software is provided 'as is' with no explcit or implied warranties in respect of any properties, including, but not limited to, correctness and fitness for purpose.\par +\par +\par +\par +Acknowledgements\par +----------------\par +\par +Appreciation Time!!!! There are far too many people to try to thank them all; many people have contributed to the development of Kerberos V5. This is only a partial listing....\par +\par +Thanks to Paul Vixie and the Internet Software Consortium for funding the work of Barry Jaspan. This funding was invaluable for the OV administration server integration, as well as the 1.0 release preparation process.\par +\par +Thanks to John Linn, Scott Foote, and all of the folks at OpenVision Technologies, Inc., who donated their administration server for use in the MIT release of Kerberos.\par +\par +Thanks to Jeff Bigler, Mark Eichin, Marc Horowitz, Nancy Gilman, Ken Raeburn, and all of the folks at Cygnus Support, who provided innumerable bug fixes and portability enhancements to the Kerberos V5 tree. Thanks especially to Jeff Bigler, for the new user and system administrator's documentation.\par +\par +Thanks to Doug Engert from ANL for providing many bug fixes, as well as testing to ensure DCE interoperability.\par +\par +Thanks to Ken Hornstein at NRL for providing many bug fixes and suggestions, and for working on SAM preauthentication.\par +\par +Thanks to Matt Crawford at FNAL for bugfixes and enhancements.\par +\par +Thanks to Sean Mullan and Bill Sommerfeld from Hewlett Packard for their many suggestions and bug fixes.\par +\par +Thanks to Nalin Dahyabhai of RedHat and Chris Evans for locating and providing patches for numerous buffer overruns.\par +\par +Thanks to Christopher Thompson and Marcus Watts for discovering the ftpd security bug.\par +\par +Thanks to Paul Nelson of Thursby Software Systems for implementing the Microsoft set password protocol.\par +\par +Thanks to the members of the Kerberos V5 development team at MIT, both past and present: Danilo Almeida, Jeffrey Altman, Jay Berkenbilt, Richard Basch, Mitch Berger, John Carr, Don Davis, Alexandra Ellwood, Nancy Gilman, Matt Hancher, Sam Hartman, Paul Hill, Marc Horowitz, Eva Jacobus, Miroslav Jurisic, Barry Jaspan, Geoffrey King, John Kohl, Peter Litwack, Scott McGuire, Kevin Mitchell, Cliff Neuman, Paul Park, Ezra Peisach, Chris Provenzano, Ken Raeburn, Jon Rochlis, Jeff Schiller, Jen Selby, Brad Thompson, Harry Tsai, Ted Ts'o, Marshall Vale, Tom Yu.\par +\pard\f1\fs24\par +} + \ No newline at end of file diff --git a/src/windows/installer/nsis/nsi-includes.nsi b/src/windows/installer/nsis/nsi-includes.nsi new file mode 100644 index 000000000..e5b4580b9 --- /dev/null +++ b/src/windows/installer/nsis/nsi-includes.nsi @@ -0,0 +1,8 @@ +!define KFW_TARGETDIR c:\temp\kfw\kfw-2.6 +!define KFW_EXTRADIR c:\temp\kfw\kfw-2.5-extra +!define KFW_VERSION 2.6 +!define KFW_MAJORVERSION 2 +!define KFW_MINORVERSION 6 +!define KFW_PATCHLEVEL 0000 +!define CL_1310 + diff --git a/src/windows/installer/nsis/site-local.nsi b/src/windows/installer/nsis/site-local.nsi new file mode 100644 index 000000000..5c59778d9 --- /dev/null +++ b/src/windows/installer/nsis/site-local.nsi @@ -0,0 +1,10 @@ +!define KFW_TARGETDIR c:\temp\kfw\kfw-2.6-final +!define KFW_CONFIG_DIR "c:\temp\kfw\kfw-2.5-extra\sample-config" +!define KFW_MAJORVERSION 2 +!define KFW_MINORVERSION 6 +!define KFW_PATCHLEVEL 0000 +!define CL_1310 + +!define SAMPLE_CONFIG_REALM "ATHENA.MIT.EDU" +!define HTTP_CONFIG_URL "[Obtain a URL from your Kerberos administrator]" + diff --git a/src/windows/installer/nsis/utils.nsi b/src/windows/installer/nsis/utils.nsi new file mode 100644 index 000000000..f8f45fb5b --- /dev/null +++ b/src/windows/installer/nsis/utils.nsi @@ -0,0 +1,779 @@ +;----------------------------------------------- +; Common Utility functions not specific to KFW + +;------------------- +; Get the currently installed version and place it on the stack +; Modifies: Nothing +Function GetInstalledVersion + Push $R0 + Push $R1 + Push $R4 + ReadRegStr $R0 HKLM "${KFW_REGKEY_ROOT}\$R2\CurrentVersion" "VersionString" + StrCmp $R0 "" done + +done: + Pop $R4 + Pop $R1 + Exch $R0 +FunctionEnd + +; Functions to get each component of the version number +Function GetInstalledVersionMajor + Push $R0 + Push $R1 + Push $R4 + ReadRegDWORD $R0 HKLM "${KFW_REGKEY_ROOT}\$R2\CurrentVersion" "MajorVersion" + StrCmp $R0 "" done + +done: + Pop $R4 + Pop $R1 + Exch $R0 +FunctionEnd + +Function GetInstalledVersionMinor + Push $R0 + Push $R1 + Push $R4 + ReadRegDWORD $R0 HKLM "${KFW_REGKEY_ROOT}\$R2\CurrentVersion" "MinorVersion" + StrCmp $R0 "" done + +done: + Pop $R4 + Pop $R1 + Exch $R0 +FunctionEnd + +Function GetInstalledVersionPatch + Push $R0 + Push $R1 + Push $R4 + ReadRegDWORD $R0 HKLM "${KFW_REGKEY_ROOT}\$R2\CurrentVersion" "PatchLevel" + StrCmp $R0 "" done + +done: + Pop $R4 + Pop $R1 + Exch $R0 +FunctionEnd + + +;-------------------------------- +; 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. + + + !macro UpgradeDLL LOCALFILE DESTFILE + + Push $R0 + Push $R1 + Push $R2 + Push $R3 + + ;------------------------ + ;Check file and version + + IfFileExists "${DESTFILE}" "" "copy_${LOCALFILE}" + + ClearErrors + GetDLLVersionLocal "${LOCALFILE}" $R0 $R1 + GetDLLVersion "${DESTFILE}" $R2 $R3 + IfErrors "upgrade_${LOCALFILE}" + + IntCmpU $R0 $R2 "" "done_${LOCALFILE}" "upgrade_${LOCALFILE}" + IntCmpU $R1 $R3 "done_${LOCALFILE}" "done_${LOCALFILE}" "upgrade_${LOCALFILE}" + + ;------------------------ + ;Let's upgrade the DLL! + + SetOverwrite try + + "upgrade_${LOCALFILE}:" + !ifndef UPGRADEDLL_NOREGISTER + ;Unregister the DLL + UnRegDLL "${DESTFILE}" + !endif + + ;------------------------ + ;Try to copy the DLL directly + + 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. + + GetTempFileName $R0 + Call ":file_${LOCALFILE}" + Rename /REBOOTOK $R0 "${DESTFILE}" + + ;------------------------ + ;Register the DLL on reboot + + !ifndef UPGRADEDLL_NOREGISTER + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" \ + "Register ${DESTFILE}" '"$SYSDIR\rundll32.exe" "${DESTFILE},DllRegisterServer"' + !endif + + Goto "done_${LOCALFILE}" + + ;------------------------ + ;DLL does not exist - just extract + + "copy_${LOCALFILE}:" + StrCpy $R0 "${DESTFILE}" + Call ":file_${LOCALFILE}" + + ;------------------------ + ;Register the DLL + + "noreboot_${LOCALFILE}:" + !ifndef UPGRADEDLL_NOREGISTER + RegDLL "${DESTFILE}" + !endif + + ;------------------------ + ;Done + + "done_${LOCALFILE}:" + + Pop $R3 + Pop $R2 + Pop $R1 + Pop $R0 + + ;------------------------ + ;End + + Goto "end_${LOCALFILE}" + + ;------------------------ + ;Called to extract the DLL + + "file_${LOCALFILE}:" + File /oname=$R0 "${LOCALFILE}" + Return + + "end_${LOCALFILE}:" + + ;------------------------ + ;Set overwrite to default + ;(was set to TRY above) + + SetOverwrite on + + !macroend + +; GetParameters +; input, none +; output, top of stack (replaces, with e.g. whatever) +; modifies no other variables. + +Function GetParameters + Push $R0 + Push $R1 + Push $R2 + StrCpy $R0 $CMDLINE 1 + StrCpy $R1 '"' + StrCpy $R2 1 + StrCmp $R0 '"' loop + StrCpy $R1 ' ' ; we're scanning for a space instead of a quote + loop: + StrCpy $R0 $CMDLINE 1 $R2 + StrCmp $R0 $R1 loop2 + StrCmp $R0 "" loop2 + IntOp $R2 $R2 + 1 + Goto loop + loop2: + IntOp $R2 $R2 + 1 + StrCpy $R0 $CMDLINE 1 $R2 + StrCmp $R0 " " loop2 + StrCpy $R0 $CMDLINE "" $R2 + Pop $R2 + Pop $R1 + Exch $R0 +FunctionEnd + + +!verbose 3 +!include "WinMessages.NSH" +!verbose 4 + +Function GetSystemPath + Push $0 + + Call IsNT + Pop $0 + StrCmp $0 1 GetPath_NT + ReadEnvStr $0 PATH + goto HavePath +GetPath_NT: + ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" +HavePath: + + Exch $0 +FunctionEnd + +;==================================================== +; AddToSystemPath - Adds the given dir to the search path. +; Input - head of the stack +; Note - Win9x systems requires reboot +;==================================================== +Function AddToSystemPath + Exch $0 + Push $1 + Push $2 + Push $3 + + # don't add if the path doesn't exist + IfFileExists $0 "" AddToPath_done + + Call GetSystemPath + Pop $1 + Push "$1;" + Push "$0;" + Call StrStr + Pop $2 + StrCmp $2 "" "" AddToPath_done + Push "$1;" + Push "$0\;" + Call StrStr + Pop $2 + StrCmp $2 "" "" AddToPath_done + GetFullPathName /SHORT $3 $0 + Push "$1;" + Push "$3;" + Call StrStr + Pop $2 + StrCmp $2 "" "" AddToPath_done + Push "$1;" + Push "$3\;" + Call StrStr + Pop $2 + StrCmp $2 "" "" AddToPath_done + + Call IsNT + Pop $1 + StrCmp $1 1 AddToPath_NT + ; Not on NT + StrCpy $1 $WINDIR 2 + FileOpen $1 "$1\autoexec.bat" a + FileSeek $1 -1 END + FileReadByte $1 $2 + IntCmp $2 26 0 +2 +2 # DOS EOF + FileSeek $1 -1 END # write over EOF + FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n" + FileClose $1 + SetRebootFlag true + Goto AddToPath_done + + AddToPath_NT: + ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" + StrCpy $2 $1 1 -1 # copy last char + StrCmp $2 ";" 0 +2 # if last char == ; + StrCpy $1 $1 -1 # remove last char + StrCmp $1 "" AddToPath_NTdoIt + StrCpy $0 "$1;$0" + AddToPath_NTdoIt: + WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $0 + SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 + + AddToPath_done: + Pop $3 + Pop $2 + Pop $1 + Pop $0 +FunctionEnd + +;==================================================== +; RemoveFromPath - Remove a given dir from the path +; Input: head of the stack +;==================================================== +Function un.RemoveFromSystemPath + Exch $0 + Push $1 + Push $2 + Push $3 + Push $4 + Push $5 + Push $6 + + IntFmt $6 "%c" 26 # DOS EOF + + Call un.IsNT + Pop $1 + StrCmp $1 1 unRemoveFromPath_NT + ; Not on NT + StrCpy $1 $WINDIR 2 + FileOpen $1 "$1\autoexec.bat" r + GetTempFileName $4 + FileOpen $2 $4 w + GetFullPathName /SHORT $0 $0 + StrCpy $0 "SET PATH=%PATH%;$0" + Goto unRemoveFromPath_dosLoop + + unRemoveFromPath_dosLoop: + FileRead $1 $3 + StrCpy $5 $3 1 -1 # read last char + StrCmp $5 $6 0 +2 # if DOS EOF + StrCpy $3 $3 -1 # remove DOS EOF so we can compare + StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine + StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine + StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine + StrCmp $3 "" unRemoveFromPath_dosLoopEnd + FileWrite $2 $3 + Goto unRemoveFromPath_dosLoop + unRemoveFromPath_dosLoopRemoveLine: + SetRebootFlag true + Goto unRemoveFromPath_dosLoop + + unRemoveFromPath_dosLoopEnd: + FileClose $2 + FileClose $1 + StrCpy $1 $WINDIR 2 + Delete "$1\autoexec.bat" + CopyFiles /SILENT $4 "$1\autoexec.bat" + Delete $4 + Goto unRemoveFromPath_done + + unRemoveFromPath_NT: + ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" + StrCpy $5 $1 1 -1 # copy last char + StrCmp $5 ";" +2 # if last char != ; + StrCpy $1 "$1;" # append ; + Push $1 + Push "$0;" + Call un.StrStr ; Find `$0;` in $1 + Pop $2 ; pos of our dir + StrCmp $2 "" unRemoveFromPath_done + ; else, it is in path + # $0 - path to add + # $1 - path var + StrLen $3 "$0;" + StrLen $4 $2 + StrCpy $5 $1 -$4 # $5 is now the part before the path to remove + StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove + StrCpy $3 $5$6 + + StrCpy $5 $3 1 -1 # copy last char + StrCmp $5 ";" 0 +2 # if last char == ; + StrCpy $3 $3 -1 # remove last char + + WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $3 + SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 + + unRemoveFromPath_done: + Pop $6 + Pop $5 + Pop $4 + Pop $3 + Pop $2 + Pop $1 + Pop $0 +FunctionEnd + +;==================================================== +; IsNT - Returns 1 if the current system is NT, 0 +; otherwise. +; Output: head of the stack +;==================================================== +!macro IsNT un +Function ${un}IsNT + Push $0 + ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion + StrCmp $0 "" 0 IsNT_yes + ; we are not NT. + Pop $0 + Push 0 + Return + + IsNT_yes: + ; NT!!! + Pop $0 + Push 1 +FunctionEnd +!macroend +!insertmacro IsNT "" +!insertmacro IsNT "un." + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Uninstall stuff +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;==================================================== +; StrStr - Finds a given string in another given string. +; Returns -1 if not found and the pos if found. +; Input: head of the stack - string to find +; second in the stack - string to find in +; Output: head of the stack +;==================================================== +!macro StrStr un +Function ${un}StrStr +Exch $R1 ; st=haystack,old$R1, $R1=needle + Exch ; st=old$R1,haystack + Exch $R2 ; st=old$R1,old$R2, $R2=haystack + Push $R3 + Push $R4 + Push $R5 + StrLen $R3 $R1 + StrCpy $R4 0 + ; $R1=needle + ; $R2=haystack + ; $R3=len(needle) + ; $R4=cnt + ; $R5=tmp + loop: + StrCpy $R5 $R2 $R3 $R4 + StrCmp $R5 $R1 done + StrCmp $R5 "" done + IntOp $R4 $R4 + 1 + Goto loop +done: + StrCpy $R1 $R2 "" $R4 + Pop $R5 + Pop $R4 + Pop $R3 + Pop $R2 + Exch $R1 +FunctionEnd +!macroend +!insertmacro StrStr "" +!insertmacro StrStr "un." + + +!ifdef ADDSHAREDDLLUSED +; AddSharedDLL + ; + ; Increments a shared DLLs reference count. + ; Use by passing one item on the stack (the full path of the DLL). + ; + ; Usage: + ; Push $SYSDIR\myDll.dll + ; Call AddSharedDLL + ; + + Function AddSharedDLL + Exch $R1 + Push $R0 + ReadRegDword $R0 HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1 + IntOp $R0 $R0 + 1 + WriteRegDWORD HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1 $R0 + Pop $R0 + Pop $R1 + FunctionEnd + + +; un.RemoveSharedDLL + ; + ; Decrements a shared DLLs reference count, and removes if necessary. + ; Use by passing one item on the stack (the full path of the DLL). + ; Note: for use in the main installer (not the uninstaller), rename the + ; function to RemoveSharedDLL. + ; + ; Usage: + ; Push $SYSDIR\myDll.dll + ; Call un.RemoveSharedDLL + ; + + Function un.RemoveSharedDLL + Exch $R1 + Push $R0 + ReadRegDword $R0 HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1 + StrCmp $R0 "" remove + IntOp $R0 $R0 - 1 + IntCmp $R0 0 rk rk uk + rk: + DeleteRegValue HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1 + goto Remove + uk: + WriteRegDWORD HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1 $R0 + Goto noremove + remove: + Delete /REBOOTOK $R1 + noremove: + Pop $R0 + Pop $R1 + FunctionEnd +!endif + + +; GetWindowsVersion +; +; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/ +; Updated by Joost Verburg +; +; Returns on top of stack +; +; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003) +; or +; '' (Unknown Windows Version) +; +; Usage: +; Call GetWindowsVersion +; Pop $R0 +; ; at this point $R0 is "NT 4.0" or whatnot + +Function GetWindowsVersion + + Push $R0 + Push $R1 + + ClearErrors + + ReadRegStr $R0 HKLM \ + "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion + + IfErrors 0 lbl_winnt + + ; we are not NT + ReadRegStr $R0 HKLM \ + "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber + + StrCpy $R1 $R0 1 + StrCmp $R1 '4' 0 lbl_error + + StrCpy $R1 $R0 3 + + StrCmp $R1 '4.0' lbl_win32_95 + StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98 + + lbl_win32_95: + StrCpy $R0 '95' + Goto lbl_done + + lbl_win32_98: + StrCpy $R0 '98' + Goto lbl_done + + lbl_win32_ME: + StrCpy $R0 'ME' + Goto lbl_done + + lbl_winnt: + + StrCpy $R1 $R0 1 + + StrCmp $R1 '3' lbl_winnt_x + StrCmp $R1 '4' lbl_winnt_x + + StrCpy $R1 $R0 3 + + StrCmp $R1 '5.0' lbl_winnt_2000 + StrCmp $R1 '5.1' lbl_winnt_XP + StrCmp $R1 '5.2' lbl_winnt_2003 lbl_error + + lbl_winnt_x: + StrCpy $R0 "NT $R0" 6 + Goto lbl_done + + lbl_winnt_2000: + Strcpy $R0 '2000' + Goto lbl_done + + lbl_winnt_XP: + Strcpy $R0 'XP' + Goto lbl_done + + lbl_winnt_2003: + Strcpy $R0 '2003' + Goto lbl_done + + lbl_error: + Strcpy $R0 '' + lbl_done: + + Pop $R1 + Exch $R0 + +FunctionEnd + + +; Author: Lilla (lilla@earthlink.net) 2003-06-13 +; function IsUserAdmin uses plugin \NSIS\PlusgIns\UserInfo.dll +; This function is based upon code in \NSIS\Contrib\UserInfo\UserInfo.nsi +; This function was tested under NSIS 2 beta 4 (latest CVS as of this writing). +; +; Usage: +; Call IsUserAdmin +; Pop $R0 ; at this point $R0 is "true" or "false" +; +Function IsUserAdmin +Push $R0 +Push $R1 +Push $R2 + +ClearErrors +UserInfo::GetName +IfErrors Win9x +Pop $R1 +UserInfo::GetAccountType +Pop $R2 + +StrCmp $R2 "Admin" 0 Continue +; Observation: I get here when running Win98SE. (Lilla) +; The functions UserInfo.dll looks for are there on Win98 too, +; but just don't work. So UserInfo.dll, knowing that admin isn't required +; on Win98, returns admin anyway. (per kichik) +; MessageBox MB_OK 'User "$R1" is in the Administrators group' +StrCpy $R0 "true" +Goto Done + +Continue: +; You should still check for an empty string because the functions +; UserInfo.dll looks for may not be present on Windows 95. (per kichik) +StrCmp $R2 "" Win9x +StrCpy $R0 "false" +;MessageBox MB_OK 'User "$R1" is in the "$R2" group' +Goto Done + +Win9x: +; comment/message below is by UserInfo.nsi author: +; This one means you don't need to care about admin or +; not admin because Windows 9x doesn't either +;MessageBox MB_OK "Error! This DLL can't run under Windows 9x!" +StrCpy $R0 "false" + +Done: +;MessageBox MB_OK 'User= "$R1" AccountType= "$R2" IsUserAdmin= "$R0"' + +Pop $R2 +Pop $R1 +Exch $R0 +FunctionEnd + +Function RestartRequired +Exch $R1 ;Original Variable +Push $R2 +Push $R3 ;Counter Variable + +StrCpy $R1 "0" 1 ;initialize variable with 0 +StrCpy $R3 "0" 0 ;Counter Variable + +;First Check Current User RunOnce Key +EnumRegValue $R2 HKCU "Software\Microsoft\Windows\CurrentVersion\RunOnce" $R3 +StrCmp $R2 "" 0 FoundRestart + +;Next Check Local Machine Key +EnumRegValue $R2 HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" $R3 +StrCmp $R2 "" ExitFunc 0 + +FoundRestart: +StrCpy $R1 "1" 1 + +ExitFunc: +Pop $R2 +Pop $R3 +Exch $R1 +FunctionEnd + +; GetParent + ; input, top of stack (e.g. C:\Program Files\Poop) + ; output, top of stack (replaces, with e.g. C:\Program Files) + ; modifies no other variables. + ; + ; Usage: + ; Push "C:\Program Files\Directory\Whatever" + ; Call GetParent + ; Pop $R0 + ; ; at this point $R0 will equal "C:\Program Files\Directory" + +Function GetParent + + Exch $R0 + Push $R1 + Push $R2 + Push $R3 + + StrCpy $R1 0 + StrLen $R2 $R0 + + loop: + IntOp $R1 $R1 + 1 + IntCmp $R1 $R2 get 0 get + StrCpy $R3 $R0 1 -$R1 + StrCmp $R3 "\" get + Goto loop + + get: + StrCpy $R0 $R0 -$R1 + + Pop $R3 + Pop $R2 + Pop $R1 + Exch $R0 + +FunctionEnd + +; SearchPath (path, filename) +; input: +; top of stack is the filename +; top of stack minus one is the path +; output: +; top of stack is a fully qualified path or the number "0" +; +; Usage: +; Push "semicolon delimited path" +; Push "filename" +; Call SearchPath +; Pop $R0 ; fqpn +; StrCmp $R0 "" failed +; +; +Function SearchPath + Exch $R0 ; input - filename + Exch + Exch $R1 ; input - semicolon delimited path + Push $R3 ; worker - index to current end character + Push $R4 ; worker - length of $R1 + Push $R5 ; worker - copy of directory string/fqpn to search for + Push $R6 ; worker - single charcter copy or find handle + + StrCpy $R3 0 ; init character index + StrLen $R4 $R1 ; determine length of semicolon delimited path + StrCpy $R5 "" ; init return value + + findDir: ; find a semi-colon or end of string + IntCmp $R3 $R4 exit 0 exit ; we are done if no unprocessed string left + + loop: + StrCpy $R6 $R1 1 $R3 ; get the next character + StrCmp $R6 ";" foundDir ; if it is semi-colon, we have found a dir + IntOp $R3 $R3 + 1 ; increment index + IntCmp $R3 $R4 foundDir ; if we are at end of string, we have a dir + Goto loop ; still more chars in this dir + + foundDir: + StrCpy $R5 $R1 $R3 ; copy the dir to $R5 + StrCpy $R5 "$R5\$R0" ; construct fqpn + IfFileExists $R5 exit ; if file exists we are done + StrCpy $R5 "" ; reset return value to null string + IntOp $R4 $R4 - $R3 ; compute maxlen of new delimited path + IntCmp $R4 0 exit ; no more path left, exit + IntOp $R3 $R3 + 1 ; Increment $R3 past the semi-colon + StrCpy $R1 $R1 $R4 $R3 ; remove dir from the delimited path + StrCpy $R3 0 ; index back to start of new delimited path + goto findDir ; get another directory to look in + + exit: + Pop $R6 + Exch $R5 ; output - fully qualified pathname + Exch + Pop $R4 + Exch + Pop $R3 + Exch + Pop $R1 + Exch + Pop $R0 +FunctionEnd -- 2.26.2