简体   繁体   中英

Why do we need to use the uninsneveruninstall flag when skinning a Inno Setup Uninstaller?

I am slightly confused with this VCL Styles plugin . I am specifically interested in the Uninstaller side of things.

The sample they provide goes like this:

#define VCLStylesSkinPath "{localappdata}\VCLStylesSkin"
[Files]
Source: ..\VclStylesinno.dll; DestDir: {#VCLStylesSkinPath}; Flags: uninsneveruninstall
Source: ..\Styles\Amakrits.vsf; DestDir: {#VCLStylesSkinPath}; Flags: uninsneveruninstall


[Code]
{ Import the LoadVCLStyle function from VclStylesInno.DLL }
procedure LoadVCLStyle(VClStyleFile: String);
  external 'LoadVCLStyleW@files:VclStylesInno.dll stdcall setuponly';
procedure LoadVCLStyle_UnInstall(VClStyleFile: String);
  external 'LoadVCLStyleW@{#VCLStylesSkinPath}\VclStylesInno.dll stdcall uninstallonly';
{ Import the UnLoadVCLStyles function from VclStylesInno.DLL }
procedure UnLoadVCLStyles;
  external 'UnLoadVCLStyles@files:VclStylesInno.dll stdcall setuponly';
procedure UnLoadVCLStyles_UnInstall;
  external 'UnLoadVCLStyles@{#VCLStylesSkinPath}\VclStylesInno.dll stdcall uninstallonly';

function InitializeSetup(): Boolean;
begin
  ExtractTemporaryFile('Amakrits.vsf');
  LoadVCLStyle(ExpandConstant('{tmp}\Amakrits.vsf'));
  Result := True;
end;

procedure DeinitializeSetup();
begin
  UnLoadVCLStyles;
end;

function InitializeUninstall: Boolean;
begin
  Result := True;
  LoadVCLStyle_UnInstall(ExpandConstant('{#VCLStylesSkinPath}\Amakrits.vsf'));
end;

procedure DeinitializeUninstall();
begin
  UnLoadVCLStyles_UnInstall;
end;

I am interested in this bit:

Source: ..\VclStylesinno.dll; DestDir: {#VCLStylesSkinPath}; Flags: uninsneveruninstall
Source: ..\Styles\Amakrits.vsf; DestDir: {#VCLStylesSkinPath}; Flags: uninsneveruninstall

I understand that the files need to be installed because they are required by the uninstaller. But why would you use the uninsneveruninstall flag? Is that acceptable behaviour?

It's a DLL. It's loaded into the uninstaller. So the uninstaller cannot delete it. So the flag is there, to avoid the uninstaller from failing when pointlessly trying to delete the file.

For a better solution, see the second part of my answer to:
Load external DLL for uninstall process in Inno Setup

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM