-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathDelphiPreviewHandler.iss
160 lines (151 loc) · 6.5 KB
/
DelphiPreviewHandler.iss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName 'Delphi Preview Handler'
#define MyAppVersion GetFileVersion('DelphiPreviewHandler.dll')
[Files]
Source: DelphiPreviewHandler.dll; DestDir: {app}; Flags : regserver sharedfile noregerror
;Source: UnRegister.bat; DestDir: {app}
;Source: Register.bat; DestDir: {app}
;Source: Themes\Aqua.theme.xml; DestDir: {app}\Themes\
;Source: Themes\artofnet-darkonblue.theme.xml; DestDir: {app}\Themes\
;Source: Themes\artofnet-lime-chocolate.theme.xml; DestDir: {app}\Themes\
Source: Themes\bespin.theme.xml; DestDir: {app}\Themes\
Source: Themes\Black and White.theme.xml; DestDir: {app}\Themes\
Source: Themes\Blackboard.theme.xml; DestDir: {app}\Themes\
Source: Themes\Brown.theme.xml; DestDir: {app}\Themes\
Source: Themes\ChocoCaramel.theme.xml; DestDir: {app}\Themes\
Source: Themes\cobalt.theme.xml; DestDir: {app}\Themes\
Source: Themes\coda.theme.xml; DestDir: {app}\Themes\
Source: Themes\code-anxiety.theme.xml; DestDir: {app}\Themes\
Source: Themes\coding-horror.theme.xml; DestDir: {app}\Themes\
;Source: Themes\coffee-.theme.xml; DestDir: {app}\Themes\
Source: Themes\dark-code-mute-font-beige.theme.xml; DestDir: {app}\Themes\
Source: Themes\deep-blue.theme.xml; DestDir: {app}\Themes\
Source: Themes\desertex-revised.theme.xml; DestDir: {app}\Themes\
Source: Themes\distant-stormy-shore.theme.xml; DestDir: {app}\Themes\
Source: Themes\enhanced-pascal-classical-.theme.xml; DestDir: {app}\Themes\
Source: Themes\frontenddev.theme.xml; DestDir: {app}\Themes\
Source: Themes\Gedit Original.theme.xml; DestDir: {app}\Themes\
;Source: Themes\Green.theme.xml; DestDir: {app}\Themes\
Source: Themes\greendream.theme.xml; DestDir: {app}\Themes\
Source: Themes\hugoware.theme.xml; DestDir: {app}\Themes\
Source: Themes\humane-studio.theme.xml; DestDir: {app}\Themes\
Source: Themes\Igor.theme.xml; DestDir: {app}\Themes\
;Source: Themes\Inkpot.theme.xml; DestDir: {app}\Themes\
Source: Themes\jon-erickson-s-ragnarok-grey.theme.xml; DestDir: {app}\Themes\
Source: Themes\like.theme.xml; DestDir: {app}\Themes\
Source: Themes\monokai.theme.xml; DestDir: {app}\Themes\
Source: Themes\Mr.theme.xml; DestDir: {app}\Themes\
Source: Themes\mustang.theme.xml; DestDir: {app}\Themes\
Source: Themes\nightfall.theme.xml; DestDir: {app}\Themes\
Source: Themes\NightLion Aptan.theme.xml; DestDir: {app}\Themes\
Source: Themes\Oblivion.theme.xml; DestDir: {app}\Themes\
Source: Themes\Obsidian.theme.xml; DestDir: {app}\Themes\
Source: Themes\ocean.theme.xml; DestDir: {app}\Themes\
Source: Themes\paulstovell-com.theme.xml; DestDir: {app}\Themes\
Source: Themes\pretty.theme.xml; DestDir: {app}\Themes\
Source: Themes\Purple.theme.xml; DestDir: {app}\Themes\
Source: Themes\ragnarok-blue.theme.xml; DestDir: {app}\Themes\
Source: Themes\RecognEyes.theme.xml; DestDir: {app}\Themes\
Source: Themes\Red.theme.xml; DestDir: {app}\Themes\
Source: Themes\russian-noth.theme.xml; DestDir: {app}\Themes\
Source: Themes\selenitic.theme.xml; DestDir: {app}\Themes\
Source: Themes\slimcode.theme.xml; DestDir: {app}\Themes\
Source: Themes\son-of-obsidian.theme.xml; DestDir: {app}\Themes\
;Source: Themes\the-dark-side-of-visual-studio.theme.xml; DestDir: {app}\Themes\
;Source: Themes\the-default-at-boxbinary-ltd.theme.xml; DestDir: {app}\Themes\
;Source: Themes\tial-entry-enhanced.theme.xml; DestDir: {app}\Themes\
Source: Themes\turbo-pascal-revisited.theme.xml; DestDir: {app}\Themes\
Source: Themes\Vibrant Ink.theme.xml; DestDir: {app}\Themes\
Source: Themes\wekeroad-ink.theme.xml; DestDir: {app}\Themes\
Source: Themes\zenburn-2010.theme.xml; DestDir: {app}\Themes\
Source: Themes\Zenburn.theme.xml; DestDir: {app}\Themes\
Source: Updater\DownloadInfo.xml; DestDir: {app}
Source: Updater\libeay32.dll; DestDir: {app}
Source: Updater\ssleay32.dll; DestDir: {app}
Source: Updater\updater.exe; DestDir: {app}
;Source: Settings.ini; DestDir: {app}
[Setup]
UsePreviousLanguage=no
AppName={#MyAppName}
AppPublisher=The Road To Delphi
AppVerName={#MyAppName} {#MyAppVersion}
VersionInfoVersion={#MyAppVersion}
AppPublisherURL=http://theroadtodelphi.wordpress.com/
AppSupportURL=http://theroadtodelphi.wordpress.com/
AppUpdatesURL=http://theroadtodelphi.wordpress.com/
DefaultDirName={pf}\The Road To Delphi\DelphiPreviewHandler
OutputBaseFileName=Setup
DisableDirPage=true
Compression=lzma
SolidCompression=true
UsePreviousAppDir=false
AppendDefaultDirName=true
PrivilegesRequired=admin
WindowVisible=false
WizardSmallImageFile=compiler:WizModernSmallImage-IS.bmp
WizardImageFile=compiler:WizModernImage-IS.bmp
AppContact=theroadtodelphi@gmail.com
SetupIconFile=Images\Icon.ico
;MinVersion=,6.0.6000
DisableProgramGroupPage=true
AppID=DelphiPreviewHandler
[Dirs]
Name: {app}\Themes
[Code]
function InitializeSetup(): Boolean;
begin
Result:=True;
end;
function GetUninstallString(): String;
var
sUnInstPath: String;
sUnInstallString: String;
begin
sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1');
sUnInstallString := '';
if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
Result := sUnInstallString;
end;
function IsUpgrade(): Boolean;
var
s : string;
begin
s := GetUninstallString();
//MsgBox('GetUninstallString '+s, mbInformation, MB_OK);
Result := (s <> '');
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);
begin
if (CurStep=ssInstall) then
begin
if (IsUpgrade()) then
begin
MsgBox(ExpandConstant('An old version of the Preview handler was detected. The uninstaller will be executed'), mbInformation, MB_OK);
UnInstallOldVersion();
end;
end;
end;