diff options
author | Berke Viktor <berkeviktor@aol.com> | 2011-11-23 11:26:35 +0100 |
---|---|---|
committer | Berke Viktor <berkeviktor@aol.com> | 2011-11-23 11:26:35 +0100 |
commit | 4baba642be4767b88771d8714d04d0d06dcc9f63 (patch) | |
tree | 4d68fcbd25916e5e89e966f0b7902f10a70bcbb2 /build | |
parent | 34a77fdbc573d2302a8f15660b4a4f93fe89f1a9 (diff) |
xchat-wdk updater for 1498, uninstalls old version then opens the download page
Diffstat (limited to 'build')
-rw-r--r-- | build/xchat-wdk.iss | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/build/xchat-wdk.iss b/build/xchat-wdk.iss new file mode 100644 index 00000000..6d7fba99 --- /dev/null +++ b/build/xchat-wdk.iss @@ -0,0 +1,106 @@ +[Setup] +WizardImageFile=c:\mozilla-build\build\xchat-wdk\build\bitmaps\wizardimage.bmp +WizardSmallImageFile=c:\mozilla-build\build\xchat-wdk\build\bitmaps\wizardsmallimage.bmp +AppVerName=XChat-WDK 1498 +AppVersion=14.98.0.0 +VersionInfoVersion=14.98.0.0 +OutputBaseFilename=XChat-WDK 1498 +SetupIconFile=c:\mozilla-build\build\xchat-wdk\xchat.ico +AppName=XChat-WDK +AppPublisher=XChat-WDK +AppPublisherURL=http://www.xchat-wdk.org/ +AppCopyright=Copyright (C) 1998-2010 Peter Zelezny +AppSupportURL=http://code.google.com/p/xchat-wdk/issues/list +AppUpdatesURL=http://www.xchat-wdk.org/home/downloads +UninstallDisplayIcon={app}\xchat.exe +UninstallDisplayName=XChat-WDK +DefaultDirName={pf}\XChat-WDK +DefaultGroupName=XChat-WDK +DisableProgramGroupPage=yes +DisableDirPage=yes +DisableReadyPage=yes +DisableReadyMemo=yes +SolidCompression=yes +SourceDir=..\tmp +OutputDir=..\build +FlatComponentsList=no +PrivilegesRequired=none +ShowComponentSizes=no +CreateUninstallRegKey=no +Uninstallable=no +ArchitecturesAllowed=x86 x64 +ArchitecturesInstallIn64BitMode=x64 + +[Messages] +BeveledLabel= XChat-WDK + +[Code] +///////////////////////////////////////////////////////////////////// +// these are required for x86->x64 or reverse upgrades +///////////////////////////////////////////////////////////////////// +function GetUninstallString(): String; +var + sUnInstPath: String; + sUnInstallString: String; +begin + sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\XChat-WDK_is1'); + sUnInstallString := ''; + if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then + RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString); + Result := sUnInstallString; +end; + + +///////////////////////////////////////////////////////////////////// +function IsUpgrade(): Boolean; +begin + Result := (GetUninstallString() <> ''); +end; + + +///////////////////////////////////////////////////////////////////// +function UnInstallOldVersion(): Integer; +var + sUnInstallString: String; + iResultCode: Integer; +begin +// Return Values: +// 1 - uninstall string is empty +// 2 - error executing the UnInstallString +// 3 - successfully executed the UnInstallString + + // default return value + Result := 0; + + // get the uninstall string of the old app + sUnInstallString := GetUninstallString(); + if sUnInstallString <> '' then begin + sUnInstallString := RemoveQuotes(sUnInstallString); + if Exec(sUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then + Result := 3 + else + Result := 2; + end else + Result := 1; +end; + +///////////////////////////////////////////////////////////////////// +procedure CurStepChanged(CurStep: TSetupStep); +var + ErrCode: integer; +begin + if not (IsTaskSelected('portable')) then + begin + if (CurStep=ssInstall) then + begin + if (IsUpgrade()) then + begin + UnInstallOldVersion(); + end; + end; + if (CurStep=ssDone) then + begin + ShellExec('open', 'http://www.xchat-wdk.org/home/downloads', '', '', SW_SHOW, ewNoWait, ErrCode); + end; + end; +end; |