; The name of the installer Name "Final Furlong Universal 1.06 Patch" ; The file to write OutFile "ff_universal106_patch.exe" LoadLanguageFile "${NSISDIR}\Contrib\Language Files\English.nlf" ChangeUI all "${NSISDIR}\Contrib\UIs\modern.exe" ; The default installation directory InstallDir "$PROGRAMFILES\Syntasoft\Final Furlong" ; Registry key to check for directory (so if you install again, it will ; overwrite the old one automatically) InstallDirRegKey HKLM "Software\Syntasoft" "Install_Dir" ;-------------------------------- ;Version Information VIProductVersion "1.0.0.6" VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "Final Furlong" VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" "1.06 Universal Patch" VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "Syntasoft" VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalTrademarks" "Final Furlong is a trademark of Syntasoft" VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "© 2001-2003 Syntasoft" VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Final Furlong" VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "1.06" ;-------------------------------- ShowInstDetails show Function FindFiles Exch $R5 # callback function Exch Exch $R4 # file name Exch 2 Exch $R0 # directory Push $R1 Push $R2 Push $R3 Push $R6 Push $R0 # first dir to search StrCpy $R3 1 nextDir: Pop $R0 IntOp $R3 $R3 - 1 ClearErrors FindFirst $R1 $R2 "$R0\*.*" nextFile: StrCmp $R2 "." gotoNextFile StrCmp $R2 ".." gotoNextFile StrCmp $R2 $R4 0 isDir Push "$R0\$R2" Call $R5 Pop $R6 StrCmp $R6 "stop" 0 isDir loop: StrCmp $R3 0 done Pop $R0 IntOp $R3 $R3 - 1 Goto loop isDir: IfFileExists "$R0\$R2\*.*" 0 gotoNextFile IntOp $R3 $R3 + 1 Push "$R0\$R2" gotoNextFile: FindNext $R1 $R2 IfErrors 0 nextFile done: FindClose $R1 StrCmp $R3 0 0 nextDir Pop $R6 Pop $R3 Pop $R2 Pop $R1 Pop $R0 Pop $R5 Pop $R4 FunctionEnd !macro CallFindFiles DIR FILE CBFUNC Push "${DIR}" Push "${FILE}" Push $0 GetFunctionAddress $0 "${CBFUNC}" Exch $0 Call FindFiles !macroend Function FindFinalFurlong Pop $0 GetDLLVersion $0 $1 $3 IntOp $2 $1 & 0x0000FFFF IntOp $1 $1 / 0x00010000 IntOp $4 $3 & 0x0000FFFF IntOp $3 $3 / 0x00010000 DetailPrint "$1.$2.$3.$4 - $0" StrCmp "$1.$2" "2.9" 0 not StrCpy $9 $0 DetailPrint "Final Furlong found. Continuing patch..." Push "stop" Return not: Push "go" FunctionEnd Section "Find Final Furlong (required)" !insertmacro CallFindFiles C: Final%20Furlong.exe FindFinalFurlong StrCmp $9 "" 0 +2 DetailPrint "Couldn't find registered version of Final Furlong" SectionEnd ; Pages Page components Page directory Page instfiles UninstPage uninstConfirm UninstPage instfiles ;-------------------------------- ; The stuff to install Section "Final Furlong 1.06 (required)" SectionIn RO ; Set output path to the installation directory. SetOutPath $INSTDIR ; Put file there File /r "C:\ffpatchbin\finalfurlong106\*.*" ; Write the installation path into the registry WriteRegStr HKLM SOFTWARE\NSIS_Syntasoft "Install_Dir" "$INSTDIR" ; Write the uninstall keys for Windows WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Syntasoft" "DisplayName" "Syntasoft" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Syntasoft" "UninstallString" '"$INSTDIR\uninstall.exe"' WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Syntasoft" "NoModify" 1 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Syntasoft" "NoRepair" 1 WriteUninstaller "uninstall.exe" SectionEnd ; Optional section (can be disabled by the user) Section "Start Menu Shortcuts" CreateDirectory "$SMPROGRAMS\Syntasoft" CreateShortCut "$SMPROGRAMS\Syntasoft\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 CreateShortCut "$SMPROGRAMS\Syntasoft\Final Furlong.lnk" "$INSTDIR\Final%20Furlong.exe" "" "$INSTDIR\Final%20Furlong.exe" 0 SectionEnd ;-------------------------------- ; Uninstaller Section "Uninstall" ; Remove registry keys DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Syntasoft" DeleteRegKey HKLM SOFTWARE\NSIS_Syntasoft ; Remove files and uninstaller Delete $INSTDIR\Final%20Furlong.exe Delete $INSTDIR\uninstall.exe ; Remove shortcuts, if any Delete "$SMPROGRAMS\Syntasoft\*.*" ; Remove directories used RMDir "$SMPROGRAMS\Syntasoft" RMDir "$INSTDIR" SectionEnd