@@ -81,6 +81,7 @@ Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
8181Name : " {group} \Turing System Monitor" ; Filename : " {app} \configure.exe"
8282
8383[Code]
84+ (* Detect if the program is already installed or if it is the first installation *)
8485function IsUpgrade : Boolean;
8586var
8687 Value : string;
@@ -98,8 +99,105 @@ begin
9899 Result := (PageID = wpSelectComponents) and not IsUpgrade;
99100end ;
100101
102+ (* Custom page to offer to install PawnIO driver *)
103+ var
104+ PagePawnIO: TWizardPage;
105+ InstallPawnIOCheckBox: TNewCheckBox;
106+ InfoText: TNewStaticText;
107+ LinkLabel: TNewStaticText;
108+
109+ procedure CreatePagePawnIO ;
110+ begin
111+ PagePawnIO := CreateCustomPage(
112+ wpInstalling,
113+ ' Install PawnIO driver' ,
114+ ' Recommended for best experience'
115+ );
116+
117+ InfoText := TNewStaticText.Create(PagePawnIO);
118+ InfoText.Parent := PagePawnIO.Surface;
119+ InfoText.Left := ScaleX(0 );
120+ InfoText.Top := ScaleY(10 );
121+ InfoText.Width := PagePawnIO.SurfaceWidth;
122+ InfoText.Height := ScaleY(60 );
123+ InfoText.WordWrap := True;
124+ InfoText.Caption :=
125+ ' PawnIO is an open-source scriptable universal kernel driver, allowing hardware access to a wide variety of programs.' + #13 #10 +
126+ ' It is used by LibreHardwareMonitor as a replacement to the old WinRing0 driver that was vulnerable.' + #13 #10 +
127+ ' If you do not install it, some hardware metrics such as clocks, temperatures, etc. will be limited or unavailable.' + #13 #10 +
128+ ' More information: https://pawnio.eu/' ;
129+
130+ { Création de la case à cocher }
131+ InstallPawnIOCheckBox := TNewCheckBox.Create(PagePawnIO);
132+ InstallPawnIOCheckBox.Parent := PagePawnIO.Surface;
133+ InstallPawnIOCheckBox.Caption := ' Install / update PawnIO driver (admin. rights needed)' ;
134+ InstallPawnIOCheckBox.Left := ScaleX(0 );
135+ InstallPawnIOCheckBox.Top := InfoText.Top + InfoText.Height + ScaleY(20 );
136+ InstallPawnIOCheckBox.Width := PagePawnIO.SurfaceWidth;
137+ InstallPawnIOCheckBox.Font.Style := [fsBold];
138+ InstallPawnIOCheckBox.Checked := True;
139+ end ;
140+
141+ function NextButtonClick (CurPageID: Integer): Boolean;
142+ var
143+ ResultCode: Integer;
144+ begin
145+ (* Do not remove !*)
146+ Result := True;
147+
148+ if CurPageID = PagePawnIO.ID then
149+ begin
150+ if InstallPawnIOCheckBox.Checked then
151+ begin
152+ if not FileExists(ExpandConstant(' {app}\external\PawnIO\PawnIO_setup.exe' )) then
153+ begin
154+ MsgBox(ExpandConstant(' {app}\external\PawnIO\PawnIO_setup.exe not found' ), mbError, MB_OK);
155+ end
156+ else
157+ begin
158+ if not ShellExec(
159+ ' ' ,
160+ ExpandConstant(' {app}\external\PawnIO\PawnIO_setup.exe' ),
161+ ' -uninstall -silent' ,
162+ ExpandConstant(' {app}' ),
163+ SW_SHOWNORMAL,
164+ ewWaitUntilTerminated,
165+ ResultCode
166+ ) then
167+ begin
168+ MsgBox(
169+ ' Failed to run PawnIO_setup.exe.' #13 #10 +
170+ ' Error code :' + IntToStr(ResultCode),
171+ mbError,
172+ MB_OK
173+ );
174+ end ;
175+
176+ if not ShellExec(
177+ ' ' ,
178+ ExpandConstant(' {app}\external\PawnIO\PawnIO_setup.exe' ),
179+ ' -install -silent' ,
180+ ExpandConstant(' {app}' ),
181+ SW_SHOWNORMAL,
182+ ewWaitUntilTerminated,
183+ ResultCode
184+ ) then
185+ begin
186+ MsgBox(
187+ ' Failed to run PawnIO_setup.exe.' #13 #10 +
188+ ' Error code :' + IntToStr(ResultCode),
189+ mbError,
190+ MB_OK
191+ );
192+ end ;
193+ end ;
194+ end ;
195+ end ;
196+ end ;
197+
101198procedure InitializeWizard ;
102199begin
200+ (* If update do not install themes and config by default to avoid overwriting user changes *)
103201 if IsUpgrade then begin
104202 Log(' Upgrade detected' );
105203 WizardSelectComponents(' program !themes, !config' );
@@ -108,4 +206,6 @@ begin
108206 Log(' First installation' );
109207 WizardSelectComponents(' program themes config' );
110208 end ;
209+
210+ CreatePagePawnIO();
111211end ;
0 commit comments