1

Running an Inno-Setup 5.5.9 (a) created install on Windows 2016 DataCenter (64 bit) from a Windows Service running under the SYSTEM account, and getting the following error being logged (whole log file below):

2020-03-13 11:46:24.093 Log opened. (Time zone: UTC-05:00)
2020-03-13 11:46:24.093 Setup version: Inno Setup version 5.5.9 (a)
2020-03-13 11:46:24.093 Original Setup EXE: C:\Program Files (x86)\4PatientCare\Shadow4PatientCare Cloud\Shadow4PatientCareCloud_6.0.0.0_Install_2020-3-4_1.exe
2020-03-13 11:46:24.093 Setup command line: /SL5="$0,16433093,57856,C:\Program Files (x86)\4PatientCare\Shadow4PatientCare Cloud\Shadow4PatientCareCloud_6.0.0.0_Install_2020-3-4_1.exe" /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /NOICONS /UpdateFromService
2020-03-13 11:46:24.093 Windows version: 10.0.14393 (NT platform: Yes)
2020-03-13 11:46:24.093 64-bit Windows: Yes
2020-03-13 11:46:24.093 Processor architecture: x64
2020-03-13 11:46:24.093 User privileges: Administrative
2020-03-13 11:46:24.108 64-bit install mode: No 2020-03-13 11:46:24.108 Created temporary directory: C:\Windows\TEMP\is-5GHEA.tmp
2020-03-13 11:46:24.108 Exception message:
2020-03-13 11:46:24.108 Defaulting to OK for suppressed message box (OK):
Error creating window class.

2020-03-13 11:46:24.108 Deinitializing Setup.
2020-03-13 11:46:24.108 Log closed.

The install works fine when running under the interactive user account, as well as when started from a cmdtool logged in as SYSTEM (via psexec.exe -s -i cmd.exe). However when started from the Window service running under SYSTEM it fails with a log file like above.

One thing I noticed: when the install does run successfully, the log file line that starts with "Setup command line" looks like:

2020-03-11 19:24:26.967 Setup command line: /SL5="$196601FA,16807514,57856,C:\Prog...

But when it fails it looks like:

2020-03-13 11:46:24.093 Setup command line: /SL5="$0,16433093,57856,C:\Progr...

so the first item assigned to SL5 is $0. Could this mean something? Has anyone experienced this and found a solution?

Here is the Delphi 2010 code (32 bit) that runs the Inno Setup within a service:

```
//-----------------------------------------------------------------------
procedure ExecNewProcess(cmdline : String; DoWait,DoShow:boolean);

// in cmdline the characters before the first space encountered is interpreted as the EXE to execute. The rest of the string are the arguments

var StartInfo  : TStartupInfo;
    ProcInfo   : TProcessInformation;
    CreateOK   : Boolean;
begin
  FillChar(StartInfo,SizeOf(TStartupInfo),#0);
  FillChar(ProcInfo,SizeOf(TProcessInformation),#0);
  StartInfo.cb := SizeOf(TStartupInfo);
  StartInfo.dwFlags := STARTF_USESHOWWINDOW;
  if DoShow then
     StartInfo.wShowWindow := SW_SHOW
  else
     StartInfo.wShowWindow := SW_HIDE;

  CreateOK := CreateProcess(nil, PChar(cmdline), nil, nil,False,
              CREATE_NEW_PROCESS_GROUP+NORMAL_PRIORITY_CLASS,
              nil, nil, StartInfo, ProcInfo);

  if CreateOK and DoWait then
     WaitForSingleObject(ProcInfo.hProcess, INFINITE);

  //close process & thread handles
  CloseHandle(ProcInfo.hProcess);
  CloseHandle(ProcInfo.hThread);
end;
//-----------------------------------------------------------------------
...
try
   cmdline:='"' + dmAutoUpgrader.UpgradeFileName+'"'; // install file
   cmdline:=cmdline + ' /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /NOICONS /UpdateFromService';    // arguments
   UniqueString(cmdline);
   ExecNewProcess(cmdline,true,false);
except
   on E:Exception do
      ControllerLog.add(DoLog,'Service, Error, Error=' + E.Message);
end;
...
//-----------------------------------------------------------------------
```
whosrdaddy
  • 11,720
  • 4
  • 50
  • 99
klz
  • 31
  • 3
  • Please show the actual code that is running the installer from the service – Remy Lebeau Mar 13 '20 at 21:19
  • 1
    Did you try [allowing service to interact with desktop](https://stackoverflow.com/questions/4237225/allow-service-to-interact-with-desktop-in-windows)? (not a recommended pratice, I know, but just to test) – Olivier Mar 14 '20 at 09:09
  • 1
    I ended up rebooting the Windows 2016 Server and the install then ran fine from the Service (running under Local System). When the setup ran, the Inno Setup log file (created in the Windows\temp folder) did contain a value for the first parameter after the SL5= section. I looked in the Inno Setup source code and apparently that parameter is the "handle to SetupLdr's notify window", so the fact that $0 was being logged for the handle when the installation failed points to the inability for that handle to be generated. Perhaps a resource depletion issue that was solved by the reboot? – klz Mar 14 '20 at 21:01
  • Still not happy that I can't pinpoint what went wrong. Apparently this line in the Inno Setup source code (SetupLdr.dpr) returned 0: SetupLdrWnd := CreateWindowEx(0, 'STATIC', 'InnoSetupLdrWindow', 0, 0, 0, 0, 0, HWND_DESKTOP, 0, HInstance, nil); – klz Mar 15 '20 at 05:23

0 Answers0