-
Notifications
You must be signed in to change notification settings - Fork 163
/
sakura.iss
319 lines (278 loc) · 12.4 KB
/
sakura.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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
[Setup]
AppName=サクラエディタ
AppId=sakura editor
AppVerName=sakura editor(サクラエディタ)
AppMutex=MutexSakuraEditor
AppPublisher=サクラエディタ開発チーム
AppPublisherURL=http://sakura-editor.sourceforge.net
AppSupportURL=http://sakura-editor.sourceforge.net
AppUpdatesURL=http://sourceforge.net/projects/sakura-editor/
DefaultDirName={code:getDefautDirName|sakura}
DefaultGroupName=サクラエディタ
UninstallDisplayIcon={app}\sakura.exe
InfoBeforeFile="instmaterials\info.txt"
WizardImageFile="instmaterials\SetupModern20.bmp"
WizardSmallImageFile="instmaterials\SetupModernSmall20.bmp"
DisableStartupPrompt=no
PrivilegesRequired=None
; エディタのバージョンに応じて書き換える場所
OutputBaseFilename=sakura_install2-1-1-2
VersionInfoVersion=2.1.1.2
; OSバージョン制限
MinVersion=0,5.0
[Languages]
Name: "ja"; MessagesFile: "compiler:Languages\Japanese.isl"
[Types]
Name: all; Description: "All"
Name: editorwithhelp; Description: "Editor with Help"
Name: editoronly; Description: "Editor Only"
Name: custom; Description: "カスタム"; Flags: iscustom
[Components]
Name: main; Description: "サクラエディタ本体"; Types: all editorwithhelp editoronly custom; Flags: fixed
Name: help; Description: "ヘルプファイル"; Types: all editorwithhelp
Name: keyword; Description: "KeyWordファイル"; Types: all
[Tasks]
Name: startmenu; Description: "スタートメニューを作成(&S)"; Components: main;
Name: quicklaunch; Description: "Quick Launchにアイコン作成(&Q)"; Components: main;
Name: proglist; Description: "プログラム一覧に追加(&P)"; Components: main;
Name: desktopicon; Description: "デスクトップにアイコン作成(&D)"; Components: main; Flags: unchecked;
Name: fileassoc; Description: "「SAKURAで開く」メニューの追加(&E)"; Components: main; Flags: unchecked;
Name: startup; Description: "起動時に常駐(&B)"; Components: main; Flags: unchecked;
Name: sendto; Description: "送るに追加(&T)"; Components: main; Flags: unchecked;
[Files]
Source: "sakura\sakura.exe"; DestDir: "{app}"; Components: main; Flags: ignoreversion;
Source: "sakura\bregonig.dll"; DestDir: "{app}"; Components: main
Source: "sakura\bsd_license.txt"; DestDir: "{app}"; Components: main
Source: "sakura\sakura.exe.manifest.x";DestDir: "{app}"; Components: main; DestName: "sakura.exe.manifest"; Check: isMultiUserDisabled; Flags: onlyifdoesntexist;
Source: "sakura\sakura.exe.manifest.v";DestDir: "{app}"; Components: main; DestName: "sakura.exe.manifest"; Check: isMultiUserEnabled; Flags: onlyifdoesntexist;
Source: "sakura\sakura.chm"; DestDir: "{app}"; Components: help
Source: "sakura\macro.chm"; DestDir: "{app}"; Components: help
Source: "sakura\plugin.chm"; DestDir: "{app}"; Components: help
Source: "sakura\sakura.exe.ini"; DestDir: "{app}"; Components: main; Check: isMultiUserEnabled; Flags: onlyifdoesntexist;
Source: "sakura\keyword\*"; DestDir: "{app}\keyword"; Components: keyword; Flags: recursesubdirs
[Registry]
; registry for all user (Admin only)
Root: HKLM; Subkey: "SOFTWARE\Classes\*\shell\sakuraeditor"; ValueType: string; ValueName: ""; ValueData: "SAKURAで開く(&E)"; Tasks: fileassoc; Flags: uninsdeletekey; Check: CheckPrivilege(true)
Root: HKLM; Subkey: "SOFTWARE\Classes\*\shell\sakuraeditor\command"; ValueType: string; ValueName: ""; ValueData: """{app}\sakura.exe"" ""%1"""; Tasks: fileassoc; Flags: uninsdeletekey; Check: CheckPrivilege(true)
Root: HKLM; Subkey: "SOFTWARE\Classes\Applications\sakura.exe\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\sakura.exe"" ""%1"""; Tasks: proglist; Flags: uninsdeletekey; Check: CheckPrivilege(true)
; registry for each user (non-Admin only)
Root: HKCU; Subkey: "SOFTWARE\Classes\*\shell\sakuraeditor"; ValueType: string; ValueName: ""; ValueData: "SAKURAで開く(&E)"; Tasks: fileassoc; Flags: uninsdeletekey; Check: CheckPrivilege(false)
Root: HKCU; Subkey: "SOFTWARE\Classes\*\shell\sakuraeditor\command"; ValueType: string; ValueName: ""; ValueData: """{app}\sakura.exe"" ""%1"""; Tasks: fileassoc; Flags: uninsdeletekey; Check: CheckPrivilege(false)
Root: HKCU; Subkey: "SOFTWARE\Classes\Applications\sakura.exe\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\sakura.exe"" ""%1"""; Tasks: proglist; Flags: uninsdeletekey; Check: CheckPrivilege(false)
[Icons]
Name: "{group}\サクラエディタ"; Filename: "{app}\sakura.exe"; Components: main; Tasks: startmenu;
Name: "{group}\ヘルプファイル"; Filename: "{app}\sakura.chm"; Components: help; Tasks: startmenu;
Name: "{group}\設定フォルダ"; Filename: "%APPDATA%\sakura"; Components: main; Check: isMultiUserEnabled; Tasks: startmenu;
Name: "{userdesktop}\サクラエディタ"; Filename: "{app}\sakura.exe"; Components: main; Tasks: desktopicon;
Name: "{group}\アンインストール"; Filename: "{uninstallexe}"; Tasks: startmenu;
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\サクラエディタ"; Filename: "{app}\sakura.exe"; Components: main; Tasks: quicklaunch;
Name: "{userstartup}\サクラエディタ常駐"; Filename: "{app}\sakura.exe"; Parameters: "-NOWIN"; Components: main; Tasks: startup;
Name: "{sendto}\サクラエディタ"; Filename: "{app}\sakura.exe"; Components: main; Tasks: sendto;
[Run]
FileName: "{app}\sakura.exe"; Description: "今すぐサクラエディタを起動"; WorkingDir: "{app}"; Flags: postinstall nowait skipifsilent; Check: CheckPrivilege(false);
[UninstallDelete]
;Uninstall時に確認無く消されるのでコメントアウト
;Type: files; Name: "{app}\sakura.ini"
[Dirs]
Name: "{userappdata}\sakura"; Components: main; Tasks: startmenu; Check: isMultiUserEnabled
[Code]
var
MultiUserPage: TInputOptionWizardPage;
MultiUserPageEnabled : Boolean;
{ **********************************
Utility Functions
********************************** }
function isMultiUserEnabled : Boolean;
begin
Result := False;
if MultiUserPageEnabled then
Result := MultiUserPage.Values[0];
end;
function isMultiUserDisabled : Boolean;
begin
Result := not isMultiUserEnabled;
end;
function CheckPrivilege( admin: Boolean ) : Boolean;
begin
if admin then
begin
Result := IsAdminLoggedOn;
end
else
begin
Result := not IsAdminLoggedOn;
end;
end;
{
default installation target directory
Admin: Program Files\sakura
User: <AppData>\sakura
}
function getDefautDirName( progdir : String ) : String;
var
basedir : String;
begin
if IsAdminLoggedOn then
begin
basedir := ExpandConstant( '{pf}' );
end
else
begin
basedir := ExpandConstant( '{userappdata}' );
end;
Result := basedir + '\' + progdir;
end;
function IsVistaOrLater : Boolean;
begin
Result := UsingWinNT and (( GetWindowsVersion shr 24) >= 6 );
end;
function IsWin2kOrLater : Boolean;
begin
Result := UsingWinNT and (( GetWindowsVersion shr 24) >= 5 );
end;
{ **********************************
Custom Wizard Page
********************************** }
{ Callback event functions }
function NextButtonClickMultiUser( Sender : TWizardPage): Boolean;
var
selected: Integer;
{ t : String;}
begin
Result := True;
if MultiUserPageEnabled then
begin
{ DEBUG CODE
t := 'MultiUser Setting :';
if IsAdminLoggedOn then
t := t + 'Administrator ';
if ((GetWindowsVersion shr 24) >= 6 ) then
t := t + 'Vista ';
if MultiUserPage.Values[0] = False then
t := t + 'SingleUser ';
t := t + Format( 'WinVer: %.8x', [GetWindowsVersion] );
MsgBox( t, mbConfirmation, MB_OK);
}
{ Alert if admin mode && multi user = False }
if IsAdminLoggedOn and
IsVistaOrLater and
( MultiUserPage.Values[0] = False ) then
begin
selected := MsgBox(
{ 'Program Files等のシステムフォルダへインストールする場合はUACを無効にしないと設定が保存できませんがよろしいですか?',}
'互換モードでインストールします.システムファイルおよびプログラムをユーザ権限で編集すると編集結果が他のアプリケーションから参照できないことがあります.(VirtualStore機能)',
mbConfirmation,
( MB_OKCANCEL ));
if selected = IDCANCEL then
Result := False;
end;
end;
end;
function ShoudSkipMultiUser(Sender : TWizardPage ): Boolean;
var
selectdir : String;
prev_version_h, prev_version_l : Cardinal;
begin
Result := False;
if ( not MultiUserPageEnabled ) then
Result := True
else
begin
selectdir := AddBackslash(ExpandConstant( '{app}' ));
if FileExists( selectdir + 'sakura.exe' ) then
begin
Result := True;
if GetIniInt( 'Settings', 'MultiUser', 0, 0, 1, selectdir + 'sakura.exe.ini' ) = 1 then
MultiUserPage.Values[0] := True
else
MultiUserPage.Values[0] := False;
end;
end;
end;
{ **********************************
System Event Functions
********************************** }
{ Add multi user selection page if supported }
procedure InitializeWizard;
begin
{ Create multi user page }
MultiUserPage := CreateInputOptionPage( wpSelectComponents, '設定保存方法の選択',
'設定をユーザ毎に保存するか実行ファイルの場所へ保存するかを選択してください',
'よくわからない場合は変更しないでください', False, False );
MultiUserPage.Add( '設定をユーザ毎に個別に管理する' );
MultiUserPage.Values[0] := False;
MultiUserPage.OnShouldSkipPage := @ShoudSkipMultiUser;
MultiUserPage.OnNextButtonClick := @NextButtonClickMultiUser;
MultiUserPageEnabled := False;
{Show multiuser mode configuration only in case of Win2K or later }
if IsWin2kOrLater then
begin
{ multi user mode is supported }
MultiUserPageEnabled := True;
{
default multi user mode
User: OFF because installation target is also local
Admin:
Vista or later: ON
Other: OFF
}
if IsVistaOrLater and
IsAdminLoggedOn then
MultiUserPage.Values[0] := True
else
MultiUserPage.Values[0] := False;
end;
end;
{ Build List of installation configuration for ready page }
function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo,
MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
var
MemoMuitiUser, MemoVirtualStore : String;
begin
MemoMuitiUser := '設定ファイル等格納場所' + NewLine + Space;
MemoVirtualStore := 'VirtualStore' + NewLine + Space;
if isMultiUserEnabled then
begin
MemoMuitiUser := MemoMuitiUser + 'ユーザ個別ディレクトリ';
MemoVirtualStore := MemoVirtualStore + '無効';
end
else
begin
MemoMuitiUser := MemoMuitiUser + '実行ファイルと同一ディレクトリ';
MemoVirtualStore := MemoVirtualStore + '有効';
end;
if IsVistaOrLater then
MemoVirtualStore := MemoVirtualStore + NewLine + NewLine
else
MemoVirtualStore := '';
Result := MemoDirInfo + NewLine + NewLine +
MemoMuitiUser + NewLine + NewLine +
MemoVirtualStore +
MemoComponentsInfo + NewLine + NewLine +
MemoGroupInfo + NewLine + NewLine +
MemoTasksInfo;
end;
{ **********************************
Sample codes (not used at this moment
********************************** }
{
Const
UAC_SUPPORT_LOWEST_VERSION_H = $00010005; 1.5.
UAC_SUPPORT_LOWEST_VERSION_L = $000f00c8; .15.200
if GetVersionNumbers( selectdir + 'sakura.exe', prev_version_h, prev_version_l ) then
begin
Result := False;
MsgBox( Format( 'existing version at %s : %d.%d.%d.%d', [
selectdir + 'sakura.exe',
(prev_version_h shr 16 ),
(prev_version_h and $ffff ),
(prev_version_l shr 16 ),
(prev_version_l and $ffff )] ),
mbConfirmation, MB_OK);
if ( prev_version_h < UAC_SUPPORT_LOWEST_VERSION_H ) or
(( prev_version_h = UAC_SUPPORT_LOWEST_VERSION_H )
and ( prev_version_l < UAC_SUPPORT_LOWEST_VERSION_L )) then
begin
end
end
}