How to get InnoSetup to create a deletion log file

I use InnoSetup to create my application installers and I set the flag "SetupLogging = yes" to always create the installation log file in the% TEMP% directory. This is great for the installation procedure. Unfortunately, InnoSetup will not create such a log file when the application is uninstalled.

Is there a flag / option to force InnoSetup to also create a delete log file?

+3
source share
5 answers

No, you will need to use [Code] to update the Uninstall registry key to include the / LOG switch in the UninstallString value.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall (YourAppID) _is1, HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall (YourAppID) _is1

. , CurStepChanged CurStep = ssPostInstall.

+2

, "/log" exe "":

[Setup]
...
SetupLogging=yes
...

[Icons]
...
Name: {group}\Uninstall; Filename: {uninstallexe}; Parameters: "/log";
+5

@mlaan ( "/log" ). , HKLM. HKCU .

#define MyAppID "{3D97CC33-75B0-4D86-8533-B213E5FF4046}"

[Setup]
AppId={{#MyAppID}

[Code]
procedure AppendStringToRegValue(const RootKey: integer; const SubKeyName, ValueName, StringToAppend: string);
var
  OldValue: string;  
  NewValue: string;  
  RootKeyString: string;
begin
  case RootKey of
    HKLM: 
      RootKeyString := 'HKLM';
    HKCU: 
      RootKeyString := 'HKCU';
  else 
    RootKeyString := 'RootKey ' + IntToStr(RootKey);
  end;

  if RegQueryStringValue( RootKey, SubKeyName, ValueName, OldValue ) then
  begin
    NewValue := OldValue + StringToAppend
    if RegWriteStringValue( RootKey, SubKeyName, ValueName, NewValue ) then
      Log('Updated ' + RootKeyString + '\' + SubKeyName + '\' + ValueName + '. New Value = [' + NewValue + '].')
    else
      Log('Could not write to ' + RootKeyString + '\' + SubKeyName + '\' + ValueName + '. Value remains [' + OldValue + '].' )
  end
  else
    Log('Could not read from ' + RootKeyString + '\' + SubKeyName + '\' + ValueName + '.' );
end;

procedure CurStepChanged(CurStep: TSetupStep);
var
  OldValue: string;  
  NewValue: string;  
  UninstallSubKeyName:  string;
begin
  if CurStep = ssPostInstall then
  begin
    { Modify uninstall registry entries to add "/log" parameter for uninstall }
    UninstallSubKeyName  := 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#MyAppID}_is1'
    AppendStringToRegValue(HKLM, UninstallSubKeyName, 'UninstallString', ' /log')
    AppendStringToRegValue(HKLM, UninstallSubKeyName, 'QuietUninstallString', ' /log')
  end;
end;
+4

, , :

 unins000.exe

So, to create a log file for deletion, I just need to call the file from the command line, specifying the path \ name for the log, in my case disinstallazione.log:

unins000.exe  /log="C:\disinstallazione.log"

How could I understand what happens during the removal.


PS also in my case I have

SetupLogging=yes
+2
source

Put these two lines in the [Setup] section of your InnoSetup script

[Setup]
SetupLogging=yes
UninstallLogMode=append

After removal, look in a temporary folder for your magazines. In Windows7, this location will be

C:\Users\<UserName>\AppData\Local\Temp

You will find a file named

Setup Log 2014-12-10 #001.txt

This is your Inno installation log file.

-3
source

Source: https://habr.com/ru/post/1738451/


All Articles