PageRenderTime 34ms CodeModel.GetById 18ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 1ms

/indra/newview/installers/windows/installer_template.nsi

https://bitbucket.org/lindenlab/viewer-beta/
Unknown | 1036 lines | 849 code | 187 blank | 0 comment | 0 complexity | e29fef6e96b4a72971eb5032ea81bc21 MD5 | raw file
   1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   2;; secondlife setup.nsi
   3;; Copyright 2004-2011, Linden Research, Inc.
   4;;
   5;; This library is free software; you can redistribute it and/or
   6;; modify it under the terms of the GNU Lesser General Public
   7;; License as published by the Free Software Foundation;
   8;; version 2.1 of the License only.
   9;;
  10;; This library is distributed in the hope that it will be useful,
  11;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  12;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13;; Lesser General Public License for more details.
  14;;
  15;; You should have received a copy of the GNU Lesser General Public
  16;; License along with this library; if not, write to the Free Software
  17;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  18;;
  19;; Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  20;;
  21;; NSIS Unicode 2.38.1 or higher required
  22;; http://www.scratchpaper.com/
  23;;
  24;; Author: James Cook, Don Kjer, Callum Prentice
  25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  26
  27;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  28;; Compiler flags
  29;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  30SetOverwrite on				; overwrite files
  31SetCompress auto			; compress iff saves space
  32SetCompressor /solid lzma	; compress whole installer as one block
  33SetDatablockOptimize off	; only saves us 0.1%, not worth it
  34XPStyle on                  ; add an XP manifest to the installer
  35RequestExecutionLevel admin	; on Vista we must be admin because we write to Program Files
  36
  37;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  38;;; Project flags
  39;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  40
  41%%VERSION%%
  42
  43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  44;; - language files - one for each language (or flavor thereof)
  45;; (these files are in the same place as the nsi template but the python script generates a new nsi file in the 
  46;; application directory so we have to add a path to these include files)
  47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  48!include "%%SOURCE%%\installers\windows\lang_da.nsi"
  49!include "%%SOURCE%%\installers\windows\lang_de.nsi"
  50!include "%%SOURCE%%\installers\windows\lang_en-us.nsi"
  51!include "%%SOURCE%%\installers\windows\lang_es.nsi"
  52!include "%%SOURCE%%\installers\windows\lang_fr.nsi"
  53!include "%%SOURCE%%\installers\windows\lang_ja.nsi"
  54!include "%%SOURCE%%\installers\windows\lang_it.nsi"
  55!include "%%SOURCE%%\installers\windows\lang_pl.nsi"
  56!include "%%SOURCE%%\installers\windows\lang_pt-br.nsi"
  57!include "%%SOURCE%%\installers\windows\lang_ru.nsi"
  58!include "%%SOURCE%%\installers\windows\lang_tr.nsi"
  59!include "%%SOURCE%%\installers\windows\lang_zh.nsi"
  60
  61# *TODO: Move these into the language files themselves
  62LangString LanguageCode ${LANG_DANISH}   "da"
  63LangString LanguageCode ${LANG_GERMAN}   "de"
  64LangString LanguageCode ${LANG_ENGLISH}  "en"
  65LangString LanguageCode ${LANG_SPANISH}  "es"
  66LangString LanguageCode ${LANG_FRENCH}   "fr"
  67LangString LanguageCode ${LANG_JAPANESE} "ja"
  68LangString LanguageCode ${LANG_ITALIAN}  "it"
  69LangString LanguageCode ${LANG_POLISH}   "pl"
  70LangString LanguageCode ${LANG_PORTUGUESEBR} "pt"
  71LangString LanguageCode ${LANG_RUSSIAN}  "ru"
  72LangString LanguageCode ${LANG_TURKISH}  "tr"
  73LangString LanguageCode ${LANG_TRADCHINESE}  "zh"
  74
  75;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  76;; Tweak for different servers/builds (this placeholder is replaced by viewer_manifest.py)
  77;; For example:
  78;; !define INSTFLAGS "%(flags)s"
  79;; !define INSTNAME   "SecondLife%(grid_caps)s"
  80;; !define SHORTCUT   "Second Life (%(grid_caps)s)"
  81;; !define URLNAME   "secondlife%(grid)s"
  82;; !define UNINSTALL_SETTINGS 1
  83
  84%%GRID_VARS%%
  85
  86Name ${INSTNAME}
  87
  88SubCaption 0 $(LicenseSubTitleSetup)	; override "license agreement" text
  89
  90BrandingText " "						; bottom of window text
  91Icon          %%SOURCE%%\installers\windows\install_icon.ico
  92UninstallIcon %%SOURCE%%\installers\windows\uninstall_icon.ico
  93WindowIcon on							; show our icon in left corner
  94BGGradient off							; no big background window
  95CRCCheck on								; make sure CRC is OK
  96InstProgressFlags smooth colored		; new colored smooth look
  97ShowInstDetails nevershow				; no details, no "show" button
  98SetOverwrite on							; stomp files by default
  99AutoCloseWindow true					; after all files install, close window
 100
 101InstallDir "$PROGRAMFILES\${INSTNAME}"
 102InstallDirRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\${INSTNAME}" ""
 103DirText $(DirectoryChooseTitle) $(DirectoryChooseSetup)
 104Page directory dirPre
 105Page instfiles
 106
 107;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 108;;; Variables
 109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 110Var INSTPROG
 111Var INSTEXE
 112Var INSTFLAGS
 113Var INSTSHORTCUT
 114Var COMMANDLINE         ; command line passed to this installer, set in .onInit
 115Var SHORTCUT_LANG_PARAM ; "--set InstallLanguage de", passes language to viewer
 116Var SKIP_DIALOGS        ; set from command line in  .onInit. autoinstall 
 117                        ; GUI and the defaults.
 118Var DO_UNINSTALL_V2     ; If non-null, path to a previous Viewer 2 installation that will be uninstalled.
 119
 120;;; Function definitions should go before file includes, because calls to
 121;;; DLLs like LangDLL trigger an implicit file include, so if that call is at
 122;;; the end of this script NSIS has to decompress the whole installer before 
 123;;; it can call the DLL function. JC
 124
 125!include "FileFunc.nsh"     ; For GetParameters, GetOptions
 126!insertmacro GetParameters
 127!insertmacro GetOptions
 128
 129;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 130;;; After install completes, launch app
 131;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 132Function .onInstSuccess
 133    Push $R0	# Option value, unused
 134
 135    StrCmp $SKIP_DIALOGS "true" label_launch 
 136
 137    ${GetOptions} $COMMANDLINE "/AUTOSTART" $R0
 138    # If parameter was there (no error) just launch
 139    # Otherwise ask
 140    IfErrors label_ask_launch label_launch
 141    
 142label_ask_launch:
 143    # Don't launch by default when silent
 144    IfSilent label_no_launch
 145	MessageBox MB_YESNO $(InstSuccesssQuestion) \
 146        IDYES label_launch IDNO label_no_launch
 147        
 148label_launch:
 149	# Assumes SetOutPath $INSTDIR
 150	Exec '"$INSTDIR\$INSTEXE" $INSTFLAGS $SHORTCUT_LANG_PARAM'
 151label_no_launch:
 152	Pop $R0
 153FunctionEnd
 154
 155;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 156;;; Pre-directory page callback
 157;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 158Function dirPre
 159    StrCmp $SKIP_DIALOGS "true" 0 +2
 160	Abort
 161FunctionEnd    
 162
 163;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 164; Make sure we're not on Windows 98 / ME
 165;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 166Function CheckWindowsVersion
 167	DetailPrint "Checking Windows version..."
 168	Call GetWindowsVersion
 169	Pop $R0
 170	; Just get first two characters, ignore 4.0 part of "NT 4.0"
 171	StrCpy $R0 $R0 2
 172	; Blacklist certain OS versions
 173	StrCmp $R0 "95" win_ver_bad
 174	StrCmp $R0 "98" win_ver_bad
 175	StrCmp $R0 "ME" win_ver_bad
 176	StrCmp $R0 "NT" win_ver_bad
 177	Return
 178win_ver_bad:
 179	StrCmp $SKIP_DIALOGS "true" +2 ; If skip_dialogs is set just install
 180            MessageBox MB_YESNO $(CheckWindowsVersionMB) IDNO win_ver_abort
 181	Return
 182win_ver_abort:
 183	Quit
 184FunctionEnd
 185
 186;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 187; Make sure the user can install/uninstall
 188;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 189Function CheckIfAdministrator
 190    DetailPrint $(CheckAdministratorInstDP)
 191    UserInfo::GetAccountType
 192    Pop $R0
 193    StrCmp $R0 "Admin" lbl_is_admin
 194        MessageBox MB_OK $(CheckAdministratorInstMB)
 195        Quit
 196lbl_is_admin:
 197    Return
 198FunctionEnd
 199
 200;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 201;;
 202;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 203Function un.CheckIfAdministrator
 204    DetailPrint $(CheckAdministratorUnInstDP)
 205    UserInfo::GetAccountType
 206    Pop $R0
 207    StrCmp $R0 "Admin" lbl_is_admin
 208        MessageBox MB_OK $(CheckAdministratorUnInstMB)
 209        Quit
 210lbl_is_admin:
 211    Return
 212FunctionEnd
 213
 214;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 215; Checks to see if the current version has already been installed (according to the registry).
 216; If it has, allow user to bail out of install process.
 217;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 218Function CheckIfAlreadyCurrent
 219    Push $0
 220    ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Version"
 221    StrCmp $0 ${VERSION_LONG} 0 continue_install
 222    StrCmp $SKIP_DIALOGS "true" continue_install
 223    MessageBox MB_OKCANCEL $(CheckIfCurrentMB) /SD IDOK IDOK continue_install
 224    Quit
 225continue_install:
 226    Pop $0
 227    Return
 228FunctionEnd
 229	
 230;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 231; Checks for CPU valid (must have SSE2 support)
 232;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 233Function CheckCPUFlags
 234    Call GetWindowsVersion
 235    Pop $R0
 236    StrCmp $R0 "2000" OK_SSE  ; sse check not available on win2k.
 237
 238    Push $1
 239    System::Call 'kernel32::IsProcessorFeaturePresent(i) i(10) .r1'
 240    IntCmp $1 1 OK_SSE
 241    MessageBox MB_OKCANCEL $(MissingSSE2) /SD IDOK IDOK OK_SSE
 242    Quit
 243
 244  OK_SSE:
 245    Pop $1
 246    Return
 247FunctionEnd
 248
 249;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 250; Close the program, if running. Modifies no variables.
 251; Allows user to bail out of install process.
 252;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 253Function CloseSecondLife
 254  Push $0
 255  FindWindow $0 "Second Life" ""
 256  IntCmp $0 0 DONE
 257  
 258  StrCmp $SKIP_DIALOGS "true" CLOSE
 259    MessageBox MB_OKCANCEL $(CloseSecondLifeInstMB) IDOK CLOSE IDCANCEL CANCEL_INSTALL
 260
 261  CANCEL_INSTALL:
 262    Quit
 263
 264  CLOSE:
 265    DetailPrint $(CloseSecondLifeInstDP)
 266    SendMessage $0 16 0 0
 267
 268  LOOP:
 269	  FindWindow $0 "Second Life" ""
 270	  IntCmp $0 0 DONE
 271	  Sleep 500
 272	  Goto LOOP
 273
 274  DONE:
 275    Pop $0
 276    Return
 277FunctionEnd
 278
 279;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 280; Test our connection to secondlife.com
 281; Also allows us to count attempted installs by examining web logs.
 282; *TODO: Return current SL version info and have installer check
 283; if it is up to date.
 284;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 285Function CheckNetworkConnection
 286    Push $0
 287    Push $1
 288    Push $2	# Option value for GetOptions
 289    DetailPrint $(CheckNetworkConnectionDP)
 290    ; Look for a tag value from the stub installer, used for statistics
 291    ; to correlate installs.  Default to "" if not found on command line.
 292    StrCpy $2 ""
 293    ${GetOptions} $COMMANDLINE "/STUBTAG=" $2
 294    GetTempFileName $0
 295    !define HTTP_TIMEOUT 5000 ; milliseconds
 296    ; Don't show secondary progress bar, this will be quick.
 297    NSISdl::download_quiet \
 298        /TIMEOUT=${HTTP_TIMEOUT} \
 299        "http://install.secondlife.com/check/?stubtag=$2&version=${VERSION_LONG}" \
 300        $0
 301    Pop $1 ; Return value, either "success", "cancel" or an error message
 302    ; MessageBox MB_OK "Download result: $1"
 303    ; Result ignored for now
 304	; StrCmp $1 "success" +2
 305	;	DetailPrint "Connection failed: $1"
 306    Delete $0 ; temporary file
 307    Pop $2
 308    Pop $1
 309    Pop $0
 310    Return
 311FunctionEnd
 312
 313
 314;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 315; Function CheckWillUninstallV2               
 316;
 317; If we are being called through auto-update, we need to uninstall any
 318; existing V2 installation. Otherwise, we wind up with
 319; SecondLifeViewer2 and SecondLifeViewer installations existing side
 320; by side no indication which to use.
 321; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 322Function CheckWillUninstallV2
 323
 324  StrCpy $DO_UNINSTALL_V2 ""
 325
 326  StrCmp $SKIP_DIALOGS "true" 0 CHECKV2_DONE
 327  StrCmp $INSTDIR "$PROGRAMFILES\SecondLifeViewer2" CHECKV2_DONE ; don't uninstall our own install dir.
 328  IfFileExists "$PROGRAMFILES\SecondLifeViewer2\uninst.exe" CHECKV2_FOUND CHECKV2_DONE
 329
 330CHECKV2_FOUND:
 331  StrCpy $DO_UNINSTALL_V2 "true"
 332
 333CHECKV2_DONE:
 334
 335FunctionEnd
 336
 337;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 338; Save user files to temp location
 339;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 340Function PreserveUserFiles
 341
 342Push $0
 343Push $1
 344Push $2
 345
 346    RMDir /r "$TEMP\SecondLifeSettingsBackup"
 347    CreateDirectory "$TEMP\SecondLifeSettingsBackup"
 348    StrCpy $0 0 ; Index number used to iterate via EnumRegKey
 349
 350  LOOP:
 351    EnumRegKey $1 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" $0
 352    StrCmp $1 "" DONE               ; no more users
 353
 354    ReadRegStr $2 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$1" "ProfileImagePath" 
 355    StrCmp $2 "" CONTINUE 0         ; "ProfileImagePath" value is missing
 356
 357    ; Required since ProfileImagePath is of type REG_EXPAND_SZ
 358    ExpandEnvStrings $2 $2
 359
 360    CreateDirectory "$TEMP\SecondLifeSettingsBackup\$0"
 361    CopyFiles /SILENT "$2\Application Data\SecondLife\*" "$TEMP\SecondLifeSettingsBackup\$0"
 362
 363  CONTINUE:
 364    IntOp $0 $0 + 1
 365    Goto LOOP
 366  DONE:
 367
 368Pop $2
 369Pop $1
 370Pop $0
 371
 372; Copy files in Documents and Settings\All Users\SecondLife
 373Push $0
 374    ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Common AppData"
 375    StrCmp $0 "" +2
 376    CreateDirectory "$TEMP\SecondLifeSettingsBackup\AllUsers\"
 377    CopyFiles /SILENT "$2\Application Data\SecondLife\*" "$TEMP\SecondLifeSettingsBackup\AllUsers\"
 378Pop $0
 379
 380FunctionEnd
 381
 382;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 383; Restore user files from temp location
 384;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 385Function RestoreUserFiles
 386
 387Push $0
 388Push $1
 389Push $2
 390
 391    StrCpy $0 0 ; Index number used to iterate via EnumRegKey
 392
 393  LOOP:
 394    EnumRegKey $1 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" $0
 395    StrCmp $1 "" DONE               ; no more users
 396
 397    ReadRegStr $2 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$1" "ProfileImagePath" 
 398    StrCmp $2 "" CONTINUE 0         ; "ProfileImagePath" value is missing
 399
 400    ; Required since ProfileImagePath is of type REG_EXPAND_SZ
 401    ExpandEnvStrings $2 $2
 402
 403    CreateDirectory "$2\Application Data\SecondLife\"
 404    CopyFiles /SILENT "$TEMP\SecondLifeSettingsBackup\$0\*" "$2\Application Data\SecondLife\" 
 405
 406  CONTINUE:
 407    IntOp $0 $0 + 1
 408    Goto LOOP
 409  DONE:
 410
 411Pop $2
 412Pop $1
 413Pop $0
 414
 415; Copy files in Documents and Settings\All Users\SecondLife
 416Push $0
 417    ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Common AppData"
 418    StrCmp $0 "" +2
 419    CreateDirectory "$2\Application Data\SecondLife\"
 420    CopyFiles /SILENT "$TEMP\SecondLifeSettingsBackup\AllUsers\*" "$2\Application Data\SecondLife\" 
 421Pop $0
 422
 423FunctionEnd
 424
 425;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 426; Remove temp dirs
 427;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 428Function RemoveTempUserFiles
 429
 430Push $0
 431Push $1
 432Push $2
 433
 434    StrCpy $0 0 ; Index number used to iterate via EnumRegKey
 435
 436  LOOP:
 437    EnumRegKey $1 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" $0
 438    StrCmp $1 "" DONE               ; no more users
 439
 440    ReadRegStr $2 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$1" "ProfileImagePath" 
 441    StrCmp $2 "" CONTINUE 0         ; "ProfileImagePath" value is missing
 442
 443    ; Required since ProfileImagePath is of type REG_EXPAND_SZ
 444    ExpandEnvStrings $2 $2
 445
 446    RMDir /r "$TEMP\SecondLifeSettingsBackup\$0\*"
 447
 448  CONTINUE:
 449    IntOp $0 $0 + 1
 450    Goto LOOP
 451  DONE:
 452
 453Pop $2
 454Pop $1
 455Pop $0
 456
 457; Copy files in Documents and Settings\All Users\SecondLife
 458Push $0
 459    ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Common AppData"
 460    StrCmp $0 "" +2
 461    RMDir /r "$TEMP\SecondLifeSettingsBackup\AllUsers\*"
 462Pop $0
 463
 464FunctionEnd
 465
 466
 467;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 468; Clobber user files - TEST ONLY
 469; This is here for testing, generally not desirable to call it.
 470;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 471;Function ClobberUserFilesTESTONLY
 472
 473;Push $0
 474;Push $1
 475;Push $2
 476;
 477;    StrCpy $0 0 ; Index number used to iterate via EnumRegKey
 478;
 479;  LOOP:
 480;    EnumRegKey $1 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" $0
 481;    StrCmp $1 "" DONE               ; no more users
 482;
 483;    ReadRegStr $2 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$1" "ProfileImagePath" 
 484;    StrCmp $2 "" CONTINUE 0         ; "ProfileImagePath" value is missing
 485;
 486;    ; Required since ProfileImagePath is of type REG_EXPAND_SZ
 487;    ExpandEnvStrings $2 $2
 488;
 489;    RMDir /r "$2\Application Data\SecondLife\"
 490;
 491;  CONTINUE:
 492;    IntOp $0 $0 + 1
 493;    Goto LOOP
 494;  DONE:
 495;
 496;Pop $2
 497;Pop $1
 498;Pop $0
 499;
 500;; Copy files in Documents and Settings\All Users\SecondLife
 501;Push $0
 502;    ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Common AppData"
 503;    StrCmp $0 "" +2
 504;    RMDir /r "$2\Application Data\SecondLife\"
 505;Pop $0
 506;
 507;FunctionEnd
 508
 509;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 510;;; Delete the installed shader files
 511;;; Since shaders are in active development, we'll likely need to shuffle them
 512;;; around a bit from build to build.  This ensures that shaders that we move
 513;;; or rename in the dev tree don't get left behind in the install.
 514;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 515Function RemoveOldShaders
 516
 517;; Remove old shader files first so fallbacks will work. see DEV-5663
 518RMDir /r "$INSTDIR\app_settings\shaders\*"
 519
 520FunctionEnd
 521
 522;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 523;;; Delete the installed XUI files
 524;;; We've changed the directory hierarchy for skins, putting all XUI and texture
 525;;; files under a specific skin directory, i.e. skins/default/xui/en-us as opposed
 526;;; to skins/xui/en-us.  Need to clean up the old path when upgrading
 527;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 528Function RemoveOldXUI
 529
 530;; remove old XUI and texture files
 531RmDir /r "$INSTDIR\skins\html"
 532RmDir /r "$INSTDIR\skins\xui"
 533RmDir /r "$INSTDIR\skins\textures"
 534Delete "$INSTDIR\skins\*.txt"
 535
 536FunctionEnd
 537
 538;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 539;;; Remove any releasenotes files.
 540;;; We are no longer including release notes with the viewer. This will delete
 541;;; any that were left behind by an older installer. Delete will not fail if
 542;;; the files do not exist
 543;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 544Function RemoveOldReleaseNotes
 545
 546;; remove releasenotes.txt file from application directory, and the shortcut
 547;; from the start menu.
 548Delete "$SMPROGRAMS\$INSTSHORTCUT\SL Release Notes.lnk"
 549Delete "$INSTDIR\releasenotes.txt"
 550
 551FunctionEnd
 552
 553
 554;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 555; Delete files in Documents and Settings\<user>\SecondLife
 556; Delete files in Documents and Settings\All Users\SecondLife
 557;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 558Function un.DocumentsAndSettingsFolder
 559
 560; Delete files in Documents and Settings\<user>\SecondLife
 561Push $0
 562Push $1
 563Push $2
 564
 565  DetailPrint "Deleting files in Documents and Settings folder"
 566
 567  StrCpy $0 0 ; Index number used to iterate via EnumRegKey
 568
 569  LOOP:
 570    EnumRegKey $1 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" $0
 571    StrCmp $1 "" DONE               ; no more users
 572
 573    ReadRegStr $2 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$1" "ProfileImagePath" 
 574    StrCmp $2 "" CONTINUE 0         ; "ProfileImagePath" value is missing
 575
 576    ; Required since ProfileImagePath is of type REG_EXPAND_SZ
 577    ExpandEnvStrings $2 $2
 578
 579        ; Remove all cache and settings files but leave any other .txt files to preserve the chat logs
 580;    RMDir /r "$2\Application Data\SecondLife\logs"
 581    RMDir /r "$2\Application Data\SecondLife\browser_profile"
 582    RMDir /r "$2\Application Data\SecondLife\user_settings"
 583    Delete  "$2\Application Data\SecondLife\*.xml"
 584    Delete  "$2\Application Data\SecondLife\*.bmp"
 585    Delete  "$2\Application Data\SecondLife\search_history.txt"
 586    Delete  "$2\Application Data\SecondLife\plugin_cookies.txt"
 587    Delete  "$2\Application Data\SecondLife\typed_locations.txt"
 588
 589  CONTINUE:
 590    IntOp $0 $0 + 1
 591    Goto LOOP
 592  DONE:
 593
 594Pop $2
 595Pop $1
 596Pop $0
 597
 598; Delete files in Documents and Settings\All Users\SecondLife
 599Push $0
 600  ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Common AppData"
 601  StrCmp $0 "" +2
 602  RMDir /r "$0\SecondLife"
 603Pop $0
 604
 605; Delete files in C:\Windows\Application Data\SecondLife
 606; If the user is running on a pre-NT system, Application Data lives here instead of
 607; in Documents and Settings.
 608RMDir /r "$WINDIR\Application Data\SecondLife"
 609
 610FunctionEnd
 611
 612;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 613; Close the program, if running. Modifies no variables.
 614; Allows user to bail out of uninstall process.
 615;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 616Function un.CloseSecondLife
 617  Push $0
 618  FindWindow $0 "Second Life" ""
 619  IntCmp $0 0 DONE
 620  MessageBox MB_OKCANCEL $(CloseSecondLifeUnInstMB) IDOK CLOSE IDCANCEL CANCEL_UNINSTALL
 621
 622  CANCEL_UNINSTALL:
 623    Quit
 624
 625  CLOSE:
 626    DetailPrint $(CloseSecondLifeUnInstDP)
 627    SendMessage $0 16 0 0
 628
 629  LOOP:
 630	  FindWindow $0 "Second Life" ""
 631	  IntCmp $0 0 DONE
 632	  Sleep 500
 633	  Goto LOOP
 634
 635  DONE:
 636    Pop $0
 637    Return
 638FunctionEnd
 639
 640
 641;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 642;
 643;   Delete the stored password for the current Windows user
 644;   DEV-10821 -- Unauthorised user can gain access to an SL account after a real user has uninstalled
 645;
 646Function un.RemovePassword
 647
 648DetailPrint "Removing Second Life password"
 649
 650SetShellVarContext current
 651Delete "$APPDATA\SecondLife\user_settings\password.dat"
 652SetShellVarContext all
 653
 654FunctionEnd
 655
 656;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 657;;; Delete the installed files
 658;;; This deletes the uninstall executable, but it works 
 659;;; because it is copied to temp directory before running
 660;;;
 661;;; Note:  You must list all files here, because we only
 662;;; want to delete our files, not things users left in the
 663;;; application directories.
 664;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 665Function un.ProgramFiles
 666
 667;; Remove mozilla file first so recursive directory deletion doesn't get hung up
 668Delete "$INSTDIR\app_settings\mozilla\components"
 669
 670;; This placeholder is replaced by the complete list of files to uninstall by viewer_manifest.py
 671%%DELETE_FILES%%
 672
 673;; Optional/obsolete files.  Delete won't fail if they don't exist.
 674Delete "$INSTDIR\dronesettings.ini"
 675Delete "$INSTDIR\message_template.msg"
 676Delete "$INSTDIR\newview.pdb"
 677Delete "$INSTDIR\newview.map"
 678Delete "$INSTDIR\SecondLife.pdb"
 679Delete "$INSTDIR\SecondLife.map"
 680Delete "$INSTDIR\comm.dat"
 681Delete "$INSTDIR\*.glsl"
 682Delete "$INSTDIR\motions\*.lla"
 683Delete "$INSTDIR\trial\*.html"
 684Delete "$INSTDIR\newview.exe"
 685;; Remove entire help directory
 686Delete "$INSTDIR\help\Advanced\*"
 687RMDir  "$INSTDIR\help\Advanced"
 688Delete "$INSTDIR\help\basics\*"
 689RMDir  "$INSTDIR\help\basics"
 690Delete "$INSTDIR\help\Concepts\*"
 691RMDir  "$INSTDIR\help\Concepts"
 692Delete "$INSTDIR\help\welcome\*"
 693RMDir  "$INSTDIR\help\welcome"
 694Delete "$INSTDIR\help\*"
 695RMDir  "$INSTDIR\help"
 696
 697Delete "$INSTDIR\uninst.exe"
 698RMDir "$INSTDIR"
 699
 700IfFileExists "$INSTDIR" FOLDERFOUND NOFOLDER
 701
 702FOLDERFOUND:
 703  ; Silent uninstall always removes all files (/SD IDYES)
 704  MessageBox MB_YESNO $(DeleteProgramFilesMB) /SD IDYES IDNO NOFOLDER
 705  RMDir /r "$INSTDIR"
 706
 707NOFOLDER:
 708
 709FunctionEnd
 710
 711;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 712;;; Uninstall settings
 713;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 714UninstallText $(UninstallTextMsg)
 715ShowUninstDetails show
 716
 717;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 718;;; Uninstall section
 719;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 720Section Uninstall
 721
 722; Start with some default values.
 723StrCpy $INSTFLAGS ""
 724StrCpy $INSTPROG "${INSTNAME}"
 725StrCpy $INSTEXE "${INSTEXE}"
 726StrCpy $INSTSHORTCUT "${SHORTCUT}"
 727Call un.CheckIfAdministrator		; Make sure the user can install/uninstall
 728
 729; uninstall for all users (if you change this, change it in the install as well)
 730SetShellVarContext all			
 731
 732; Make sure we're not running
 733Call un.CloseSecondLife
 734
 735; Clean up registry keys and subkeys (these should all be !defines somewhere)
 736DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG"
 737DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG"
 738
 739; Clean up shortcuts
 740Delete "$SMPROGRAMS\$INSTSHORTCUT\*.*"
 741RMDir  "$SMPROGRAMS\$INSTSHORTCUT"
 742
 743Delete "$DESKTOP\$INSTSHORTCUT.lnk"
 744Delete "$INSTDIR\$INSTSHORTCUT.lnk"
 745Delete "$INSTDIR\Uninstall $INSTSHORTCUT.lnk"
 746
 747; Clean up cache and log files.
 748; Leave them in-place for non AGNI installs.
 749
 750!ifdef UNINSTALL_SETTINGS
 751Call un.DocumentsAndSettingsFolder
 752!endif
 753
 754; remove stored password on uninstall
 755Call un.RemovePassword
 756
 757Call un.ProgramFiles
 758
 759SectionEnd 				; end of uninstall section
 760
 761
 762;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 763; (From the NSIS documentation, JC)
 764; GetWindowsVersion
 765;
 766; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/
 767; Updated by Joost Verburg
 768;
 769; Returns on top of stack
 770;
 771; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003)
 772; or
 773; '' (Unknown Windows Version)
 774;
 775; Usage:
 776;   Call GetWindowsVersion
 777;   Pop $R0
 778;   ; at this point $R0 is "NT 4.0" or whatnot
 779;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 780Function GetWindowsVersion
 781 
 782   Push $R0
 783   Push $R1
 784 
 785   ReadRegStr $R0 HKLM \
 786   "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
 787
 788   IfErrors 0 lbl_winnt
 789   
 790   ; we are not NT
 791   ReadRegStr $R0 HKLM \
 792   "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
 793 
 794   StrCpy $R1 $R0 1
 795   StrCmp $R1 '4' 0 lbl_error
 796 
 797   StrCpy $R1 $R0 3
 798 
 799   StrCmp $R1 '4.0' lbl_win32_95
 800   StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
 801 
 802   lbl_win32_95:
 803     StrCpy $R0 '95'
 804   Goto lbl_done
 805 
 806   lbl_win32_98:
 807     StrCpy $R0 '98'
 808   Goto lbl_done
 809 
 810   lbl_win32_ME:
 811     StrCpy $R0 'ME'
 812   Goto lbl_done
 813 
 814   lbl_winnt:
 815 
 816   StrCpy $R1 $R0 1
 817 
 818   StrCmp $R1 '3' lbl_winnt_x
 819   StrCmp $R1 '4' lbl_winnt_x
 820 
 821   StrCpy $R1 $R0 3
 822 
 823   StrCmp $R1 '5.0' lbl_winnt_2000
 824   StrCmp $R1 '5.1' lbl_winnt_XP
 825   StrCmp $R1 '5.2' lbl_winnt_2003 lbl_error
 826 
 827   lbl_winnt_x:
 828     StrCpy $R0 "NT $R0" 6
 829   Goto lbl_done
 830 
 831   lbl_winnt_2000:
 832     Strcpy $R0 '2000'
 833   Goto lbl_done
 834 
 835   lbl_winnt_XP:
 836     Strcpy $R0 'XP'
 837   Goto lbl_done
 838 
 839   lbl_winnt_2003:
 840     Strcpy $R0 '2003'
 841   Goto lbl_done
 842 
 843   lbl_error:
 844     Strcpy $R0 ''
 845   lbl_done:
 846 
 847   Pop $R1
 848   Exch $R0
 849 
 850FunctionEnd
 851
 852;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 853;;  Note: to add new languages, add a language file include to the list 
 854;;  at the top of this file, add an entry to the menu and then add an 
 855;;  entry to the language ID selector below
 856;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 857Function .onInit
 858    Push $0
 859    ${GetParameters} $COMMANDLINE              ; get our command line
 860
 861    ${GetOptions} $COMMANDLINE "/SKIP_DIALOGS" $0   
 862    IfErrors +2 0 ; If error jump past setting SKIP_DIALOGS
 863        StrCpy $SKIP_DIALOGS "true"
 864
 865    ${GetOptions} $COMMANDLINE "/LANGID=" $0   ; /LANGID=1033 implies US English
 866    ; If no language (error), then proceed
 867    IfErrors lbl_configure_default_lang
 868    ; No error means we got a language, so use it
 869    StrCpy $LANGUAGE $0
 870    Goto lbl_return
 871
 872lbl_configure_default_lang:
 873    ; If we currently have a version of SL installed, default to the language of that install
 874    ; Otherwise don't change $LANGUAGE and it will default to the OS UI language.
 875    ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\${INSTNAME}" "InstallerLanguage"
 876    IfErrors +2 0 ; If error skip the copy instruction 
 877	StrCpy $LANGUAGE $0
 878
 879    ; For silent installs, no language prompt, use default
 880    IfSilent lbl_return
 881    StrCmp $SKIP_DIALOGS "true" lbl_return
 882  
 883lbl_build_menu:
 884	Push ""
 885    # Use separate file so labels can be UTF-16 but we can still merge changes
 886    # into this ASCII file. JC
 887    !include "%%SOURCE%%\installers\windows\language_menu.nsi"
 888    
 889	Push A ; A means auto count languages for the auto count to work the first empty push (Push "") must remain
 890	LangDLL::LangDialog $(InstallerLanguageTitle) $(SelectInstallerLanguage)
 891	Pop $0
 892	StrCmp $0 "cancel" 0 +2
 893		Abort
 894    StrCpy $LANGUAGE $0
 895
 896	; save language in registry		
 897	WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\${INSTNAME}" "InstallerLanguage" $LANGUAGE
 898lbl_return:
 899    Pop $0
 900    Return
 901FunctionEnd
 902
 903;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 904Function un.onInit
 905	; read language from registry and set for uninstaller
 906    ; Key will be removed on successful uninstall
 907	ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\${INSTNAME}" "InstallerLanguage"
 908    IfErrors lbl_end
 909	StrCpy $LANGUAGE $0
 910lbl_end:
 911    Return
 912FunctionEnd
 913
 914;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 915;;; MAIN SECTION
 916;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 917Section ""						; (default section)
 918
 919SetShellVarContext all			; install for all users (if you change this, change it in the uninstall as well)
 920
 921; Start with some default values.
 922StrCpy $INSTFLAGS "${INSTFLAGS}"
 923StrCpy $INSTPROG "${INSTNAME}"
 924StrCpy $INSTEXE "${INSTEXE}"
 925StrCpy $INSTSHORTCUT "${SHORTCUT}"
 926
 927Call CheckWindowsVersion		; warn if on Windows 98/ME
 928Call CheckCPUFlags			; Make sure we have SSE2 support
 929Call CheckIfAdministrator		; Make sure the user can install/uninstall
 930Call CheckIfAlreadyCurrent		; Make sure that we haven't already installed this version
 931Call CloseSecondLife			; Make sure we're not running
 932Call CheckNetworkConnection		; ping secondlife.com
 933Call CheckWillUninstallV2               ; See if a V2 install exists and will be removed.
 934
 935;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 936StrCmp $DO_UNINSTALL_V2 "" PRESERVE_DONE
 937  Call PreserveUserFiles
 938PRESERVE_DONE:
 939
 940;;; Don't remove cache files during a regular install, removing the inventory cache on upgrades results in lots of damage to the servers.
 941;Call RemoveCacheFiles			; Installing over removes potentially corrupted
 942								; VFS and cache files.
 943;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 944;;; Need to clean out shader files from previous installs to fix DEV-5663
 945Call RemoveOldShaders
 946
 947;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 948;;; Need to clean out old XUI files that predate skinning
 949Call RemoveOldXUI
 950
 951;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 952;;; Clear out old releasenotes.txt files. These are now on the public wiki.
 953Call RemoveOldReleaseNotes
 954
 955;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 956;;; Files
 957;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 958;; This placeholder is replaced by the complete list of all the files in the installer, by viewer_manifest.py
 959%%INSTALL_FILES%%
 960
 961# Pass the installer's language to the client to use as a default
 962StrCpy $SHORTCUT_LANG_PARAM "--set InstallLanguage $(LanguageCode)"
 963
 964;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 965; Shortcuts in start menu
 966CreateDirectory	"$SMPROGRAMS\$INSTSHORTCUT"
 967SetOutPath "$INSTDIR"
 968CreateShortCut	"$SMPROGRAMS\$INSTSHORTCUT\$INSTSHORTCUT.lnk" \
 969				"$INSTDIR\$INSTEXE" "$INSTFLAGS $SHORTCUT_LANG_PARAM"
 970
 971
 972WriteINIStr		"$SMPROGRAMS\$INSTSHORTCUT\SL Create Account.url" \
 973				"InternetShortcut" "URL" \
 974				"http://join.secondlife.com/"
 975WriteINIStr		"$SMPROGRAMS\$INSTSHORTCUT\SL Your Account.url" \
 976				"InternetShortcut" "URL" \
 977				"http://www.secondlife.com/account/"
 978WriteINIStr		"$SMPROGRAMS\$INSTSHORTCUT\SL Scripting Language Help.url" \
 979				"InternetShortcut" "URL" \
 980                "http://wiki.secondlife.com/wiki/LSL_Portal"
 981CreateShortCut	"$SMPROGRAMS\$INSTSHORTCUT\Uninstall $INSTSHORTCUT.lnk" \
 982				'"$INSTDIR\uninst.exe"' ''
 983
 984;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 985; Other shortcuts
 986SetOutPath "$INSTDIR"
 987CreateShortCut "$DESKTOP\$INSTSHORTCUT.lnk" \
 988        "$INSTDIR\$INSTEXE" "$INSTFLAGS $SHORTCUT_LANG_PARAM"
 989CreateShortCut "$INSTDIR\$INSTSHORTCUT.lnk" \
 990        "$INSTDIR\$INSTEXE" "$INSTFLAGS $SHORTCUT_LANG_PARAM"
 991CreateShortCut "$INSTDIR\Uninstall $INSTSHORTCUT.lnk" \
 992				'"$INSTDIR\uninst.exe"' ''
 993
 994
 995;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 996; Write registry
 997WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "" "$INSTDIR"
 998WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Version" "${VERSION_LONG}"
 999WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Flags" "$INSTFLAGS"
1000WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Shortcut" "$INSTSHORTCUT"
1001WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Linden Research, Inc.\$INSTPROG" "Exe" "$INSTEXE"
1002WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" "DisplayName" "$INSTPROG (remove only)"
1003WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\$INSTPROG" "UninstallString" '"$INSTDIR\uninst.exe"'
1004
1005;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1006; Write URL registry info
1007WriteRegStr HKEY_CLASSES_ROOT "${URLNAME}" "(default)" "URL:Second Life"
1008WriteRegStr HKEY_CLASSES_ROOT "${URLNAME}" "URL Protocol" ""
1009WriteRegStr HKEY_CLASSES_ROOT "${URLNAME}\DefaultIcon" "" '"$INSTDIR\$INSTEXE"'
1010;; URL param must be last item passed to viewer, it ignores subsequent params
1011;; to avoid parameter injection attacks.
1012WriteRegExpandStr HKEY_CLASSES_ROOT "${URLNAME}\shell\open\command" "" '"$INSTDIR\$INSTEXE" $INSTFLAGS -url "%1"'
1013WriteRegStr HKEY_CLASSES_ROOT "x-grid-location-info"(default)" "URL:Second Life"
1014WriteRegStr HKEY_CLASSES_ROOT "x-grid-location-info" "URL Protocol" ""
1015WriteRegStr HKEY_CLASSES_ROOT "x-grid-location-info\DefaultIcon" "" '"$INSTDIR\$INSTEXE"'
1016;; URL param must be last item passed to viewer, it ignores subsequent params
1017;; to avoid parameter injection attacks.
1018WriteRegExpandStr HKEY_CLASSES_ROOT "x-grid-location-info\shell\open\command" "" '"$INSTDIR\$INSTEXE" $INSTFLAGS -url "%1"'
1019
1020; write out uninstaller
1021WriteUninstaller "$INSTDIR\uninst.exe"
1022
1023; Uninstall existing "Second Life Viewer 2" install if needed.
1024StrCmp $DO_UNINSTALL_V2 "" REMOVE_SLV2_DONE
1025  ExecWait '"$PROGRAMFILES\SecondLifeViewer2\uninst.exe" /S _?=$PROGRAMFILES\SecondLifeViewer2'
1026  Delete "$PROGRAMFILES\SecondLifeViewer2\uninst.exe" ; with _? option above, uninst.exe will be left behind.
1027  RMDir "$PROGRAMFILES\SecondLifeViewer2" ; will remove only if empty.
1028
1029  Call RestoreUserFiles
1030  Call RemoveTempUserFiles
1031REMOVE_SLV2_DONE:
1032
1033; end of default section
1034SectionEnd
1035
1036;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; EOF  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;