1

I can tell Inno Setup (tried with the latest version 5.5.9) to create log file by launching setup.exe /log=<log.txt>.

Unfortunately, it does not seem to log creation of registry entries declared in the [Registry] section. How to tell Inno Setup to also log the registry entry creation or reasons why they were not created?

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Thomas S.
  • 5,804
  • 5
  • 37
  • 72

1 Answers1

1

It's not possible to make Inno Setup automatically log actions based on [Registry] section.

But you can log them manually using BeforeInstall and AfterInstall parameters and Log support function:

[Registry]
Root: HKLM; Subkey: "Software\My Company\My Program"; ValueType: string; \
  ValueName: "Test"; ValueData: "data"; \
  BeforeInstall: Log('Before writing Test value'); \
  AfterInstall: Log('After writing Test value');

Registry writing errors (as any errors) are logged automatically:

2017-05-21 16:57:51.652   Before writing Test value
2017-05-21 16:57:51.653   Message box (Abort/Retry/Ignore):
                          Error creating registry key:
                          HKEY_LOCAL_MACHINE\Software\My Company\My Program

                          RegCreateKeyEx failed; code 5.
                          Access is denied.

                          Click Retry to try again, Ignore to proceed anyway, or Abort to cancel installation.
2017-05-21 17:00:58.116   User chose Ignore.
2017-05-21 17:00:58.116   After writing Test value

If you need greater control over the logging, you need to use Pascal Scripting (instead of [Registry] section entries) to write to the registry. But you cannot use convenient Inno Setup Registry support functions, as they won't give you a reason of a failure.

You would have to use low-level WinAPI functions.

Some references:

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992