annotate contrib/packaging/inno/modpath.iss @ 52284:f4aede0f01af

rust-manifest: use `memchr` crate for all byte-finding needs While writing a very dumb manifest diffing algorithm for a proof-of-concept I saw that `Manifest::find_by_path` was much slower than I was expecting. It turns out that the Rust stdlib uses slow (all is relative) code when searching for byte positions for reasons ranging from portability, SIMD API stability, nobody doing the work, etc. `memch` is much faster for these purposes, so let's use it. I was measuring ~670ms of profile time in `find_by_path`, after this patch it went down to ~230ms.
author Raphaël Gomès <rgomes@octobus.net>
date Tue, 12 Nov 2024 23:20:04 +0100
parents 109315c41d5e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
41847
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1 // ----------------------------------------------------------------------------
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
2 //
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
3 // Inno Setup Ver: 5.4.2
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
4 // Script Version: 1.4.2
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
5 // Author: Jared Breland <jbreland@legroom.net>
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
6 // Homepage: http://www.legroom.net/software
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
7 // License: GNU Lesser General Public License (LGPL), version 3
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
8 // http://www.gnu.org/licenses/lgpl.html
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
9 //
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
10 // Script Function:
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
11 // Allow modification of environmental path directly from Inno Setup installers
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
12 //
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
13 // Instructions:
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
14 // Copy modpath.iss to the same directory as your setup script
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
15 //
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
16 // Add this statement to your [Setup] section
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
17 // ChangesEnvironment=true
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
18 //
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
19 // Add this statement to your [Tasks] section
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
20 // You can change the Description or Flags
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
21 // You can change the Name, but it must match the ModPathName setting below
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
22 // Name: modifypath; Description: &Add application directory to your environmental path; Flags: unchecked
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
23 //
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
24 // Add the following to the end of your [Code] section
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
25 // ModPathName defines the name of the task defined above
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
26 // ModPathType defines whether the 'user' or 'system' path will be modified;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
27 // this will default to user if anything other than system is set
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
28 // setArrayLength must specify the total number of dirs to be added
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
29 // Result[0] contains first directory, Result[1] contains second, etc.
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
30 // const
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
31 // ModPathName = 'modifypath';
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
32 // ModPathType = 'user';
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
33 //
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
34 // function ModPathDir(): TArrayOfString;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
35 // begin
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
36 // setArrayLength(Result, 1);
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
37 // Result[0] := ExpandConstant('{app}');
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
38 // end;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
39 // #include "modpath.iss"
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
40 // ----------------------------------------------------------------------------
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
41
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
42 procedure ModPath();
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
43 var
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
44 oldpath: String;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
45 newpath: String;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
46 updatepath: Boolean;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
47 pathArr: TArrayOfString;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
48 aExecFile: String;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
49 aExecArr: TArrayOfString;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
50 i, d: Integer;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
51 pathdir: TArrayOfString;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
52 regroot: Integer;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
53 regpath: String;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
54
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
55 begin
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
56 // Get constants from main script and adjust behavior accordingly
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
57 // ModPathType MUST be 'system' or 'user'; force 'user' if invalid
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
58 if ModPathType = 'system' then begin
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
59 regroot := HKEY_LOCAL_MACHINE;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
60 regpath := 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment';
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
61 end else begin
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
62 regroot := HKEY_CURRENT_USER;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
63 regpath := 'Environment';
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
64 end;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
65
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
66 // Get array of new directories and act on each individually
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
67 pathdir := ModPathDir();
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
68 for d := 0 to GetArrayLength(pathdir)-1 do begin
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
69 updatepath := true;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
70
44007
109315c41d5e inno: drop support for Windows 95/98/ME
Matt Harbison <matt_harbison@yahoo.com>
parents: 41847
diff changeset
71 // Get current path, split into an array
109315c41d5e inno: drop support for Windows 95/98/ME
Matt Harbison <matt_harbison@yahoo.com>
parents: 41847
diff changeset
72 RegQueryStringValue(regroot, regpath, 'Path', oldpath);
109315c41d5e inno: drop support for Windows 95/98/ME
Matt Harbison <matt_harbison@yahoo.com>
parents: 41847
diff changeset
73 oldpath := oldpath + ';';
109315c41d5e inno: drop support for Windows 95/98/ME
Matt Harbison <matt_harbison@yahoo.com>
parents: 41847
diff changeset
74 i := 0;
41847
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
75
44007
109315c41d5e inno: drop support for Windows 95/98/ME
Matt Harbison <matt_harbison@yahoo.com>
parents: 41847
diff changeset
76 while (Pos(';', oldpath) > 0) do begin
109315c41d5e inno: drop support for Windows 95/98/ME
Matt Harbison <matt_harbison@yahoo.com>
parents: 41847
diff changeset
77 SetArrayLength(pathArr, i+1);
109315c41d5e inno: drop support for Windows 95/98/ME
Matt Harbison <matt_harbison@yahoo.com>
parents: 41847
diff changeset
78 pathArr[i] := Copy(oldpath, 0, Pos(';', oldpath)-1);
109315c41d5e inno: drop support for Windows 95/98/ME
Matt Harbison <matt_harbison@yahoo.com>
parents: 41847
diff changeset
79 oldpath := Copy(oldpath, Pos(';', oldpath)+1, Length(oldpath));
109315c41d5e inno: drop support for Windows 95/98/ME
Matt Harbison <matt_harbison@yahoo.com>
parents: 41847
diff changeset
80 i := i + 1;
41847
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
81
44007
109315c41d5e inno: drop support for Windows 95/98/ME
Matt Harbison <matt_harbison@yahoo.com>
parents: 41847
diff changeset
82 // Check if current directory matches app dir
109315c41d5e inno: drop support for Windows 95/98/ME
Matt Harbison <matt_harbison@yahoo.com>
parents: 41847
diff changeset
83 if pathdir[d] = pathArr[i-1] then begin
109315c41d5e inno: drop support for Windows 95/98/ME
Matt Harbison <matt_harbison@yahoo.com>
parents: 41847
diff changeset
84 // if uninstalling, remove dir from path
109315c41d5e inno: drop support for Windows 95/98/ME
Matt Harbison <matt_harbison@yahoo.com>
parents: 41847
diff changeset
85 if IsUninstaller() = true then begin
109315c41d5e inno: drop support for Windows 95/98/ME
Matt Harbison <matt_harbison@yahoo.com>
parents: 41847
diff changeset
86 continue;
109315c41d5e inno: drop support for Windows 95/98/ME
Matt Harbison <matt_harbison@yahoo.com>
parents: 41847
diff changeset
87 // if installing, flag that dir already exists in path
41847
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
88 end else begin
44007
109315c41d5e inno: drop support for Windows 95/98/ME
Matt Harbison <matt_harbison@yahoo.com>
parents: 41847
diff changeset
89 updatepath := false;
41847
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
90 end;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
91 end;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
92
44007
109315c41d5e inno: drop support for Windows 95/98/ME
Matt Harbison <matt_harbison@yahoo.com>
parents: 41847
diff changeset
93 // Add current directory to new path
109315c41d5e inno: drop support for Windows 95/98/ME
Matt Harbison <matt_harbison@yahoo.com>
parents: 41847
diff changeset
94 if i = 1 then begin
109315c41d5e inno: drop support for Windows 95/98/ME
Matt Harbison <matt_harbison@yahoo.com>
parents: 41847
diff changeset
95 newpath := pathArr[i-1];
41847
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
96 end else begin
44007
109315c41d5e inno: drop support for Windows 95/98/ME
Matt Harbison <matt_harbison@yahoo.com>
parents: 41847
diff changeset
97 newpath := newpath + ';' + pathArr[i-1];
41847
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
98 end;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
99 end;
44007
109315c41d5e inno: drop support for Windows 95/98/ME
Matt Harbison <matt_harbison@yahoo.com>
parents: 41847
diff changeset
100
109315c41d5e inno: drop support for Windows 95/98/ME
Matt Harbison <matt_harbison@yahoo.com>
parents: 41847
diff changeset
101 // Append app dir to path if not already included
109315c41d5e inno: drop support for Windows 95/98/ME
Matt Harbison <matt_harbison@yahoo.com>
parents: 41847
diff changeset
102 if (IsUninstaller() = false) AND (updatepath = true) then
109315c41d5e inno: drop support for Windows 95/98/ME
Matt Harbison <matt_harbison@yahoo.com>
parents: 41847
diff changeset
103 newpath := newpath + ';' + pathdir[d];
109315c41d5e inno: drop support for Windows 95/98/ME
Matt Harbison <matt_harbison@yahoo.com>
parents: 41847
diff changeset
104
109315c41d5e inno: drop support for Windows 95/98/ME
Matt Harbison <matt_harbison@yahoo.com>
parents: 41847
diff changeset
105 // Write new path
109315c41d5e inno: drop support for Windows 95/98/ME
Matt Harbison <matt_harbison@yahoo.com>
parents: 41847
diff changeset
106 RegWriteStringValue(regroot, regpath, 'Path', newpath);
41847
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
107 end;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
108 end;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
109
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
110 // Split a string into an array using passed delimeter
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
111 procedure MPExplode(var Dest: TArrayOfString; Text: String; Separator: String);
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
112 var
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
113 i: Integer;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
114 begin
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
115 i := 0;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
116 repeat
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
117 SetArrayLength(Dest, i+1);
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
118 if Pos(Separator,Text) > 0 then begin
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
119 Dest[i] := Copy(Text, 1, Pos(Separator, Text)-1);
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
120 Text := Copy(Text, Pos(Separator,Text) + Length(Separator), Length(Text));
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
121 i := i + 1;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
122 end else begin
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
123 Dest[i] := Text;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
124 Text := '';
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
125 end;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
126 until Length(Text)=0;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
127 end;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
128
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
129
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
130 procedure CurStepChanged(CurStep: TSetupStep);
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
131 var
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
132 taskname: String;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
133 begin
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
134 taskname := ModPathName;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
135 if CurStep = ssPostInstall then
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
136 if IsTaskSelected(taskname) then
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
137 ModPath();
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
138 end;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
139
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
140 procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
141 var
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
142 aSelectedTasks: TArrayOfString;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
143 i: Integer;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
144 taskname: String;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
145 regpath: String;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
146 regstring: String;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
147 appid: String;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
148 begin
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
149 // only run during actual uninstall
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
150 if CurUninstallStep = usUninstall then begin
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
151 // get list of selected tasks saved in registry at install time
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
152 appid := '{#emit SetupSetting("AppId")}';
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
153 if appid = '' then appid := '{#emit SetupSetting("AppName")}';
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
154 regpath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\'+appid+'_is1');
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
155 RegQueryStringValue(HKLM, regpath, 'Inno Setup: Selected Tasks', regstring);
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
156 if regstring = '' then RegQueryStringValue(HKCU, regpath, 'Inno Setup: Selected Tasks', regstring);
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
157
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
158 // check each task; if matches modpath taskname, trigger patch removal
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
159 if regstring <> '' then begin
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
160 taskname := ModPathName;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
161 MPExplode(aSelectedTasks, regstring, ',');
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
162 if GetArrayLength(aSelectedTasks) > 0 then begin
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
163 for i := 0 to GetArrayLength(aSelectedTasks)-1 do begin
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
164 if comparetext(aSelectedTasks[i], taskname) = 0 then
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
165 ModPath();
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
166 end;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
167 end;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
168 end;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
169 end;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
170 end;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
171
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
172 function NeedRestart(): Boolean;
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
173 begin
44007
109315c41d5e inno: drop support for Windows 95/98/ME
Matt Harbison <matt_harbison@yahoo.com>
parents: 41847
diff changeset
174 Result := False;
41847
0f49b56d5d74 inno: replace add_path.exe with a Pascal script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
175 end;