Install multiple instances

213 views
Skip to first unread message

Petr Šikola

unread,
Dec 11, 2021, 3:26:44 PM12/11/21
to innosetup
Hi, i have setup for multiple instances, similar to MSSQL server in example.
I dynamically change AppId according to passed parameter /instance=TEST.

Is there way to let user to choose installed instances?
I created CreateInputQueryPage with combobox filled from uninstall registry.
I dont know how to change AppId after Welcome setup page, because AppId is at this time already set.

  paramsInstance := CreateInputQueryPage(wpWelcome, '', '', '');
  ComboInstances := TNewComboBox.Create(paramsInstance);


function NextButtonClick(CurPageID: Integer): Boolean;
...
begin
...
  if (CurPageID = paramsInstance.ID) and not WizardSilent then
  begin
      for i := 1 to paramcount do
        params := params + paramstr(i);
      params := ' /instance='+Uppercase(trim(ComboInstances.Text));
      if pos('/lang=',lowercase(params))=0 then
        params := params + ' /lang=' + ActiveLanguage;
      b := Exec(ExpandConstant('{srcexe}'), params, '', SW_SHOW, ewNoWait, ResultCode);
      //it doesnt exec and ends with resultcode=5
      result := false;
      Abort; //it doesnt abort too
   end;
   ...
end;
 
Any ideas ?
Thanks for help.

Petr Šikola

unread,
Dec 11, 2021, 3:33:14 PM12/11/21
to innosetup
Appendix:
In example above i try to exec setup itself with param instance, but it doesnt work.

Dne sobota 11. prosince 2021 v 21:26:44 UTC+1 uživatel Petr Šikola napsal:

Petr Šikola

unread,
Dec 11, 2021, 4:41:00 PM12/11/21
to innosetup
update:
exit from setup i manage with
procedure ExitProcess(exitCode:integer);
  external 'ExitP...@kernel32.dll stdcall';

so now i need run setup itself from setup.

OR

do AppId change at runtime AFTER Welcome Page.

Dne sobota 11. prosince 2021 v 21:33:14 UTC+1 uživatel Petr Šikola napsal:

Gavin Lambert

unread,
Dec 12, 2021, 5:17:13 PM12/12/21
to inno...@googlegroups.com
On 12/12/2021 09:26, Petr Šikola wrote:
> Hi, i have setup for multiple instances, similar to MSSQL server in example.
> I dynamically change AppId according to passed parameter /instance=TEST.
>
> Is there way to let user to choose installed instances?
> I created CreateInputQueryPage with combobox filled from uninstall registry.
> I dont know how to change AppId after Welcome setup page, because AppId
> is at this time already set.

As is documented, the AppId returned prior to InitializeWizard is used
for loading the various UsePrevious* data, but it is checked again when
the installation actually begins and it can return something different
then. This allows the wizard to change its value.

Petr Šikola

unread,
Dec 13, 2021, 4:29:41 AM12/13/21
to innosetup
Thanks, but how can I perform new loading  UsePrevious* data ?
I try to change AppId after Welcome page, but AppDir, Components, Tasks,  is stil according to first value of AppId.

As option i want to start new setup with parameter ( Exec(ExpandConstant('{srcexe}'), params, '', SW_SHOW, ewNoWait, ResultCode);  ), but i have problem with it, because it doesn't start and ends with 5 resultcode.

My setup is quite complicated and if I run it with the parameter /instance=... then I can have multiple instances installed side by side completely separated. This works great because I derive the AppId from the passed parameter /instance (with function in code section).
But I wanted to make it more user-friendly and let the user select which instance to install/update in the first step of the installation (or immediately after WelcomePage).

P.

Dne neděle 12. prosince 2021 v 23:17:13 UTC+1 uživatel Gavin Lambert napsal:

Petr Šikola

unread,
Dec 13, 2021, 8:59:14 AM12/13/21
to innosetup
I found that {srcexe} is blocked during the running installation (also the file cannot be copied) - therefore I get error 5 access denied.

Don't have any idea how to unlock the file? (I also tried UnloadDll, but it also doesn't work)

Dne pondělí 13. prosince 2021 v 10:29:41 UTC+1 uživatel Petr Šikola napsal:

Gavin Lambert

unread,
Dec 13, 2021, 5:49:36 PM12/13/21
to inno...@googlegroups.com
On 13/12/2021 22:29, Petr Šikola wrote:
> Thanks, but how can I perform new loading UsePrevious* data ?
> I try to change AppId after Welcome page, but AppDir, Components,
> Tasks,  is stil according to first value of AppId.

The cleanest way is to display your instance-selection UI using
CreateCustomForm from InitializeSetup -- this runs before the wizard
captures the initial value of AppId and loads the previous data.

Otherwise you're on your own and you need to read the data yourself and
update the wizard accordingly.

> As option i want to start new setup with parameter (
> Exec(ExpandConstant('{srcexe}'), params, '', SW_SHOW, ewNoWait,
> ResultCode);  ), but i have problem with it, because it doesn't start
> and ends with 5 resultcode.

Don't do that. Relaunching the setup will mess with the user elevation
and cause incorrect behaviour. It also interferes with any parent
process that wants to monitor the installation progress and exit codes.

Petr Šikola

unread,
Dec 14, 2021, 3:42:10 AM12/14/21
to innosetup
Thanks for the suggestion. It looks like it will be the only solution.

Dne pondělí 13. prosince 2021 v 23:49:36 UTC+1 uživatel Gavin Lambert napsal:
Reply all
Reply to author
Forward
0 new messages