Environment
Inno Setup 6.5 / 6.5.1
Windows 10 / 11 and Server 2019 / 2022
Installer launched from a Windows service (running as SYSTEM)
Summary
Since Inno Setup 6.5, GetTempDir internally uses GetTempPath2() (or GetTempPath) instead of reading environment variables manually.
This causes a regression when running under the SYSTEM account on machines where
C:\Windows\SystemTemp does not exist.
In these cases, GetTempPath2() returns "C:\Windows\SystemTemp", and because the new implementation no longer checks for directory existence, Setup attempts to extract itself there and fails immediately with
“Unable to create temporary file”
or similar.
Previous versions (≤ 6.4) performed DirExists checks and fell back to other variables or default paths (e.g. C:\Windows), so the same installers worked correctly.
Steps to reproduce
Run a SYSTEM shell:
Remove the default system temp folder:
Launch a setup built with Inno Setup 6.5.
→ Setup fails before extraction.
Rebuild the same script with 6.4.
→ Setup succeeds.
Expected behavior
If the path returned by GetTempPath2()/GetTempPath does not exist or is not writable,
GetTempDir should fall back to the next available temp location (as earlier versions did) or at least attempt to create the directory.
Suggested fix
Reintroduce the existence and fallback logic, e.g.:
Call GetTempPath2()/GetTempPath().
If the directory doesn’t exist, try to create it.
If creation fails, fall back to the legacy environment variable search (TEMP, TMP, USERPROFILE, Windows).
That would restore compatibility and reliability when running under non-interactive or restricted accounts.
Impact
Installations invoked by system services (e.g. managed software deployment) can no longer start on machines missing C:\Windows\SystemTemp.
This behavior is incompatible with all previous Inno Setup versions.
Workaround
Manually create C:\Windows\SystemTemp with SYSTEM permissions, or override the TEMP variable in the service environment.
Hi,
According to the documentation, C:\Windows\SystemTemp is the correct location. It also notes that the SystemTemp environment variable, if set, takes priority. So if the directory has been deleted but SystemTemp isn’t defined, the resulting error seems like the correct behavior.
--
You received this message because you are subscribed to the Google Groups "innosetup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to innosetup+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/innosetup/12997333-479d-468d-8fd7-b6a44708c1a8n%40googlegroups.com.