2004-01-02 02:05:45 +03:00
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2011-02-25 18:32:08 +03:00
; $Id$
2004-01-02 02:05:45 +03:00
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Setup Script for NSIS Installer
;
; Created: Michael Rich (istan)
;
; Based on Example Script by Joost Verburg
; also original BOCHS script by Robert (segra)
2019-11-15 16:46:18 +03:00
; updated for NSIS 3.04 by Volker Ruppert
2019-11-30 13:00:37 +03:00
; version check and reinstall page based on NSIS example
2005-03-20 17:29:23 +03:00
;
2004-01-02 02:05:45 +03:00
;---------------------
2011-12-04 12:25:01 +04:00
;Include Modern UI 2
2004-01-02 02:05:45 +03:00
2011-12-04 12:25:01 +04:00
!include "MUI2.nsh"
2004-01-02 02:05:45 +03:00
;--------------------------------
2011-12-04 12:25:01 +04:00
;Include MultiUser
!define MULTIUSER_EXECUTIONLEVEL Highest
!define MULTIUSER_MUI
!include MultiUser.nsh
2019-12-14 01:25:50 +03:00
;---------------------
;Include 64-bit support
!include "x64.nsh"
;--------------------------------
2011-12-04 12:25:01 +04:00
2019-12-14 01:25:50 +03:00
!define BITS @BOCHS_BITS@
2019-11-15 16:46:18 +03:00
!define VERSION @VERSION@
!define VER_MAJOR @VER_MAJOR@
!define VER_MINOR @VER_MINOR@
2019-11-30 15:20:00 +03:00
!define VER_REVISION @VER_REVISION@
2019-11-15 16:46:18 +03:00
!define VER_SVN @VER_SVN@
2004-01-02 02:05:45 +03:00
!define NAME "Bochs ${VERSION}"
2019-11-30 13:00:37 +03:00
;---------------------
;Include WordFunc for version check
!include WordFunc.nsh
2004-01-02 02:05:45 +03:00
!define CURRENTPAGE $9
!define TEMP1 $R0
!define TEMP2 $R1
!define SRCDIR bochs-${VERSION}
!define PGDIR "$SMPROGRAMS\Bochs ${VERSION}"
!define DESKTOP_DLXLINK "$DESKTOP\Linux Demo in ${NAME}.lnk"
2019-11-15 16:46:18 +03:00
;--------------------------------
Var IndependentSectionState
2004-01-02 02:05:45 +03:00
;--------------------------------
2009-04-15 21:23:50 +04:00
;General
2004-01-02 02:05:45 +03:00
Name "${NAME}"
2019-12-15 15:25:31 +03:00
OutFile Bochs-win${BITS}-${VERSION}.exe
2004-01-02 02:05:45 +03:00
SetOverwrite on
; Installation Types
InstType "Normal"
InstType "Full (with DLX Linux demo)"
;Folder-select dialog
2019-12-14 01:25:50 +03:00
InstallDir $PROGRAMFILES${BITS}\Bochs-${VERSION}
2019-11-26 23:21:56 +03:00
InstallDirRegKey HKLM "Software\Bochs" ""
2004-01-02 02:05:45 +03:00
2005-03-20 17:29:23 +03:00
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
!define MUI_COMPONENTSPAGE_NODESC
!define MUI_ICON "bochs.ico"
!define MUI_UNICON "unbochs.ico"
2019-11-26 23:21:56 +03:00
;--------------------------------
;Version information
2019-11-30 15:20:00 +03:00
VIProductVersion ${VER_MAJOR}.${VER_MINOR}.${VER_REVISION}.${VER_SVN}
2019-11-26 23:21:56 +03:00
VIAddVersionKey "FileVersion" "${VERSION}"
VIAddVersionKey "FileDescription" "Bochs Setup"
VIAddVersionKey "LegalCopyright" "Copyright 2001-2019 The Bochs Project"
2005-03-20 17:29:23 +03:00
;--------------------------------
;Pages
2019-11-18 00:42:44 +03:00
!define MUI_WELCOMEFINISHPAGE_BITMAP "bochs-logo.bmp"
!define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH
2005-03-20 17:29:23 +03:00
2019-11-18 00:42:44 +03:00
!define MUI_WELCOMEPAGE_TITLE "Welcome to the Bochs ${VERSION} Setup Wizard"
2019-11-30 13:00:37 +03:00
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of the Bochs x86 emulator version ${VERSION}.$\r$\rNOTE: If you have installed a Bochs version older than 2.6.9, you need to uninstall it before installing this version, since setup cannot detect it.$\r$\n$\r$\n$_CLICK"
2019-11-18 00:42:44 +03:00
!insertmacro MUI_PAGE_WELCOME
2005-03-20 17:29:23 +03:00
!insertmacro MUI_PAGE_LICENSE ${SRCDIR}\COPYING.txt
2019-11-30 15:20:00 +03:00
!ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_SVN
2019-11-30 13:00:37 +03:00
Page custom PageReinstall PageLeaveReinstall
!endif
2011-12-04 12:25:01 +04:00
!insertmacro MULTIUSER_PAGE_INSTALLMODE
2005-03-20 17:29:23 +03:00
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
2019-11-18 00:42:44 +03:00
!define MUI_FINISHPAGE_TEXT "Thank you for installing Bochs, think inside the bochs."
!define MUI_FINISHPAGE_LINK "Visit the Bochs website for the latest news, FAQs and support"
2021-06-13 11:02:33 +03:00
!define MUI_FINISHPAGE_LINK_LOCATION "https://bochs.sourceforge.io/"
2019-11-18 00:42:44 +03:00
!define MUI_FINISHPAGE_RUN "$INSTDIR\Bochs.exe"
!define MUI_FINISHPAGE_RUN_NOTCHECKED
!define MUI_FINISHPAGE_NOREBOOTSUPPORT
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README.txt"
!define MUI_FINISHPAGE_SHOWREADME_TEXT "Show Bochs README file"
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
2005-03-20 17:29:23 +03:00
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
2004-01-02 02:05:45 +03:00
;--------------------------------
;Installer Sections
Section "Bochs Program (required)" SecCore
SectionIn 1 2 RO
SetOutPath "$INSTDIR"
File "${SRCDIR}\*.exe"
File "${SRCDIR}\*.txt"
2014-05-31 21:24:20 +04:00
File "${SRCDIR}\slirp.conf"
2020-12-26 11:31:16 +03:00
File "${SRCDIR}\vnet.conf"
2004-01-02 02:05:45 +03:00
File "*.ico"
; Install keymaps
SetOutPath "$INSTDIR\keymaps"
File "${SRCDIR}\keymaps\*"
SectionEnd
Section "ROM Images (required)" SecROMs
SectionIn 1 2 RO
SetOutPath "$INSTDIR"
2007-05-17 19:47:35 +04:00
File "${SRCDIR}\BIOS-bochs-*"
2004-01-02 02:05:45 +03:00
File "${SRCDIR}\VGABIOS-*"
2014-06-14 11:26:18 +04:00
File "${SRCDIR}\bios.bin-*"
2019-12-29 10:20:50 +03:00
File "${SRCDIR}\vgabios-cirrus.bin-*"
2014-06-14 11:26:18 +04:00
File "${SRCDIR}\SeaBIOS-README.txt"
2019-12-29 10:20:50 +03:00
File "${SRCDIR}\SeaVGABIOS-README.txt"
2004-01-02 02:05:45 +03:00
SectionEnd
Section "Documentation in HTML" SecDocs
SectionIn 1 2
SetOutPath "$INSTDIR\docs"
2014-05-31 21:24:20 +04:00
File "${SRCDIR}\docs\index.html"
2004-01-02 02:05:45 +03:00
SetOutPath "$INSTDIR\docs\user"
2014-05-31 21:24:20 +04:00
File "${SRCDIR}\docs\user\*"
2004-01-02 02:05:45 +03:00
SetOutPath "$INSTDIR\docs\development"
2014-05-31 21:24:20 +04:00
File "${SRCDIR}\docs\development\*"
2004-01-02 02:05:45 +03:00
SetOutPath "$INSTDIR\docs\documentation"
2014-05-31 21:24:20 +04:00
File "${SRCDIR}\docs\documentation\*"
2004-01-02 02:05:45 +03:00
SetOutPath "$INSTDIR\docs\images"
2014-05-31 21:24:20 +04:00
File "${SRCDIR}\docs\images\*"
2004-01-02 02:05:45 +03:00
SectionEnd
Section "DLX Linux Demo" SecDLX
SectionIn 2
SetOutPath "$INSTDIR\dlxlinux"
File "${SRCDIR}\dlxlinux\*"
; Fix up the path to the Bochs executable
FileOpen $1 "$INSTDIR\dlxlinux\run.bat" w
FileWrite $1 'cd "$INSTDIR\dlxlinux"$\r$\n'
FileWrite $1 "..\bochs -q -f bochsrc.bxrc$\r$\n"
FileClose $1
SectionEnd
2019-11-15 16:46:18 +03:00
Section "Add Bochs to the Start Menu" SecStartMenu
2004-01-02 02:05:45 +03:00
SectionIn 1 2
; Set the Program Group as output to ensure it exists
SetOutPath "${PGDIR}"
; Change the output back to the install folder so the "Start In" paths get set properly
SetOutPath "$INSTDIR"
CreateShortCut "${PGDIR}\${NAME}.lnk" "$INSTDIR\Bochs.exe" "" "$INSTDIR\bochs.ico" "0"
CreateShortCut "${PGDIR}\Readme.lnk" \
"$INSTDIR\Readme.txt"
CreateShortCut "${PGDIR}\Bochs Sample Setup.lnk" \
"$INSTDIR\bochsrc-sample.txt"
CreateShortCut "${PGDIR}\Disk Image Creation Tool.lnk" \
"$INSTDIR\bximage.exe"
2017-04-08 13:21:09 +03:00
CreateShortCut "${PGDIR}\Virtual Network Hub.lnk" \
"$INSTDIR\bxhub.exe"
2004-01-02 02:05:45 +03:00
CreateShortCut "${PGDIR}\NIC Lister.lnk" \
"$INSTDIR\niclist.exe"
WriteINIStr "${PGDIR}\Help.url" \
"InternetShortcut" "URL" "file://$INSTDIR/docs/index.html"
WriteINIStr "${PGDIR}\Home Page.url" \
2021-06-13 11:02:33 +03:00
"InternetShortcut" "URL" "https://bochs.sourceforge.io/"
2004-01-02 02:05:45 +03:00
CreateShortCut "${PGDIR}\${NAME} Folder.lnk" \
"$INSTDIR"
CreateShortCut "${PGDIR}\Uninstall Bochs.lnk" \
2005-03-20 17:29:23 +03:00
"$INSTDIR\Uninstall.exe" "" "$INSTDIR\unbochs.ico" "0"
2004-01-02 02:05:45 +03:00
; Create shortcut to DLX Linux if it was installed
IfFileExists "$INSTDIR\dlxlinux\*" 0 no
CreateShortCut "${PGDIR}\DLX Linux.lnk" "$INSTDIR\dlxlinux\run.bat" "" "$INSTDIR\penguin.ico" "0"
no:
2019-11-15 16:46:18 +03:00
SectionEnd
Section "Add DLX Demo icon to Desktop" SecDLXIcon
SectionIn 2
; Add a link to the DLX demo to the desktop
CreateShortCut "${DESKTOP_DLXLINK}" "$INSTDIR\dlxlinux\run.bat" "" "$INSTDIR\bochs.ico" "0"
2004-01-02 02:05:45 +03:00
SectionEnd
Section "Register .bxrc Extension" SecExtension
SectionIn 1 2 RO
; back up old value of .bxrc
ReadRegStr $1 HKCR ".bxrc" ""
StrCmp $1 "" Label1
StrCmp $1 "BochsConfigFile" Label1
WriteRegStr HKCR ".bxrc" "backup_val" $1
Label1:
WriteRegStr HKCR ".bxrc" "" "BochsConfigFile"
WriteRegStr HKCR "BochsConfigFile" "" "${NAME} Config File"
WriteRegStr HKCR "BochsConfigFile\DefaultIcon" "" "$INSTDIR\bochs.ico,0"
WriteRegStr HKCR "BochsConfigFile\shell" "" "Configure"
WriteRegStr HKCR "BochsConfigFile\shell\Configure\command" "" '"$INSTDIR\Bochs.exe" -f "%1"'
WriteRegStr HKCR "BochsConfigFile\shell" "" "Edit"
2007-09-28 21:58:48 +04:00
WriteRegStr HKCR "BochsConfigFile\shell\Edit\command" "" '$WINDIR\NOTEPAD.EXE "%1"'
2004-01-02 02:05:45 +03:00
WriteRegStr HKCR "BochsConfigFile\shell" "" "Debugger"
WriteRegStr HKCR "BochsConfigFile\shell\Debugger\command" "" '"$INSTDIR\Bochsdbg.exe" -f "%1"'
WriteRegStr HKCR "BochsConfigFile\shell" "" "Run"
WriteRegStr HKCR "BochsConfigFile\shell\Run\command" "" '"$INSTDIR\Bochs.exe" -q -f "%1"'
SectionEnd
Section -post
2019-12-14 01:25:50 +03:00
SetRegView ${BITS}
2004-01-02 02:05:45 +03:00
; Register Uninstaller
2019-11-30 20:51:19 +03:00
WriteRegStr HKLM "Software\Bochs" "" $INSTDIR
2019-11-26 23:21:56 +03:00
WriteRegDword HKLM "Software\Bochs" "VersionMajor" "${VER_MAJOR}"
WriteRegDword HKLM "Software\Bochs" "VersionMinor" "${VER_MINOR}"
2019-11-30 15:20:00 +03:00
WriteRegDword HKLM "Software\Bochs" "VersionRevision" "${VER_REVISION}"
2019-11-26 23:21:56 +03:00
WriteRegDword HKLM "Software\Bochs" "VersionSVN" "${VER_SVN}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs" "DisplayName" "${NAME} (remove only)"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs" "DisplayIcon" "$INSTDIR\bochs.ico,0"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs" "DisplayVersion" "${VERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs" "Publisher" "The Bochs Project"
2021-06-13 11:02:33 +03:00
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs" "URLInfoAbout" "https://bochs.sourceforge.io"
2019-11-26 23:21:56 +03:00
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs" "Readme" '$INSTDIR\Readme.txt'
WriteRegDWord HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs" "NoModify" "1"
WriteRegDWord HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs" "NoRepair" "1"
WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs" "InstallLocation" '$INSTDIR\'
WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs" "UninstallString" '"$INSTDIR\Uninstall.exe"'
2004-01-02 02:05:45 +03:00
; Write the uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
;--------------------------------
;Uninstaller Section
Section "Uninstall"
2019-12-14 01:25:50 +03:00
SetRegView ${BITS}
2004-01-02 02:05:45 +03:00
ReadRegStr $1 HKCR ".bxrc" ""
StrCmp $1 "BochsConfigFile" 0 NoOwn ; only do this if we own it
ReadRegStr $1 HKCR ".bxrc" "backup_val"
StrCmp $1 "" 0 RestoreBackup ; if backup == "" then delete the whole key
DeleteRegKey HKCR ".bxrc"
Goto NoOwn
RestoreBackup:
WriteRegStr HKCR ".bxrc" "" $1
DeleteRegValue HKCR ".bxrc" "backup_val"
NoOwn:
DeleteRegKey HKCR "BochsConfigFile"
2019-11-26 23:21:56 +03:00
DeleteRegKey HKLM "SOFTWARE\Bochs"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs"
2004-01-02 02:05:45 +03:00
Delete "${PGDIR}\*.lnk"
Delete "${PGDIR}\*.url"
RMDir "${PGDIR}"
Delete "${DESKTOP_DLXLINK}"
Delete "$INSTDIR\*.exe"
Delete "$INSTDIR\*.txt"
2014-05-31 21:24:20 +04:00
Delete "$INSTDIR\slirp.conf"
2020-12-26 11:31:16 +03:00
Delete "$INSTDIR\vnet.conf"
2004-01-02 02:05:45 +03:00
Delete "$INSTDIR\*.ico"
Delete "$INSTDIR\keymaps\*"
2007-09-28 21:58:48 +04:00
Delete "$INSTDIR\BIOS-bochs-*"
2004-01-02 02:05:45 +03:00
Delete "$INSTDIR\VGABIOS-*"
2014-06-14 11:26:18 +04:00
Delete "$INSTDIR\bios.bin-*"
2019-12-29 10:20:50 +03:00
Delete "$INSTDIR\vgabios-cirrus.bin-*"
2014-06-14 11:26:18 +04:00
Delete "$INSTDIR\SeaBIOS-README.txt"
2019-12-29 10:20:50 +03:00
Delete "$INSTDIR\SeaVGABIOS-README.txt"
2004-01-02 02:05:45 +03:00
Delete "$INSTDIR\dlxlinux\*"
Delete "$INSTDIR\docs\index.html"
Delete "$INSTDIR\docs\user\*"
Delete "$INSTDIR\docs\development\*"
Delete "$INSTDIR\docs\documentation\*"
Delete "$INSTDIR\docs\images\*"
RMDIR "$INSTDIR\keymaps"
RMDIR "$INSTDIR\dlxlinux"
RMDIR "$INSTDIR\docs\user"
RMDIR "$INSTDIR\docs\development"
RMDIR "$INSTDIR\docs\documentation"
RMDIR "$INSTDIR\docs\images"
RMDIR "$INSTDIR\docs"
RMDIR "$INSTDIR"
SectionEnd
2019-11-15 16:46:18 +03:00
;--------------------------------
2019-11-18 00:42:44 +03:00
;Installer Functions
2019-11-15 16:46:18 +03:00
Function .onInit
!insertmacro MULTIUSER_INIT
2019-12-14 01:25:50 +03:00
!if ${BITS} == 64
${IfNot} ${RunningX64}
MessageBox MB_ICONSTOP "This Bochs package does not run on 32-bit Windows"
Abort
${Endif}
!endif
2019-11-15 16:46:18 +03:00
# This is necessary otherwise SecDLXIcon won't be selectable for the first time you click it.
SectionGetFlags ${SecDLX} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCpy $IndependentSectionState $R0
FunctionEnd
Function un.onInit
!insertmacro MULTIUSER_UNINIT
FunctionEnd
Function .onSelChange
Push $R0
Push $R1
# Check if SecDLX was just selected then select SecDLXIcon.
SectionGetFlags ${SecDLX} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 $IndependentSectionState +3
StrCpy $IndependentSectionState $R0
Goto UnselectDependentSections
StrCpy $IndependentSectionState $R0
Goto CheckDependentSections
# Select SecDLX if SecDLXIcon was selected.
SelectIndependentSection:
SectionGetFlags ${SecDLX} $R0
IntOp $R1 $R0 & ${SF_SELECTED}
StrCmp $R1 ${SF_SELECTED} +3
IntOp $R0 $R0 | ${SF_SELECTED}
SectionSetFlags ${SecDLX} $R0
StrCpy $IndependentSectionState ${SF_SELECTED}
Goto End
# Were SecDLXIcon just unselected?
CheckDependentSections:
SectionGetFlags ${SecDLXIcon} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 ${SF_SELECTED} SelectIndependentSection
Goto End
# Unselect SecDLXIcon if SecDLX was unselected.
UnselectDependentSections:
SectionGetFlags ${SecDLXIcon} $R0
IntOp $R1 $R0 & ${SF_SELECTED}
StrCmp $R1 ${SF_SELECTED} 0 +3
IntOp $R0 $R0 ^ ${SF_SELECTED}
SectionSetFlags ${SecDLXIcon} $R0
End:
Pop $R1
Pop $R0
FunctionEnd
2019-11-30 15:20:00 +03:00
!ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_SVN
2019-11-30 13:00:37 +03:00
Var ReinstallPageCheck
Var OldInstDir
Function PageReinstall
2019-12-14 01:25:50 +03:00
SetRegView ${BITS}
2019-11-30 13:00:37 +03:00
ReadRegStr $R0 HKLM "Software\Bochs 2.6.9" ""
ReadRegStr $R1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs 2.6.9" "UninstallString"
ReadRegStr $R2 HKLM "Software\Bochs" ""
ReadRegStr $R3 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs" "UninstallString"
StrCpy $R4 "older"
${If} "$R0$R1" != ""
StrCpy $R0 "2"
StrCpy $R1 "6"
StrCpy $R2 "9"
StrCpy $R3 "0"
${ElseIf} "$R2$R3" != ""
ReadRegDWORD $R0 HKLM "Software\Bochs" "VersionMajor"
ReadRegDWORD $R1 HKLM "Software\Bochs" "VersionMinor"
2019-11-30 15:20:00 +03:00
ReadRegDWORD $R2 HKLM "Software\Bochs" "VersionRevision"
2019-11-30 13:00:37 +03:00
ReadRegDWORD $R3 HKLM "Software\Bochs" "VersionSVN"
${Else}
Abort
${Endif}
StrCpy $R0 $R0.$R1.$R2.$R3
2019-11-30 15:20:00 +03:00
${VersionCompare} ${VER_MAJOR}.${VER_MINOR}.${VER_REVISION}.${VER_SVN} $R0 $R0
2019-11-30 13:00:37 +03:00
${If} $R0 == 0
StrCpy $R1 "Bochs ${VERSION} is already installed. Select the operation you want to perform and click Next to continue."
StrCpy $R2 "Add/Reinstall components"
StrCpy $R3 "Uninstall Bochs"
!insertmacro MUI_HEADER_TEXT "Already Installed" "Choose the maintenance option to perform."
StrCpy $R0 "2"
${ElseIf} $R0 == 1
StrCpy $R1 "An $R4 version of Bochs is installed on your system. It's recommended that you uninstall the current version before installing. Select the operation you want to perform and click Next to continue."
StrCpy $R2 "Uninstall before installing"
StrCpy $R3 "Do not uninstall"
!insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install Bochs."
StrCpy $R0 "1"
${ElseIf} $R0 == 2
StrCpy $R1 "A newer version of Bochs is already installed! It is not recommended that you install an older version. If you really want to install this older version, it's better to uninstall the current version first. Select the operation you want to perform and click Next to continue."
StrCpy $R2 "Uninstall before installing"
StrCpy $R3 "Do not uninstall"
!insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install Bochs."
StrCpy $R0 "1"
${Else}
Abort
${EndIf}
nsDialogs::Create 1018
Pop $R4
${NSD_CreateLabel} 0 0 100% 24u $R1
Pop $R1
${NSD_CreateRadioButton} 30u 50u -30u 8u $R2
Pop $R2
${NSD_OnClick} $R2 PageReinstallUpdateSelection
${NSD_CreateRadioButton} 30u 70u -30u 8u $R3
Pop $R3
${NSD_OnClick} $R3 PageReinstallUpdateSelection
${If} $ReinstallPageCheck != 2
SendMessage $R2 ${BM_SETCHECK} ${BST_CHECKED} 0
${Else}
SendMessage $R3 ${BM_SETCHECK} ${BST_CHECKED} 0
${EndIf}
${NSD_SetFocus} $R2
nsDialogs::Show
FunctionEnd
Function PageReinstallUpdateSelection
Pop $R1
${NSD_GetState} $R2 $R1
${If} $R1 == ${BST_CHECKED}
StrCpy $ReinstallPageCheck 1
${Else}
StrCpy $ReinstallPageCheck 2
${EndIf}
FunctionEnd
Function PageLeaveReinstall
${NSD_GetState} $R2 $R1
StrCmp $R0 "1" 0 +2 ; Existing install is not the same version?
StrCmp $R1 "1" reinst_uninstall reinst_done
StrCmp $R1 "1" reinst_done ; Same version, skip to add/reinstall components?
reinst_uninstall:
2019-12-14 01:25:50 +03:00
SetRegView ${BITS}
2019-11-30 13:00:37 +03:00
ReadRegStr $R1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs" "UninstallString"
${If} $R1 == ""
ReadRegStr $R1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs 2.6.9" "UninstallString"
ReadRegStr $OldInstDir HKLM "Software\Bochs 2.6.9" ""
${Else}
StrCpy $OldInstDir $INSTDIR
${Endif}
;Run uninstaller
HideWindow
ClearErrors
ExecWait '$R1 _?=$OldInstDir' $0
BringToFront
${IfThen} ${Errors} ${|} StrCpy $0 2 ${|} ; ExecWait failed, set fake exit code
${If} $0 <> 0
${OrIf} ${FileExists} "$OldInstDir\bochs.exe"
${If} $0 = 1 ; User aborted uninstaller?
StrCmp $R0 "2" 0 +2 ; Is the existing install the same version?
Quit ; ...yes, already installed, we are done
Abort
${EndIf}
MessageBox MB_ICONEXCLAMATION "Unable to uninstall!"
Abort
${Else}
StrCpy $0 $R1 1
${IfThen} $0 == '"' ${|} StrCpy $R1 $R1 -1 1 ${|} ; Strip quotes from UninstallString
Delete $R1
RMDir $OldInstDir
${EndIf}
reinst_done:
FunctionEnd
2019-11-30 15:20:00 +03:00
!endif # VER_MAJOR & VER_MINOR & VER_REVISION & VER_SVN
2019-11-30 13:00:37 +03:00
2004-01-02 02:05:45 +03:00
;eof