1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2; $Id: bochs.nsi.in 14281 2021-06-13 08:02:33Z vruppert $ 3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 4; 5; Setup Script for NSIS Installer 6; 7; Created: Michael Rich (istan) 8; 9; Based on Example Script by Joost Verburg 10; also original BOCHS script by Robert (segra) 11; updated for NSIS 3.04 by Volker Ruppert 12; version check and reinstall page based on NSIS example 13; 14;--------------------- 15;Include Modern UI 2 16 17 !include "MUI2.nsh" 18 19;-------------------------------- 20 21;Include MultiUser 22 23!define MULTIUSER_EXECUTIONLEVEL Highest 24!define MULTIUSER_MUI 25!include MultiUser.nsh 26;--------------------- 27 28;Include 64-bit support 29 30!include "x64.nsh" 31 32;-------------------------------- 33 34!define BITS @BOCHS_BITS@ 35!define VERSION @VERSION@ 36!define VER_MAJOR @VER_MAJOR@ 37!define VER_MINOR @VER_MINOR@ 38!define VER_REVISION @VER_REVISION@ 39!define VER_SVN @VER_SVN@ 40!define NAME "Bochs ${VERSION}" 41 42;--------------------- 43;Include WordFunc for version check 44 45!include WordFunc.nsh 46 47!define CURRENTPAGE $9 48 49!define TEMP1 $R0 50!define TEMP2 $R1 51 52!define SRCDIR bochs-${VERSION} 53!define PGDIR "$SMPROGRAMS\Bochs ${VERSION}" 54!define DESKTOP_DLXLINK "$DESKTOP\Linux Demo in ${NAME}.lnk" 55 56;-------------------------------- 57Var IndependentSectionState 58;-------------------------------- 59 60;General 61 Name "${NAME}" 62 OutFile Bochs-win${BITS}-${VERSION}.exe 63 SetOverwrite on 64 65 ; Installation Types 66 InstType "Normal" 67 InstType "Full (with DLX Linux demo)" 68 69 ;Folder-select dialog 70 InstallDir $PROGRAMFILES${BITS}\Bochs-${VERSION} 71 InstallDirRegKey HKLM "Software\Bochs" "" 72 73;-------------------------------- 74;Interface Settings 75 76 !define MUI_ABORTWARNING 77 !define MUI_COMPONENTSPAGE_NODESC 78 !define MUI_ICON "bochs.ico" 79 !define MUI_UNICON "unbochs.ico" 80 81;-------------------------------- 82;Version information 83 84VIProductVersion ${VER_MAJOR}.${VER_MINOR}.${VER_REVISION}.${VER_SVN} 85VIAddVersionKey "FileVersion" "${VERSION}" 86VIAddVersionKey "FileDescription" "Bochs Setup" 87VIAddVersionKey "LegalCopyright" "Copyright 2001-2019 The Bochs Project" 88 89;-------------------------------- 90;Pages 91 !define MUI_WELCOMEFINISHPAGE_BITMAP "bochs-logo.bmp" 92 !define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH 93 94 !define MUI_WELCOMEPAGE_TITLE "Welcome to the Bochs ${VERSION} Setup Wizard" 95 !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" 96 97 !insertmacro MUI_PAGE_WELCOME 98 !insertmacro MUI_PAGE_LICENSE ${SRCDIR}\COPYING.txt 99!ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_SVN 100 Page custom PageReinstall PageLeaveReinstall 101!endif 102 !insertmacro MULTIUSER_PAGE_INSTALLMODE 103 !insertmacro MUI_PAGE_COMPONENTS 104 !insertmacro MUI_PAGE_DIRECTORY 105 !insertmacro MUI_PAGE_INSTFILES 106 107 !define MUI_FINISHPAGE_TEXT "Thank you for installing Bochs, think inside the bochs." 108 109 !define MUI_FINISHPAGE_LINK "Visit the Bochs website for the latest news, FAQs and support" 110 !define MUI_FINISHPAGE_LINK_LOCATION "https://bochs.sourceforge.io/" 111 112 !define MUI_FINISHPAGE_RUN "$INSTDIR\Bochs.exe" 113 !define MUI_FINISHPAGE_RUN_NOTCHECKED 114 !define MUI_FINISHPAGE_NOREBOOTSUPPORT 115 116 !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README.txt" 117 !define MUI_FINISHPAGE_SHOWREADME_TEXT "Show Bochs README file" 118 119 !insertmacro MUI_PAGE_FINISH 120 121 !insertmacro MUI_UNPAGE_WELCOME 122 !insertmacro MUI_UNPAGE_CONFIRM 123 !insertmacro MUI_UNPAGE_INSTFILES 124 125;-------------------------------- 126;Languages 127 128 !insertmacro MUI_LANGUAGE "English" 129 130;-------------------------------- 131;Installer Sections 132 133Section "Bochs Program (required)" SecCore 134 SectionIn 1 2 RO 135 136 SetOutPath "$INSTDIR" 137 138 File "${SRCDIR}\*.exe" 139 File "${SRCDIR}\*.txt" 140 File "${SRCDIR}\slirp.conf" 141 File "${SRCDIR}\vnet.conf" 142 File "*.ico" 143 144 ; Install keymaps 145 SetOutPath "$INSTDIR\keymaps" 146 File "${SRCDIR}\keymaps\*" 147 148SectionEnd 149 150Section "ROM Images (required)" SecROMs 151 SectionIn 1 2 RO 152 153 SetOutPath "$INSTDIR" 154 155 File "${SRCDIR}\BIOS-bochs-*" 156 File "${SRCDIR}\VGABIOS-*" 157 File "${SRCDIR}\bios.bin-*" 158 File "${SRCDIR}\vgabios-cirrus.bin-*" 159 File "${SRCDIR}\SeaBIOS-README.txt" 160 File "${SRCDIR}\SeaVGABIOS-README.txt" 161SectionEnd 162 163Section "Documentation in HTML" SecDocs 164 SectionIn 1 2 165 SetOutPath "$INSTDIR\docs" 166 File "${SRCDIR}\docs\index.html" 167 SetOutPath "$INSTDIR\docs\user" 168 File "${SRCDIR}\docs\user\*" 169 SetOutPath "$INSTDIR\docs\development" 170 File "${SRCDIR}\docs\development\*" 171 SetOutPath "$INSTDIR\docs\documentation" 172 File "${SRCDIR}\docs\documentation\*" 173 SetOutPath "$INSTDIR\docs\images" 174 File "${SRCDIR}\docs\images\*" 175SectionEnd 176 177Section "DLX Linux Demo" SecDLX 178 SectionIn 2 179 180 SetOutPath "$INSTDIR\dlxlinux" 181 File "${SRCDIR}\dlxlinux\*" 182 183 ; Fix up the path to the Bochs executable 184 FileOpen $1 "$INSTDIR\dlxlinux\run.bat" w 185 FileWrite $1 'cd "$INSTDIR\dlxlinux"$\r$\n' 186 FileWrite $1 "..\bochs -q -f bochsrc.bxrc$\r$\n" 187 FileClose $1 188SectionEnd 189 190Section "Add Bochs to the Start Menu" SecStartMenu 191 SectionIn 1 2 192 193 ; Set the Program Group as output to ensure it exists 194 SetOutPath "${PGDIR}" 195 196 ; Change the output back to the install folder so the "Start In" paths get set properly 197 SetOutPath "$INSTDIR" 198 199 CreateShortCut "${PGDIR}\${NAME}.lnk" "$INSTDIR\Bochs.exe" "" "$INSTDIR\bochs.ico" "0" 200 201 CreateShortCut "${PGDIR}\Readme.lnk" \ 202 "$INSTDIR\Readme.txt" 203 204 CreateShortCut "${PGDIR}\Bochs Sample Setup.lnk" \ 205 "$INSTDIR\bochsrc-sample.txt" 206 207 CreateShortCut "${PGDIR}\Disk Image Creation Tool.lnk" \ 208 "$INSTDIR\bximage.exe" 209 210 CreateShortCut "${PGDIR}\Virtual Network Hub.lnk" \ 211 "$INSTDIR\bxhub.exe" 212 213 CreateShortCut "${PGDIR}\NIC Lister.lnk" \ 214 "$INSTDIR\niclist.exe" 215 216 WriteINIStr "${PGDIR}\Help.url" \ 217 "InternetShortcut" "URL" "file://$INSTDIR/docs/index.html" 218 219 WriteINIStr "${PGDIR}\Home Page.url" \ 220 "InternetShortcut" "URL" "https://bochs.sourceforge.io/" 221 222 CreateShortCut "${PGDIR}\${NAME} Folder.lnk" \ 223 "$INSTDIR" 224 225 CreateShortCut "${PGDIR}\Uninstall Bochs.lnk" \ 226 "$INSTDIR\Uninstall.exe" "" "$INSTDIR\unbochs.ico" "0" 227 228 ; Create shortcut to DLX Linux if it was installed 229 IfFileExists "$INSTDIR\dlxlinux\*" 0 no 230 CreateShortCut "${PGDIR}\DLX Linux.lnk" "$INSTDIR\dlxlinux\run.bat" "" "$INSTDIR\penguin.ico" "0" 231 232no: 233 234SectionEnd 235 236Section "Add DLX Demo icon to Desktop" SecDLXIcon 237 SectionIn 2 238 239 ; Add a link to the DLX demo to the desktop 240 CreateShortCut "${DESKTOP_DLXLINK}" "$INSTDIR\dlxlinux\run.bat" "" "$INSTDIR\bochs.ico" "0" 241 242SectionEnd 243 244Section "Register .bxrc Extension" SecExtension 245 SectionIn 1 2 RO 246 247 ; back up old value of .bxrc 248 ReadRegStr $1 HKCR ".bxrc" "" 249 250 StrCmp $1 "" Label1 251 StrCmp $1 "BochsConfigFile" Label1 252 WriteRegStr HKCR ".bxrc" "backup_val" $1 253 254 Label1: 255 WriteRegStr HKCR ".bxrc" "" "BochsConfigFile" 256 WriteRegStr HKCR "BochsConfigFile" "" "${NAME} Config File" 257 WriteRegStr HKCR "BochsConfigFile\DefaultIcon" "" "$INSTDIR\bochs.ico,0" 258 WriteRegStr HKCR "BochsConfigFile\shell" "" "Configure" 259 WriteRegStr HKCR "BochsConfigFile\shell\Configure\command" "" '"$INSTDIR\Bochs.exe" -f "%1"' 260 WriteRegStr HKCR "BochsConfigFile\shell" "" "Edit" 261 WriteRegStr HKCR "BochsConfigFile\shell\Edit\command" "" '$WINDIR\NOTEPAD.EXE "%1"' 262 WriteRegStr HKCR "BochsConfigFile\shell" "" "Debugger" 263 WriteRegStr HKCR "BochsConfigFile\shell\Debugger\command" "" '"$INSTDIR\Bochsdbg.exe" -f "%1"' 264 WriteRegStr HKCR "BochsConfigFile\shell" "" "Run" 265 WriteRegStr HKCR "BochsConfigFile\shell\Run\command" "" '"$INSTDIR\Bochs.exe" -q -f "%1"' 266SectionEnd 267 268 269Section -post 270 SetRegView ${BITS} 271 ; Register Uninstaller 272 WriteRegStr HKLM "Software\Bochs" "" $INSTDIR 273 WriteRegDword HKLM "Software\Bochs" "VersionMajor" "${VER_MAJOR}" 274 WriteRegDword HKLM "Software\Bochs" "VersionMinor" "${VER_MINOR}" 275 WriteRegDword HKLM "Software\Bochs" "VersionRevision" "${VER_REVISION}" 276 WriteRegDword HKLM "Software\Bochs" "VersionSVN" "${VER_SVN}" 277 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs" "DisplayName" "${NAME} (remove only)" 278 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs" "DisplayIcon" "$INSTDIR\bochs.ico,0" 279 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs" "DisplayVersion" "${VERSION}" 280 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs" "Publisher" "The Bochs Project" 281 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs" "URLInfoAbout" "https://bochs.sourceforge.io" 282 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs" "Readme" '$INSTDIR\Readme.txt' 283 WriteRegDWord HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs" "NoModify" "1" 284 WriteRegDWord HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs" "NoRepair" "1" 285 WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs" "InstallLocation" '$INSTDIR\' 286 WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs" "UninstallString" '"$INSTDIR\Uninstall.exe"' 287 288 ; Write the uninstaller 289 WriteUninstaller "$INSTDIR\Uninstall.exe" 290SectionEnd 291 292;-------------------------------- 293;Uninstaller Section 294 295Section "Uninstall" 296 297 SetRegView ${BITS} 298 299 ReadRegStr $1 HKCR ".bxrc" "" 300 301 StrCmp $1 "BochsConfigFile" 0 NoOwn ; only do this if we own it 302 ReadRegStr $1 HKCR ".bxrc" "backup_val" 303 StrCmp $1 "" 0 RestoreBackup ; if backup == "" then delete the whole key 304 DeleteRegKey HKCR ".bxrc" 305 Goto NoOwn 306 RestoreBackup: 307 WriteRegStr HKCR ".bxrc" "" $1 308 DeleteRegValue HKCR ".bxrc" "backup_val" 309 NoOwn: 310 311 DeleteRegKey HKCR "BochsConfigFile" 312 DeleteRegKey HKLM "SOFTWARE\Bochs" 313 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs" 314 315 Delete "${PGDIR}\*.lnk" 316 Delete "${PGDIR}\*.url" 317 RMDir "${PGDIR}" 318 319 Delete "${DESKTOP_DLXLINK}" 320 321 Delete "$INSTDIR\*.exe" 322 Delete "$INSTDIR\*.txt" 323 Delete "$INSTDIR\slirp.conf" 324 Delete "$INSTDIR\vnet.conf" 325 Delete "$INSTDIR\*.ico" 326 Delete "$INSTDIR\keymaps\*" 327 Delete "$INSTDIR\BIOS-bochs-*" 328 Delete "$INSTDIR\VGABIOS-*" 329 Delete "$INSTDIR\bios.bin-*" 330 Delete "$INSTDIR\vgabios-cirrus.bin-*" 331 Delete "$INSTDIR\SeaBIOS-README.txt" 332 Delete "$INSTDIR\SeaVGABIOS-README.txt" 333 Delete "$INSTDIR\dlxlinux\*" 334 Delete "$INSTDIR\docs\index.html" 335 Delete "$INSTDIR\docs\user\*" 336 Delete "$INSTDIR\docs\development\*" 337 Delete "$INSTDIR\docs\documentation\*" 338 Delete "$INSTDIR\docs\images\*" 339 340 RMDIR "$INSTDIR\keymaps" 341 RMDIR "$INSTDIR\dlxlinux" 342 RMDIR "$INSTDIR\docs\user" 343 RMDIR "$INSTDIR\docs\development" 344 RMDIR "$INSTDIR\docs\documentation" 345 RMDIR "$INSTDIR\docs\images" 346 RMDIR "$INSTDIR\docs" 347 RMDIR "$INSTDIR" 348 349SectionEnd 350 351;-------------------------------- 352;Installer Functions 353 354Function .onInit 355 !insertmacro MULTIUSER_INIT 356 357!if ${BITS} == 64 358 ${IfNot} ${RunningX64} 359 MessageBox MB_ICONSTOP "This Bochs package does not run on 32-bit Windows" 360 Abort 361 ${Endif} 362!endif 363 # This is necessary otherwise SecDLXIcon won't be selectable for the first time you click it. 364 SectionGetFlags ${SecDLX} $R0 365 IntOp $R0 $R0 & ${SF_SELECTED} 366 StrCpy $IndependentSectionState $R0 367 368FunctionEnd 369 370Function un.onInit 371 !insertmacro MULTIUSER_UNINIT 372FunctionEnd 373 374Function .onSelChange 375Push $R0 376Push $R1 377 378 # Check if SecDLX was just selected then select SecDLXIcon. 379 SectionGetFlags ${SecDLX} $R0 380 IntOp $R0 $R0 & ${SF_SELECTED} 381 StrCmp $R0 $IndependentSectionState +3 382 StrCpy $IndependentSectionState $R0 383 Goto UnselectDependentSections 384 StrCpy $IndependentSectionState $R0 385 386 Goto CheckDependentSections 387 388 # Select SecDLX if SecDLXIcon was selected. 389 SelectIndependentSection: 390 391 SectionGetFlags ${SecDLX} $R0 392 IntOp $R1 $R0 & ${SF_SELECTED} 393 StrCmp $R1 ${SF_SELECTED} +3 394 395 IntOp $R0 $R0 | ${SF_SELECTED} 396 SectionSetFlags ${SecDLX} $R0 397 398 StrCpy $IndependentSectionState ${SF_SELECTED} 399 400 Goto End 401 402 # Were SecDLXIcon just unselected? 403 CheckDependentSections: 404 405 SectionGetFlags ${SecDLXIcon} $R0 406 IntOp $R0 $R0 & ${SF_SELECTED} 407 StrCmp $R0 ${SF_SELECTED} SelectIndependentSection 408 409 Goto End 410 411 # Unselect SecDLXIcon if SecDLX was unselected. 412 UnselectDependentSections: 413 414 SectionGetFlags ${SecDLXIcon} $R0 415 IntOp $R1 $R0 & ${SF_SELECTED} 416 StrCmp $R1 ${SF_SELECTED} 0 +3 417 418 IntOp $R0 $R0 ^ ${SF_SELECTED} 419 SectionSetFlags ${SecDLXIcon} $R0 420 421 End: 422 423Pop $R1 424Pop $R0 425FunctionEnd 426 427!ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_SVN 428 429Var ReinstallPageCheck 430Var OldInstDir 431 432Function PageReinstall 433 434 SetRegView ${BITS} 435 ReadRegStr $R0 HKLM "Software\Bochs 2.6.9" "" 436 ReadRegStr $R1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs 2.6.9" "UninstallString" 437 ReadRegStr $R2 HKLM "Software\Bochs" "" 438 ReadRegStr $R3 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs" "UninstallString" 439 440 StrCpy $R4 "older" 441 ${If} "$R0$R1" != "" 442 StrCpy $R0 "2" 443 StrCpy $R1 "6" 444 StrCpy $R2 "9" 445 StrCpy $R3 "0" 446 ${ElseIf} "$R2$R3" != "" 447 ReadRegDWORD $R0 HKLM "Software\Bochs" "VersionMajor" 448 ReadRegDWORD $R1 HKLM "Software\Bochs" "VersionMinor" 449 ReadRegDWORD $R2 HKLM "Software\Bochs" "VersionRevision" 450 ReadRegDWORD $R3 HKLM "Software\Bochs" "VersionSVN" 451 ${Else} 452 Abort 453 ${Endif} 454 455 StrCpy $R0 $R0.$R1.$R2.$R3 456 ${VersionCompare} ${VER_MAJOR}.${VER_MINOR}.${VER_REVISION}.${VER_SVN} $R0 $R0 457 ${If} $R0 == 0 458 StrCpy $R1 "Bochs ${VERSION} is already installed. Select the operation you want to perform and click Next to continue." 459 StrCpy $R2 "Add/Reinstall components" 460 StrCpy $R3 "Uninstall Bochs" 461 !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose the maintenance option to perform." 462 StrCpy $R0 "2" 463 ${ElseIf} $R0 == 1 464 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." 465 StrCpy $R2 "Uninstall before installing" 466 StrCpy $R3 "Do not uninstall" 467 !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install Bochs." 468 StrCpy $R0 "1" 469 ${ElseIf} $R0 == 2 470 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." 471 StrCpy $R2 "Uninstall before installing" 472 StrCpy $R3 "Do not uninstall" 473 !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install Bochs." 474 StrCpy $R0 "1" 475 ${Else} 476 Abort 477 ${EndIf} 478 479 nsDialogs::Create 1018 480 Pop $R4 481 482 ${NSD_CreateLabel} 0 0 100% 24u $R1 483 Pop $R1 484 485 ${NSD_CreateRadioButton} 30u 50u -30u 8u $R2 486 Pop $R2 487 ${NSD_OnClick} $R2 PageReinstallUpdateSelection 488 489 ${NSD_CreateRadioButton} 30u 70u -30u 8u $R3 490 Pop $R3 491 ${NSD_OnClick} $R3 PageReinstallUpdateSelection 492 493 ${If} $ReinstallPageCheck != 2 494 SendMessage $R2 ${BM_SETCHECK} ${BST_CHECKED} 0 495 ${Else} 496 SendMessage $R3 ${BM_SETCHECK} ${BST_CHECKED} 0 497 ${EndIf} 498 499 ${NSD_SetFocus} $R2 500 501 nsDialogs::Show 502 503FunctionEnd 504 505Function PageReinstallUpdateSelection 506 507 Pop $R1 508 509 ${NSD_GetState} $R2 $R1 510 511 ${If} $R1 == ${BST_CHECKED} 512 StrCpy $ReinstallPageCheck 1 513 ${Else} 514 StrCpy $ReinstallPageCheck 2 515 ${EndIf} 516 517FunctionEnd 518 519Function PageLeaveReinstall 520 521 ${NSD_GetState} $R2 $R1 522 523 StrCmp $R0 "1" 0 +2 ; Existing install is not the same version? 524 StrCmp $R1 "1" reinst_uninstall reinst_done 525 526 StrCmp $R1 "1" reinst_done ; Same version, skip to add/reinstall components? 527 528 reinst_uninstall: 529 SetRegView ${BITS} 530 ReadRegStr $R1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs" "UninstallString" 531 ${If} $R1 == "" 532 ReadRegStr $R1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bochs 2.6.9" "UninstallString" 533 ReadRegStr $OldInstDir HKLM "Software\Bochs 2.6.9" "" 534 ${Else} 535 StrCpy $OldInstDir $INSTDIR 536 ${Endif} 537 538 ;Run uninstaller 539 HideWindow 540 541 ClearErrors 542 ExecWait '$R1 _?=$OldInstDir' $0 543 544 BringToFront 545 546 ${IfThen} ${Errors} ${|} StrCpy $0 2 ${|} ; ExecWait failed, set fake exit code 547 548 ${If} $0 <> 0 549 ${OrIf} ${FileExists} "$OldInstDir\bochs.exe" 550 ${If} $0 = 1 ; User aborted uninstaller? 551 StrCmp $R0 "2" 0 +2 ; Is the existing install the same version? 552 Quit ; ...yes, already installed, we are done 553 Abort 554 ${EndIf} 555 MessageBox MB_ICONEXCLAMATION "Unable to uninstall!" 556 Abort 557 ${Else} 558 StrCpy $0 $R1 1 559 ${IfThen} $0 == '"' ${|} StrCpy $R1 $R1 -1 1 ${|} ; Strip quotes from UninstallString 560 Delete $R1 561 RMDir $OldInstDir 562 ${EndIf} 563 564 reinst_done: 565 566FunctionEnd 567 568!endif # VER_MAJOR & VER_MINOR & VER_REVISION & VER_SVN 569 570;eof 571