-
Notifications
You must be signed in to change notification settings - Fork 613
/
Copy pathinstall.iss
2321 lines (2043 loc) · 96.6 KB
/
install.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
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
; Uncomment the line below to be able to compile the script from within the IDE.
;#define COMPILE_FROM_IDE
#include "config.iss"
#if !defined(APP_VERSION) || !defined(BITNESS)
#error "config.iss should define APP_VERSION and BITNESS"
#endif
#define APP_NAME 'Git'
#ifdef COMPILE_FROM_IDE
#undef APP_VERSION
#define APP_VERSION 'Snapshot'
#endif
#define MINGW_BITNESS 'mingw'+BITNESS
#define APP_CONTACT_URL 'https://github.com/git-for-windows/git/wiki/Contact'
#define APP_URL 'https://git-for-windows.github.io/'
#define APP_BUILTINS 'share\git\builtins.txt'
#define PLINK_PATH_ERROR_MSG 'Please enter a valid path to a Plink executable.'
#define DROP_HANDLER_GUID '{{60254CA5-953B-11CF-8C96-00AA00B8708C}'
[Setup]
; Compiler-related
Compression=lzma2/ultra64
LZMAUseSeparateProcess=yes
#ifdef OUTPUT_TO_TEMP
OutputBaseFilename={#FILENAME_VERSION}
OutputDir={#GetEnv('TEMP')}
#else
OutputBaseFilename={#APP_NAME+'-'+FILENAME_VERSION}-{#BITNESS}-bit
#ifdef OUTPUT_DIRECTORY
OutputDir={#OUTPUT_DIRECTORY}
#else
OutputDir={#GetEnv('USERPROFILE')}
#endif
#endif
SolidCompression=yes
#ifdef SOURCE_DIR
SourceDir={#SOURCE_DIR}
#else
SourceDir={#SourcePath}\..\..\..\..
#endif
#if BITNESS=='64'
ArchitecturesInstallIn64BitMode=x64
#endif
#ifdef SIGNTOOL
SignTool=signtool
#endif
; Installer-related
AllowNoIcons=yes
AppName={#APP_NAME}
AppPublisher=The Git Development Community
AppPublisherURL={#APP_URL}
AppSupportURL={#APP_CONTACT_URL}
AppVersion={#APP_VERSION}
ChangesAssociations=yes
ChangesEnvironment=yes
CloseApplications=no
DefaultDirName={pf}\{#APP_NAME}
DisableDirPage=auto
DefaultGroupName={#APP_NAME}
DisableProgramGroupPage=auto
DisableReadyPage=yes
InfoBeforeFile={#SourcePath}\..\gpl-2.0.rtf
#ifdef OUTPUT_TO_TEMP
PrivilegesRequired=lowest
#else
PrivilegesRequired=none
#endif
UninstallDisplayIcon={app}\{#MINGW_BITNESS}\share\git\git-for-windows.ico
#ifndef COMPILE_FROM_IDE
#if Pos('-',APP_VERSION)>0
VersionInfoVersion={#Copy(APP_VERSION,1,Pos('-',APP_VERSION)-1)}
#else
VersionInfoVersion={#APP_VERSION}
#endif
#endif
; Cosmetic
SetupIconFile={#SourcePath}\..\git.ico
WizardImageBackColor=clWhite
WizardImageStretch=no
WizardImageFile={#SourcePath}\git.bmp
WizardSmallImageFile={#SourcePath}\gitsmall.bmp
MinVersion=0,5.01sp3
[Types]
; Define a custom type to avoid getting the three default types.
Name: default; Description: Default installation; Flags: iscustom
[Components]
Name: icons; Description: Additional icons
Name: icons\quicklaunch; Description: In the Quick Launch; Check: not IsAdminLoggedOn
Name: icons\desktop; Description: On the Desktop
Name: ext; Description: Windows Explorer integration; Types: default
Name: ext\shellhere; Description: Git Bash Here; Types: default
Name: ext\guihere; Description: Git GUI Here; Types: default
Name: gitlfs; Description: Git LFS (Large File Support); Types: default; Flags: disablenouninstallwarning
Name: assoc; Description: Associate .git* configuration files with the default text editor; Types: default
Name: assoc_sh; Description: Associate .sh files to be run with Bash; Types: default
Name: consolefont; Description: Use a TrueType font in all console windows
Name: autoupdate; Description: Check daily for Git for Windows updates
[Run]
Filename: {app}\git-bash.exe; Parameters: --cd-to-home; Description: Launch Git Bash; Flags: nowait postinstall skipifsilent runasoriginaluser unchecked
Filename: {app}\ReleaseNotes.html; Description: View Release Notes; Flags: shellexec skipifdoesntexist postinstall skipifsilent
[Files]
; Install files that might be in use during setup under a different name.
#include "file-list.iss"
Source: {#SourcePath}\ReleaseNotes.html; DestDir: {app}; Flags: replacesameversion; AfterInstall: DeleteFromVirtualStore
Source: {#SourcePath}\..\LICENSE.txt; DestDir: {app}; Flags: replacesameversion; AfterInstall: DeleteFromVirtualStore
Source: {#SourcePath}\NOTICE.txt; DestDir: {app}; Flags: replacesameversion; AfterInstall: DeleteFromVirtualStore; Check: ParamIsSet('VSNOTICE')
Source: {#SourcePath}\..\edit-git-bash.exe; Flags: dontcopy
[Dirs]
Name: "{app}\tmp"
[Icons]
Name: {group}\Git GUI; Filename: {app}\cmd\git-gui.exe; Parameters: ""; WorkingDir: %HOMEDRIVE%%HOMEPATH%; IconFilename: {app}\{#MINGW_BITNESS}\share\git\git-for-windows.ico
Name: {group}\Git Bash; Filename: {app}\git-bash.exe; Parameters: "--cd-to-home"; WorkingDir: %HOMEDRIVE%%HOMEPATH%; IconFilename: {app}\{#MINGW_BITNESS}\share\git\git-for-windows.ico
Name: {group}\Git CMD; Filename: {app}\git-cmd.exe; Parameters: "--cd-to-home"; WorkingDir: %HOMEDRIVE%%HOMEPATH%; IconFilename: {app}\{#MINGW_BITNESS}\share\git\git-for-windows.ico
[Messages]
BeveledLabel={#APP_URL}
#ifdef WINDOW_TITLE_VERSION
SetupAppTitle={#APP_NAME} {#WINDOW_TITLE_VERSION} Setup
SetupWindowTitle={#APP_NAME} {#WINDOW_TITLE_VERSION} Setup
#else
SetupAppTitle={#APP_NAME} {#APP_VERSION} Setup
SetupWindowTitle={#APP_NAME} {#APP_VERSION} Setup
#endif
[Registry]
; Aides installing third-party (credential, remote, etc) helpers
Root: HKLM; Subkey: Software\GitForWindows; ValueType: string; ValueName: CurrentVersion; ValueData: {#APP_VERSION}; Flags: uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn
Root: HKLM; Subkey: Software\GitForWindows; ValueType: string; ValueName: InstallPath; ValueData: {app}; Flags: uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn
Root: HKLM; Subkey: Software\GitForWindows; ValueType: string; ValueName: LibexecPath; ValueData: {app}\{#MINGW_BITNESS}\libexec\git-core; Flags: uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn
Root: HKCU; Subkey: Software\GitForWindows; ValueType: string; ValueName: CurrentVersion; ValueData: {#APP_VERSION}; Flags: uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn
Root: HKCU; Subkey: Software\GitForWindows; ValueType: string; ValueName: InstallPath; ValueData: {app}; Flags: uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn
Root: HKCU; Subkey: Software\GitForWindows; ValueType: string; ValueName: LibexecPath; ValueData: {app}\{#MINGW_BITNESS}\libexec\git-core; Flags: uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn
; There is no "Console" key in HKLM.
Root: HKCU; Subkey: Console; ValueType: string; ValueName: FaceName; ValueData: Lucida Console; Flags: uninsclearvalue; Components: consolefont
Root: HKCU; Subkey: Console; ValueType: dword; ValueName: FontFamily; ValueData: $00000036; Components: consolefont
Root: HKCU; Subkey: Console; ValueType: dword; ValueName: FontSize; ValueData: $000e0000; Components: consolefont
Root: HKCU; Subkey: Console; ValueType: dword; ValueName: FontWeight; ValueData: $00000190; Components: consolefont
Root: HKCU; Subkey: Console\Git Bash; ValueType: string; ValueName: FaceName; ValueData: Lucida Console; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty
Root: HKCU; Subkey: Console\Git Bash; ValueType: dword; ValueName: FontFamily; ValueData: $00000036; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty
Root: HKCU; Subkey: Console\Git Bash; ValueType: dword; ValueName: FontSize; ValueData: $000e0000; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty
Root: HKCU; Subkey: Console\Git Bash; ValueType: dword; ValueName: FontWeight; ValueData: $00000190; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty
Root: HKCU; Subkey: Console\Git CMD; ValueType: string; ValueName: FaceName; ValueData: Lucida Console; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty
Root: HKCU; Subkey: Console\Git CMD; ValueType: dword; ValueName: FontFamily; ValueData: $00000036; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty
Root: HKCU; Subkey: Console\Git CMD; ValueType: dword; ValueName: FontSize; ValueData: $000e0000; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty
Root: HKCU; Subkey: Console\Git CMD; ValueType: dword; ValueName: FontWeight; ValueData: $00000190; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty
; Note that we write the Registry values below either to HKLM or to HKCU depending on whether the user running the installer
; is a member of the local Administrators group or not (see the "Check" argument).
; File associations for configuration files that may be contained in a repository (so this does not include ".gitconfig").
Root: HKLM; Subkey: Software\Classes\.gitattributes; ValueType: string; ValueData: txtfile; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn; Components: assoc
Root: HKLM; Subkey: Software\Classes\.gitattributes; ValueType: string; ValueName: Content Type; ValueData: text/plain; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn; Components: assoc
Root: HKLM; Subkey: Software\Classes\.gitattributes; ValueType: string; ValueName: PerceivedType; ValueData: text; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn; Components: assoc
Root: HKCU; Subkey: Software\Classes\.gitattributes; ValueType: string; ValueData: txtfile; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn; Components: assoc
Root: HKCU; Subkey: Software\Classes\.gitattributes; ValueType: string; ValueName: Content Type; ValueData: text/plain; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn; Components: assoc
Root: HKCU; Subkey: Software\Classes\.gitattributes; ValueType: string; ValueName: PerceivedType; ValueData: text; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn; Components: assoc
Root: HKLM; Subkey: Software\Classes\.gitignore; ValueType: string; ValueData: txtfile; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn; Components: assoc
Root: HKLM; Subkey: Software\Classes\.gitignore; ValueType: string; ValueName: Content Type; ValueData: text/plain; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn; Components: assoc
Root: HKLM; Subkey: Software\Classes\.gitignore; ValueType: string; ValueName: PerceivedType; ValueData: text; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn; Components: assoc
Root: HKCU; Subkey: Software\Classes\.gitignore; ValueType: string; ValueData: txtfile; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn; Components: assoc
Root: HKCU; Subkey: Software\Classes\.gitignore; ValueType: string; ValueName: Content Type; ValueData: text/plain; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn; Components: assoc
Root: HKCU; Subkey: Software\Classes\.gitignore; ValueType: string; ValueName: PerceivedType; ValueData: text; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn; Components: assoc
Root: HKLM; Subkey: Software\Classes\.gitmodules; ValueType: string; ValueData: txtfile; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn; Components: assoc
Root: HKLM; Subkey: Software\Classes\.gitmodules; ValueType: string; ValueName: Content Type; ValueData: text/plain; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn; Components: assoc
Root: HKLM; Subkey: Software\Classes\.gitmodules; ValueType: string; ValueName: PerceivedType; ValueData: text; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn; Components: assoc
Root: HKCU; Subkey: Software\Classes\.gitmodules; ValueType: string; ValueData: txtfile; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn; Components: assoc
Root: HKCU; Subkey: Software\Classes\.gitmodules; ValueType: string; ValueName: Content Type; ValueData: text/plain; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn; Components: assoc
Root: HKCU; Subkey: Software\Classes\.gitmodules; ValueType: string; ValueName: PerceivedType; ValueData: text; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn; Components: assoc
; Associate .sh extension with sh.exe so those files are double-clickable,
; startable from cmd.exe, and when files are dropped on them they are passed
; as arguments to the script.
; Install under HKEY_LOCAL_MACHINE if an administrator is installing.
Root: HKLM; Subkey: Software\Classes\.sh; ValueType: string; ValueData: sh_auto_file; Flags: createvalueifdoesntexist uninsdeletekeyifempty uninsdeletevalue; Check: IsAdminLoggedOn; Components: assoc_sh
Root: HKLM; Subkey: Software\Classes\sh_auto_file; ValueType: string; ValueData: "Shell Script"; Flags: createvalueifdoesntexist uninsdeletekeyifempty uninsdeletevalue; Check: IsAdminLoggedOn; Components: assoc_sh
Root: HKLM; Subkey: Software\Classes\sh_auto_file\shell\open\command; ValueType: string; ValueData: """{app}\git-bash.exe"" --no-cd ""%L"" %*"; Flags: uninsdeletekeyifempty uninsdeletevalue; Check: IsAdminLoggedOn; Components: assoc_sh
Root: HKLM; Subkey: Software\Classes\sh_auto_file\DefaultIcon; ValueType: string; ValueData: "%SystemRoot%\System32\shell32.dll,-153"; Flags: createvalueifdoesntexist uninsdeletekeyifempty uninsdeletevalue; Check: IsAdminLoggedOn; Components: assoc_sh
Root: HKLM; Subkey: Software\Classes\sh_auto_file\ShellEx\DropHandler; ValueType: string; ValueData: {#DROP_HANDLER_GUID}; Flags: uninsdeletekeyifempty uninsdeletevalue; Check: IsAdminLoggedOn; Components: assoc_sh
; Install under HKEY_CURRENT_USER if a non-administrator is installing.
Root: HKCU; Subkey: Software\Classes\.sh; ValueType: string; ValueData: sh_auto_file; Flags: createvalueifdoesntexist uninsdeletekeyifempty uninsdeletevalue; Check: not IsAdminLoggedOn; Components: assoc_sh
Root: HKCU; Subkey: Software\Classes\sh_auto_file; ValueType: string; ValueData: "Shell Script"; Flags: createvalueifdoesntexist uninsdeletekeyifempty uninsdeletevalue; Check: not IsAdminLoggedOn; Components: assoc_sh
Root: HKCU; Subkey: Software\Classes\sh_auto_file\shell\open\command; ValueType: string; ValueData: """{app}\git-bash.exe"" --no-cd ""%L"" %*"; Flags: uninsdeletekeyifempty uninsdeletevalue; Check: not IsAdminLoggedOn; Components: assoc_sh
Root: HKCU; Subkey: Software\Classes\sh_auto_file\DefaultIcon; ValueType: string; ValueData: "%SystemRoot%\System32\shell32.dll,-153"; Flags: createvalueifdoesntexist uninsdeletekeyifempty uninsdeletevalue; Check: not IsAdminLoggedOn; Components: assoc_sh
Root: HKCU; Subkey: Software\Classes\sh_auto_file\ShellEx\DropHandler; ValueType: string; ValueData: {#DROP_HANDLER_GUID}; Flags: uninsdeletekeyifempty uninsdeletevalue; Check: not IsAdminLoggedOn; Components: assoc_sh
[UninstallDelete]
; Delete the built-ins.
Type: files; Name: {app}\{#MINGW_BITNESS}\bin\git-*.exe
Type: files; Name: {app}\{#MINGW_BITNESS}\libexec\git-core\git-*.exe
Type: files; Name: {app}\{#MINGW_BITNESS}\libexec\git-core\git.exe
; Delete copied *.dll files
Type: files; Name: {app}\{#MINGW_BITNESS}\libexec\git-core\*.dll
; Delete the dynamical generated MSYS2 files
Type: files; Name: {app}\etc\hosts
Type: files; Name: {app}\etc\mtab
Type: files; Name: {app}\etc\networks
Type: files; Name: {app}\etc\protocols
Type: files; Name: {app}\etc\services
Type: files; Name: {app}\dev\fd
Type: files; Name: {app}\dev\stderr
Type: files; Name: {app}\dev\stdin
Type: files; Name: {app}\dev\stdout
Type: dirifempty; Name: {app}\dev\mqueue
Type: dirifempty; Name: {app}\dev\shm
Type: dirifempty; Name: {app}\dev
; Delete any manually created shortcuts.
Type: files; Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\Git Bash.lnk
Type: files; Name: {code:GetShellFolder|desktop}\Git Bash.lnk
Type: files; Name: {app}\Git Bash.lnk
; Delete a home directory inside the Git for Windows directory.
Type: dirifempty; Name: {app}\home\{username}
Type: dirifempty; Name: {app}\home
#if BITNESS=='32'
; Delete the files required for rebaseall
Type: files; Name: {app}\bin\msys-2.0.dll
Type: files; Name: {app}\bin\rebase.exe
Type: dirifempty; Name: {app}\bin
Type: files; Name: {app}\etc\rebase.db.i386
Type: dirifempty; Name: {app}\etc
#endif
; Delete recorded install options
Type: files; Name: {app}\etc\install-options.txt
Type: dirifempty; Name: {app}\etc
Type: dirifempty; Name: {app}\{#MINGW_BITNESS}\libexec\git-core
Type: dirifempty; Name: {app}\{#MINGW_BITNESS}\libexec
Type: dirifempty; Name: {app}\{#MINGW_BITNESS}
Type: dirifempty; Name: {app}
[Code]
#include "helpers.inc.iss"
#include "environment.inc.iss"
#include "putty.inc.iss"
#include "modules.inc.iss"
procedure LogError(Msg:String);
begin
SuppressibleMsgBox(Msg,mbError,MB_OK,IDOK);
Log(Msg);
end;
function ParamIsSet(Key:String):Boolean;
begin
Result:=CompareStr('0',ExpandConstant('{param:'+Key+'|0}'))<>0;
end;
function CreateHardLink(lpFileName,lpExistingFileName:String;lpSecurityAttributes:Integer):Boolean;
#ifdef UNICODE
external '[email protected] stdcall delayload setuponly';
#else
external '[email protected] stdcall delayload setuponly';
#endif
function OverrideGitBashCommandLine(GitBashPath:String;CommandLine:String):Integer;
var
Msg:String;
begin
if not FileExists(ExpandConstant('{tmp}\edit-git-bash.exe')) then
ExtractTemporaryFile('edit-git-bash.exe');
StringChangeEx(GitBashPath,'"','\"',True);
StringChangeEx(CommandLine,'"','\"',True);
CommandLine:='"'+GitBashPath+'" "'+CommandLine+'"';
Exec(ExpandConstant('{tmp}\edit-git-bash.exe'),CommandLine,'',SW_HIDE,ewWaitUntilTerminated,Result);
if Result<>0 then begin
if Result=1 then begin
Msg:='Unable to edit '+GitBashPath+' (out of memory).';
end else if Result=2 then begin
Msg:='Unable to open '+GitBashPath+' for editing.';
end else if Result=3 then begin
Msg:='Unable to edit the command-line of '+GitBashPath+'.';
end else if Result=4 then begin
Msg:='Unable to close '+GitBashPath+' after editing.';
end;
LogError(Msg);
end;
end;
const
// Git Editor options.
GE_VIM = 1;
GE_Nano = 2;
GE_NotepadPlusPlus = 3;
// Git Path options.
GP_BashOnly = 1;
GP_Cmd = 2;
GP_CmdTools = 3;
// Git SSH options.
GS_OpenSSH = 1;
GS_Plink = 2;
// Git HTTPS (cURL) options.
GC_OpenSSL = 1;
GC_WinSSL = 2;
// Git line ending conversion options.
GC_LFOnly = 1;
GC_CRLFAlways = 2;
GC_CRLFCommitAsIs = 3;
// Git Bash terminal settings.
GB_MinTTY = 1;
GB_ConHost = 2;
// Extra options
GP_FSCache = 1;
GP_GCM = 2;
GP_Symlinks = 3;
#ifdef WITH_EXPERIMENTAL_BUILTIN_DIFFTOOL
// Experimental options
GP_BuiltinDifftool = 1;
#endif
var
// The options chosen at install time, to be written to /etc/install-options.txt
ChosenOptions:String;
// Previous Git for Windows version (if upgrading)
PreviousGitForWindowsVersion:String;
// Wizard page and variables for the Editor options.
EditorPage:TWizardPage;
RdbEditor:array[GE_VIM..GE_NotepadPlusPlus] of TRadioButton;
NotepadPlusPlusPath:String;
// Wizard page and variables for the Path options.
PathPage:TWizardPage;
RdbPath:array[GP_BashOnly..GP_CmdTools] of TRadioButton;
// Wizard page and variables for the SSH options.
PuTTYPage:TWizardPage;
RdbSSH:array[GS_OpenSSH..GS_Plink] of TRadioButton;
EdtPlink:TEdit;
// Wizard page and variables for the HTTPS implementation (cURL) settings.
CurlVariantPage:TWizardPage;
RdbCurlVariant:array[GC_OpenSSL..GC_WinSSL] of TRadioButton;
// Wizard page and variables for the line ending conversion options.
CRLFPage:TWizardPage;
RdbCRLF:array[GC_LFOnly..GC_CRLFCommitAsIs] of TRadioButton;
// Wizard page and variables for the terminal emulator settings.
BashTerminalPage:TWizardPage;
RdbBashTerminal:array[GB_MinTTY..GB_ConHost] of TRadioButton;
// Wizard page and variables for the extra options.
ExtraOptionsPage:TWizardPage;
RdbExtraOptions:array[GP_FSCache..GP_Symlinks] of TCheckBox;
#ifdef WITH_EXPERIMENTAL_BUILTIN_DIFFTOOL
// Wizard page and variables for the experimental options.
ExperimentalOptionsPage:TWizardPage;
RdbExperimentalOptions:array[GP_BuiltinDifftool..GP_BuiltinDifftool] of TCheckBox;
#endif
// Mapping controls to hyperlinks
HyperlinkSource:array of TObject;
HyperlinkTarget:array of String;
HyperlinkCount:Integer;
// Wizard page and variables for the processes page.
SessionHandle:DWORD;
Processes:ProcessList;
ProcessesPage:TWizardPage;
ProcessesListBox:TListBox;
ProcessesRefresh,ContinueButton:TButton;
PageIDBeforeInstall:Integer;
#ifdef DEBUG_WIZARD_PAGE
DebugWizardPage:Integer;
#endif
{
Specific helper functions
}
procedure BrowseForPuTTYFolder(Sender:TObject);
var
Name:String;
begin
if GetOpenFileName(
'Please select a Plink executable'
, Name
, ExtractFilePath(EdtPlink.Text)
, 'Executable Files|*.exe'
, 'exe'
)
then begin
if IsPlinkExecutable(Name) then begin
EdtPlink.Text:=Name;
RdbSSH[GS_Plink].Checked:=True;
end else begin
// This message box only gets triggered on interactive use, so it
// does not need to be suppressible for silent installations.
MsgBox('{#PLINK_PATH_ERROR_MSG}',mbError,MB_OK);
end;
end;
end;
procedure DeleteContextMenuEntries;
var
AppDir,Command:String;
RootKey,i:Integer;
Keys:TArrayOfString;
begin
AppDir:=ExpandConstant('{app}');
if IsAdminLoggedOn then begin
RootKey:=HKEY_LOCAL_MACHINE;
end else begin
RootKey:=HKEY_CURRENT_USER;
end;
SetArrayLength(Keys,4);
Keys[0]:='SOFTWARE\Classes\Directory\shell\git_shell';
Keys[1]:='SOFTWARE\Classes\Directory\Background\shell\git_shell';
Keys[2]:='SOFTWARE\Classes\Directory\shell\git_gui';
Keys[3]:='SOFTWARE\Classes\Directory\Background\shell\git_gui';
for i:=0 to Length(Keys)-1 do begin
Command:='';
RegQueryStringValue(RootKey,Keys[i]+'\command','',Command);
if Pos(AppDir,Command)>0 then begin
if not RegDeleteKeyIncludingSubkeys(RootKey,Keys[i]) then begin
LogError('Line {#__LINE__}: Unable to remove "Git Bash / GUI Here" shell extension.');
end;
end;
end;
end;
procedure RefreshProcessList(Sender:TObject);
var
Version:TWindowsVersion;
Modules:TArrayOfString;
ProcsCloseRequired,ProcsCloseOptional:ProcessList;
i:Longint;
Caption:String;
ManualClosingRequired:Boolean;
begin
GetWindowsVersionEx(Version);
// Use the Restart Manager API when installing the shell extension on Windows Vista and above.
if Version.Major>=6 then begin
SetArrayLength(Modules,17);
Modules[0]:=ExpandConstant('{app}\usr\bin\msys-2.0.dll');
Modules[1]:=ExpandConstant('{app}\{#MINGW_BITNESS}\bin\tcl85.dll');
Modules[2]:=ExpandConstant('{app}\{#MINGW_BITNESS}\bin\tk85.dll');
Modules[3]:=ExpandConstant('{app}\{#MINGW_BITNESS}\bin\tcl86.dll');
Modules[4]:=ExpandConstant('{app}\{#MINGW_BITNESS}\bin\tk86.dll');
Modules[5]:=ExpandConstant('{app}\git-cheetah\git_shell_ext.dll');
Modules[6]:=ExpandConstant('{app}\git-cheetah\git_shell_ext64.dll');
Modules[7]:=ExpandConstant('{app}\git-cmd.exe');
Modules[8]:=ExpandConstant('{app}\git-bash.exe');
Modules[9]:=ExpandConstant('{app}\bin\bash.exe');
Modules[10]:=ExpandConstant('{app}\bin\git.exe');
Modules[11]:=ExpandConstant('{app}\bin\sh.exe');
Modules[12]:=ExpandConstant('{app}\cmd\git.exe');
Modules[13]:=ExpandConstant('{app}\cmd\gitk.exe');
Modules[14]:=ExpandConstant('{app}\cmd\git-gui.exe');
Modules[15]:=ExpandConstant('{app}\{#MINGW_BITNESS}\bin\git.exe');
Modules[16]:=ExpandConstant('{app}\usr\bin\bash.exe');
SessionHandle:=FindProcessesUsingModules(Modules,Processes);
end else begin
SetArrayLength(Modules,15);
Modules[0]:=ExpandConstant('{app}\usr\bin\msys-2.0.dll');
Modules[1]:=ExpandConstant('{app}\{#MINGW_BITNESS}\bin\tcl85.dll');
Modules[2]:=ExpandConstant('{app}\{#MINGW_BITNESS}\bin\tk85.dll');
Modules[3]:=ExpandConstant('{app}\{#MINGW_BITNESS}\bin\tcl86.dll');
Modules[4]:=ExpandConstant('{app}\{#MINGW_BITNESS}\bin\tk86.dll');
Modules[5]:=ExpandConstant('{app}\git-cmd.exe');
Modules[6]:=ExpandConstant('{app}\git-bash.exe');
Modules[7]:=ExpandConstant('{app}\bin\bash.exe');
Modules[8]:=ExpandConstant('{app}\bin\git.exe');
Modules[9]:=ExpandConstant('{app}\bin\sh.exe');
Modules[10]:=ExpandConstant('{app}\cmd\git.exe');
Modules[11]:=ExpandConstant('{app}\cmd\gitk.exe');
Modules[12]:=ExpandConstant('{app}\cmd\git-gui.exe');
Modules[13]:=ExpandConstant('{app}\{#MINGW_BITNESS}\bin\git.exe');
Modules[14]:=ExpandConstant('{app}\usr\bin\bash.exe');
SessionHandle:=FindProcessesUsingModules(Modules,ProcsCloseRequired);
SetArrayLength(Modules,2);
Modules[0]:=ExpandConstant('{app}\git-cheetah\git_shell_ext.dll');
Modules[1]:=ExpandConstant('{app}\git-cheetah\git_shell_ext64.dll');
SessionHandle:=FindProcessesUsingModules(Modules,ProcsCloseOptional) or SessionHandle;
// Misuse the "Restartable" flag to indicate which processes are required
// to be closed before setup can continue, and which just should be closed
// in order to make changes take effect immediately.
SetArrayLength(Processes,GetArrayLength(ProcsCloseRequired)+GetArrayLength(ProcsCloseOptional));
for i:=0 to GetArrayLength(ProcsCloseRequired)-1 do begin
Processes[i]:=ProcsCloseRequired[i];
Processes[i].Restartable:=False;
end;
for i:=0 to GetArrayLength(ProcsCloseOptional)-1 do begin
Processes[GetArrayLength(ProcsCloseRequired)+i]:=ProcsCloseOptional[i];
Processes[GetArrayLength(ProcsCloseRequired)+i].Restartable:=True;
end;
end;
ManualClosingRequired:=False;
ProcessesListBox.Items.Clear;
if (Sender=NIL) or (SessionHandle>0) then begin
for i:=0 to GetArrayLength(Processes)-1 do begin
Caption:=Processes[i].Name+' (PID '+IntToStr(Processes[i].ID);
if Processes[i].Restartable then begin
Caption:=Caption+', closing is optional';
end else if Processes[i].ToTerminate then begin
Caption:=Caption+', will be terminated';
end else begin
Caption:=Caption+', closing is required';
ManualClosingRequired:=True;
end;
Caption:=Caption+')';
ProcessesListBox.Items.Append(Caption);
end;
end;
if ContinueButton<>NIL then begin
ContinueButton.Enabled:=not ManualClosingRequired;
end;
end;
procedure SetAndMarkEnvString(Name,Value:String;Expandable:Boolean);
var
Env:TArrayOfString;
FileName:String;
begin
SetArrayLength(Env,1);
Env[0]:=Value;
// Try to set the variable as specified by the user.
if not SetEnvStrings(Name,Env,Expandable,IsAdminLoggedOn,True) then
LogError('Line {#__LINE__}: Unable to set the '+Name+' environment variable.')
else begin
// Mark that we have changed the variable by writing its value to a file.
FileName:=ExpandConstant('{app}')+'\setup.ini';
if not SetIniString('Environment',Name,Value,FileName) then
LogError('Line {#__LINE__}: Unable to write to file "'+FileName+'".');
end;
end;
procedure DeleteMarkedEnvString(Name:String);
var
Env:TArrayOfString;
FileName:String;
begin
Env:=GetEnvStrings(Name,IsAdminLoggedOn);
FileName:=ExpandConstant('{app}')+'\setup.ini';
if (GetArrayLength(Env)=1) and
(CompareStr(RemoveQuotes(Env[0]),GetIniString('Environment',Name,'',FileName))=0) then begin
if not SetEnvStrings(Name,[],False,IsAdminLoggedOn,True) then
LogError('Line {#__LINE__}: Unable to delete the '+Name+' environment variable.');
end;
end;
{
Setup event functions
}
function NextNumber(Str:String;var Pos:Integer):Integer;
var
From:Integer;
begin
From:=Pos;
while (Pos<=Length(Str)) and (Str[Pos]>=#48) and (Str[Pos]<=#57) do
Pos:=Pos+1;
if Pos>From then
Result:=StrToInt(Copy(Str,From,Pos-From))
else
Result:=-1;
end;
function VersionCompare(CurrentVersion,PreviousVersion:String):Integer;
var
i,j,Current,Previous:Integer;
begin
Result:=0;
i:=1;
j:=1;
while True do begin
if j>Length(PreviousVersion) then begin
Result:=+1;
Exit;
end;
if i>Length(CurrentVersion) then begin
Result:=-1;
Exit;
end;
Previous:=NextNumber(PreviousVersion,j);
Current:=NextNumber(CurrentVersion,i);
if Previous<0 then begin
if Current>=0 then
Result:=+1;
Exit;
end;
if Current<0 then begin
Result:=-1;
Exit;
end;
if Current>Previous then begin
Result:=+1;
Exit;
end;
if Current<Previous then begin
Result:=-1;
Exit;
end;
if j>Length(PreviousVersion) then begin
if i<=Length(CurrentVersion) then
Result:=+1;
Exit;
end;
if i>Length(CurrentVersion) then begin
Result:=-1;
Exit;
end;
if CurrentVersion[i]<>PreviousVersion[j] then begin
if PreviousVersion[j]='.' then
Result:=-1
else
Result:=+1;
Exit;
end;
if CurrentVersion[i]<>'.' then
Exit;
i:=i+1;
j:=j+1;
end;
end;
procedure ExitProcess(uExitCode:Integer);
external '[email protected] stdcall';
procedure ExitEarlyWithSuccess();
begin
DelTree(ExpandConstant('{tmp}'),True,True,True);
ExitProcess(0);
end;
function InitializeSetup:Boolean;
var
CurrentVersion,Msg:String;
Version:TWindowsVersion;
ErrorCode:Integer;
begin
GetWindowsVersionEx(Version);
if (Version.Major<6) then begin
if SuppressibleMsgBox('Git for Windows requires Windows Vista or later.'+#13+'Click "Yes" for more details.',mbError,MB_YESNO,IDNO)=IDYES then
ShellExec('open','https://git-for-windows.github.io/requirements.html','','',SW_SHOW,ewNoWait,ErrorCode);
Result:=False;
Exit;
end;
UpdateInfFilenames;
#if BITNESS=='32'
Result:=True;
#else
if not IsWin64 then begin
LogError('The 64-bit version of Git requires a 64-bit Windows. Aborting.');
Result:=False;
end else begin
Result:=True;
end;
#endif
RegQueryStringValue(HKEY_LOCAL_MACHINE,'Software\GitForWindows','CurrentVersion',PreviousGitForWindowsVersion);
#if APP_VERSION!='0-test'
if Result and not ParamIsSet('ALLOWDOWNGRADE') then begin
CurrentVersion:=ExpandConstant('{#APP_VERSION}');
if (VersionCompare(CurrentVersion,PreviousGitForWindowsVersion)<0) then begin
if WizardSilent() and (ParamIsSet('SKIPDOWNGRADE') or ParamIsSet('VSNOTICE')) then begin
Msg:='Skipping downgrade from '+PreviousGitForWindowsVersion+' to '+CurrentVersion;
if ParamIsSet('SKIPDOWNGRADE') or (ExpandConstant('{log}')='') then
LogError(Msg)
else
Log(Msg);
ExitEarlyWithSuccess();
end;
if SuppressibleMsgBox('Git for Windows '+PreviousGitForWindowsVersion+' is currently installed.'+#13+'Do you really want to downgrade to Git for Windows '+CurrentVersion+'?',mbConfirmation,MB_YESNO or MB_DEFBUTTON2,IDNO)=IDNO then
Result:=False;
end;
end;
#endif
end;
procedure RecordChoice(PreviousDataKey:Integer;Key,Data:String);
begin
ChosenOptions:=ChosenOptions+Key+': '+Data+#13#10;
SetPreviousData(PreviousDataKey,Key,Data);
if ShouldSaveInf then begin
// .inf files do not like keys with spaces.
StringChangeEx(Key,' ','',True);
SaveInfString('Setup',Key,Data);
end;
end;
function ReplayChoice(Key,Default:String):String;
var
NoSpaces:String;
begin
NoSpaces:=Key;
StringChangeEx(NoSpaces,' ','',True);
// Interpret /o:PathOption=Cmd and friends
Result:=ExpandConstant('{param:o:'+NoSpaces+'| }');
if Result<>' ' then
Log('Parameter '+Key+'='+Result+' set via command-line')
else if ShouldLoadInf then
// Use settings from the user provided INF.
// .inf files do not like keys with spaces.
Result:=LoadInfString('Setup',NoSpaces,Default)
else
// Restore the settings chosen during a previous install.
Result:=GetPreviousData(Key,Default);
end;
function ReadFileAsString(Path:String):String;
var
Contents:AnsiString;
begin
if not LoadStringFromFile(Path,Contents) then
Result:='(no output)'
else
Result:=Contents;
end;
function DetectNetFxVersion:Cardinal;
begin
// We are only interested in version v4.5.1 or later, therefore it
// is enough to only use the 4.5 method described in
// https://msdn.microsoft.com/en-us/library/hh925568
if not RegQueryDWordValue(HKEY_LOCAL_MACHINE,'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full','Release',Result) then
Result:=0;
end;
procedure OpenHyperlink(Sender:TObject);
var
i,ExitStatus:Integer;
begin
for i:=0 to (HyperlinkCount-1) do begin
if (HyperlinkSource[i]=Sender) then begin
ShellExec('',HyperlinkTarget[i],'','',SW_SHOW,ewNoWait,ExitStatus);
exit;
end;
end;
LogError('Missing hyperlink!');
end;
procedure OpenNanoHomepage(Sender:TObject);
var
ExitStatus:Integer;
begin
ShellExec('','https://www.nano-editor.org/dist/v2.8/nano.html','','',SW_SHOW,ewNoWait,ExitStatus);
end;
procedure OpenVIMHomepage(Sender:TObject);
var
ExitStatus:Integer;
begin
ShellExec('','http://www.vim.org/','','',SW_SHOW,ewNoWait,ExitStatus);
end;
procedure OpenExitVIMPost(Sender:TObject);
var
ExitStatus:Integer;
begin
ShellExec('','https://stackoverflow.blog/2017/05/23/stack-overflow-helping-one-million-developers-exit-vim/','','',SW_SHOW,ewNoWait,ExitStatus);
end;
procedure OpenGCMHomepage(Sender:TObject);
var
ExitStatus:Integer;
begin
ShellExec('','https://github.com/Microsoft/Git-Credential-Manager-for-Windows','','',SW_SHOW,ewNoWait,ExitStatus);
end;
procedure OpenSymlinksWikiPage(Sender:TObject);
var
ExitStatus:Integer;
begin
ShellExec('','https://github.com/git-for-windows/git/wiki/Symbolic-Links','','',SW_SHOW,ewNoWait,ExitStatus);
end;
function IsOriginalUserAdmin():Boolean;
var
ResultCode:Integer;
begin
if not ExecAsOriginalUser(ExpandConstant('{cmd}'),ExpandConstant('/c net session >"{tmp}\net-session.txt"'),'',SW_HIDE,ewWaitUntilTerminated,ResultCode) then
ResultCode:=-1;
Result:=(ResultCode=0);
end;
function EnableSymlinksByDefault():Boolean;
var
ResultCode:Integer;
begin
if IsOriginalUserAdmin then begin
Log('Symbolic link permission detection failed: running as admin');
Result:=False;
end else begin
ExecAsOriginalUser(ExpandConstant('{cmd}'),ExpandConstant('/c mklink /d "{tmp}\symbolic link" "{tmp}" >"{tmp}\symlink test.txt"'),'',SW_HIDE,ewWaitUntilTerminated,ResultCode);
Result:=DirExists(ExpandConstant('{tmp}\symbolic link'));
end;
end;
function GetTextWidth(Text:String;Font:TFont):Integer;
var
DummyBitmap:TBitmap;
begin
DummyBitmap:=TBitmap.Create();
DummyBitmap.Canvas.Font.Assign(Font);
Result:=DummyBitmap.Canvas.TextWidth(Text);
DummyBitmap.Free();
end;
function CreatePage(var PrevPageID:Integer;const Caption,Description:String;var TabOrder,Top,Left:Integer):TWizardPage;
begin
Result:=CreateCustomPage(PrevPageID,Caption,Description);
PrevPageID:=Result.ID;
TabOrder:=0;
Top:=8;
Left:=4;
end;
function SubString(S:String;Start,Count:Integer):String;
begin
Result:=S;
if (Start>1) then
Delete(Result,1,Start-1);
if (Count>=0) then
SetLength(Result,Count);
end;
{
Find the position of the next of the three specified tokens (if any).
Returns 0 if none were found.
}
function Pos3(S,Token1,Token2,Token3:String;var ResultPos:Integer):String;
var
i:Integer;
begin
ResultPos:=Pos(Token1,S);
if (ResultPos>0) then
Result:=Token1;
i:=Pos(Token2,S);
if (i>0) and ((ResultPos=0) or (i<ResultPos)) then begin
ResultPos:=i;
Result:=Token2;
end;
i:=Pos(Token3,S);
if (i>0) and ((ResultPos=0) or (i<ResultPos)) then begin
ResultPos:=i;
Result:=Token3;
end;
end;
function CountLines(S:String):Integer;
begin
Result:=1+StringChangeEx(S,#13,'',True);
end;
{
Description can contain pseudo tags <RED>...</RED> and <A HREF=...>...</A>
(which cannot be mixed).
}
function CreateRadioButtonOrCheckBox(CreateRadioButton:Boolean;Page:TWizardPage;const Caption,Description:String;var TabOrder,Top,Left:Integer):TButtonControl;
var
RadioButton:TRadioButton;
CheckBox:TCheckBox;
RadioLabel,SubLabel:TLabel;
Untagged,RowPrefix,Link:String;
RowStart,RowCount,i,j:Integer;
begin
if (CreateRadioButton) then begin
RadioButton:=TRadioButton.Create(Page);
RadioButton.Caption:=Caption;
RadioButton.Font.Style:=[fsBold];
Result:=RadioButton;
end else begin
CheckBox:=TCheckBox.Create(Page);
CheckBox.Caption:=Caption;
CheckBox.Font.Style:=[fsBold];
Result:=CheckBox;
end;
Result.Parent:=Page.Surface;
Result.Left:=ScaleX(Left);
Result.Top:=ScaleY(Top);
Result.Width:=ScaleX(405);
Result.Height:=ScaleY(17);
Result.TabOrder:=TabOrder;
TabOrder:=TabOrder+1;
Top:=Top+24;
Untagged:='';
RadioLabel:=TLabel.Create(Page);
RadioLabel.Parent:=Page.Surface;
RadioLabel.Caption:=Untagged;
RadioLabel.Top:=ScaleY(Top);
RadioLabel.Left:=ScaleX(Left+24);
RadioLabel.Width:=ScaleX(405);
RadioLabel.Height:=ScaleY(13);
RowPrefix:='';
RowCount:=1;
while True do begin
case Pos3(Description,#13,'<RED>','<A HREF=',i) of
'': begin
Untagged:=Untagged+Description;
RadioLabel.Caption:=Untagged;
RadioLabel.Height:=ScaleY(13*RowCount);
Top:=Top+13+18;
Exit;
end;
''+#13: begin
Untagged:=Untagged+SubString(Description,1,i);
Description:=SubString(Description,i+1,-1);
RowCount:=RowCount+1;
RowPrefix:='';
Top:=Top+13;
end;
'<RED>': begin
Untagged:=Untagged+SubString(Description,1,i-1);
RowPrefix:=RowPrefix+SubString(Description,1,i-1);
Description:=SubString(Description,i+5,-1);
i:=Pos('</RED>',Description);
if (i=0) then LogError('Could not find </RED> in '+Description);
j:=Pos(#13,Description);
if (j>0) and (j<i) and (RowPrefix<>'') then begin
SubLabeL:=TLabel.Create(Page);
SubLabel.Parent:=Page.Surface;
SubLabel.Caption:=SubString(Description,1,j-1);
SubLabel.Top:=ScaleY(Top);
SubLabel.Left:=GetTextWidth(RowPrefix,RadioLabel.Font)+ScaleX(Left+24);
SubLabel.Width:=ScaleX(405);
SubLabel.Height:=ScaleY(13);
SubLabel.Font.Color:=clRed;
Untagged:=Untagged+SubString(Description,1,j);
Description:=SubString(Description,j+1,-1);
i:=i-j;
RowPrefix:='';
Top:=Top+13;
RowCount:=RowCount+1;
end;
SubLabeL:=TLabel.Create(Page);
SubLabel.Parent:=Page.Surface;
SubLabel.Caption:=SubString(Description,1,i-1);
SubLabel.Top:=ScaleY(Top);
SubLabel.Left:=GetTextWidth(RowPrefix,RadioLabel.Font)+ScaleX(Left+24);
SubLabel.Width:=ScaleX(405);
SubLabel.Height:=ScaleY(13*CountLines(SubLabel.Caption));
SubLabel.Font.Color:=clRed;
Untagged:=Untagged+SubString(Description,1,i-1);
RowPrefix:=RowPrefix+SubString(Description,1,i-1);
Description:=SubString(Description,i+6,-1);
end;
'<A HREF=': begin
Untagged:=Untagged+SubString(Description,1,i-1);
RowPrefix:=RowPrefix+SubString(Description,1,i-1);
Description:=SubString(Description,i+8,-1);
i:=Pos('>',Description);
if (i=0) then LogError('Could not find > in '+Description);
HyperlinkCount:=HyperlinkCount+1;
SetArrayLength(HyperlinkSource,HyperlinkCount);
SetArrayLength(HyperlinkTarget,HyperlinkCount);
HyperlinkTarget[HyperlinkCount-1]:=SubString(Description,1,i-1);
Description:=SubString(Description,i+1,-1);
i:=Pos('</A>',Description);
if (i=0) then LogError('Could not find </A> in '+Description);
j:=Pos(#13,Description);
if (j>0) and (j<i) and (RowPrefix<>'') then begin
SubLabeL:=TLabel.Create(Page);
HyperlinkSource[HyperlinkCount-1]:=SubLabel;