我可以找到某个实际的订单,在卸载期间执行哪些事件和部分?例如,UninstallDelete
会出现在usPostUninstall
卸载步骤之前吗?
Inno安装有"安装顺序"手册中的文章,但它看起来更像是编译顺序,而不是执行。
答案 0 :(得分:8)
卸载顺序与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.