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;
...
//-----------------------------------------------------------------------
```