gpt4 book ai didi

inno-setup - 卸载顺序

转载 作者:行者123 更新时间:2023-12-04 22:59:11 25 4
gpt4 key购买 nike

我可以在卸载期间执行事件和节的实际顺序中找到某个地方吗?例如,UninstallDelete会比usPostUninstall卸载步骤更早出现吗?

Inno Setup在手册中有“安装顺序”文章,但看起来更像是编译顺序,而不是执行顺序。

最佳答案

正如手册所说,卸载顺序与installation order相反(实际上是安装顺序,而不是编译顺序)。

这仅仅是因为没有编程的卸载顺序。安装程序将其步骤记录到卸载日志中,并且卸载程序仅以相反的顺序处理日志,而没有任何更改顺序的选项。

event functions适用于卸载过程,如下所示(仅显示主要卸载步骤):

  • CurUninstallStepChanged(usAppMutexCheck)
  • InitializeUninstallProgressForm
  • CurUninstallStepChanged(usUninstall)
  • 处理卸载日志:
  • [UninstallRun]
  • 注册表项
  • 图标
  • 文件
  • 应用程序目录
  • [UninstallDelete]
  • 第二次尝试删除目录(例如之前不为空的目录)
  • CurUninstallStepChanged(usPostUninstall)
  • CurUninstallStepChanged(usDone)
  • DeinitializeUninstall


  • 我已经在一个简单的安装程序上对此进行了测试:
    [Setup]
    AppName=My Program
    AppVersion=1.5
    DefaultDirName={pf}\My Program
    DefaultGroupName=My Program
    UninstallDisplayIcon={app}\MyProg.exe
    OutputDir=.

    [Files]
    Source: "MyProg.exe"; DestDir: "{app}"

    [Icons]
    Name: "{group}\My Program"; Filename: "{app}\MyProg.exe"

    [UninstallRun]
    FileName: "{app}\MyProg.exe"

    [UninstallDelete]
    Type: files; Name: "{app}\test.dat"

    [Code]

    function InitializeUninstall(): Boolean;
    begin
    Log('InitializeUninstall');
    Result := True;
    end;

    procedure InitializeUninstallProgressForm;
    begin
    Log('InitializeUninstallProgressForm');
    end;

    procedure DeinitializeUninstall;
    begin
    Log('DeinitializeUninstall');
    end;

    procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
    begin
    Log('CurUninstallStepChanged + ' + IntToStr(Integer(CurUninstallStep)));
    end;

    卸载程序日志类似于(它不会显示所有步骤):
    2015-07-19 10:47:54.845   Log opened. (Time zone: UTC+02:00)
    2015-07-19 10:47:54.846 Setup version: Inno Setup version 5.5.5 (u)
    2015-07-19 10:47:54.846 Original Uninstall EXE: C:\Program Files (x86)\My Program\unins000.exe
    2015-07-19 10:47:54.846 Uninstall DAT: C:\Program Files (x86)\My Program\unins000.dat
    2015-07-19 10:47:54.846 Uninstall command line: /SECONDPHASE="C:\Program Files (x86)\My Program\unins000.exe" /FIRSTPHASEWND=$1309D4 /INITPROCWND=$2509E4 /log=b:\uninstall\uninstall.log
    2015-07-19 10:47:54.846 Windows version: 6.3.9600 (NT platform: Yes)
    2015-07-19 10:47:54.846 64-bit Windows: Yes
    2015-07-19 10:47:54.846 Processor architecture: x64
    2015-07-19 10:47:54.846 User privileges: Administrative
    2015-07-19 10:47:54.846 64-bit install mode: No
    2015-07-19 10:47:54.846 Created temporary directory: C:\Users\martin\AppData\Local\Temp\is-4R498.tmp
    2015-07-19 10:47:54.860 InitializeUninstall
    2015-07-19 10:47:54.860 Message box (Yes/No):
    Are you sure you want to completely remove My Program and all of its components?
    2015-07-19 10:47:55.797 User chose Yes.
    2015-07-19 10:47:55.797 CurUninstallStepChanged + 0
    2015-07-19 10:47:55.802 InitializeUninstallProgressForm
    2015-07-19 10:47:55.810 CurUninstallStepChanged + 1
    2015-07-19 10:47:55.810 Starting the uninstallation process.
    2015-07-19 10:47:55.810 Running Exec filename: C:\Program Files (x86)\My Program\MyProg.exe
    2015-07-19 10:47:57.111 Process exit code: 0
    2015-07-19 10:47:57.143 Deleting file: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\My Program\My Program.lnk
    2015-07-19 10:47:57.144 Deleting directory: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\My Program
    2015-07-19 10:47:57.144 Deleting file: C:\Program Files (x86)\My Program\MyProg.exe
    2015-07-19 10:47:57.145 Deleting directory: C:\Program Files (x86)\My Program
    2015-07-19 10:47:57.145 Failed to delete directory (145). Will retry later.
    2015-07-19 10:47:57.145 Deleting file: C:\Program Files (x86)\My Program\test.dat
    2015-07-19 10:47:57.145 Deleting Uninstall data files.
    2015-07-19 10:47:57.662 Deleting directory: C:\Program Files (x86)\My Program
    2015-07-19 10:47:57.665 Uninstallation process succeeded.
    2015-07-19 10:47:57.665 Removed all? Yes
    2015-07-19 10:47:57.665 Need to restart Windows? No
    2015-07-19 10:47:57.668 CurUninstallStepChanged + 2
    2015-07-19 10:47:57.668 Message box (OK):
    My Program was successfully removed from your computer.
    2015-07-19 10:47:58.342 User chose OK.
    2015-07-19 10:47:58.342 CurUninstallStepChanged + 3
    2015-07-19 10:47:58.342 DeinitializeUninstall
    2015-07-19 10:47:58.343 Log closed.

    关于inno-setup - 卸载顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31456897/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com