如何检测静音创建是否完全(100%)完成了简单的方法? [英] How to detect if silent inno setup is fully(100%) completed the easy way?

查看:96
本文介绍了如何检测静音创建是否完全(100%)完成了简单的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在静音Inno Setup(实际上是更新)期间锁定文件时,用户获取MsgBox,允许他忽略文件替换。设置完成后,进程存在,ExitCode = 0表示设置完成。由于并非所有文件都被替换,您无法100%确定安装完全完成。



更新:

谢谢Valery,不幸的是,你的答案无法解决我的问题,因为MakePendingFileRenameOperationsChecksum在更新部分之前和之后返回相同的校验和!如果PrivilegesRequired设置为最低而不是admin,会发生这种情况吗?



经过反复试验编码后,我发现当/ SUPPRESSMSGBOXES切换时使用后,返回的ExitCode为5(设置中止)!这对我来说已经足够了!



我尝试过:



*在Inno Setup API中查找某些函数或变量以检查100%是否完成;

*验证ExitCodes;

* googling;

*在设置之前和之后比较所有文件的校验和(太多工作);

*在设置本身编码替换以获得更多控制(太多工作);

When files are locked during the silent Inno Setup(actually the update), user gets MsgBox allowing him to ignore file replacement. After setup is finished, the process exists with ExitCode=0 meaning setup is completed. Since not all files are replaced, you can not be 100% sure that setup is fully completed.

UPDATE:
Thank you Valery, unfortunately your answer can not solve my problem since MakePendingFileRenameOperationsChecksum returns the same checksum before and after the update part! This happens if PrivilegesRequired is set to lowest and not admin?

After waisting some time with trial-and-error coding, I've discovered that when /SUPPRESSMSGBOXES switch is used, the returned ExitCode is 5(setup is aborted)! This is good enough for me!

What I have tried:

* seaching for some function or variable in the Inno Setup API to check if 100% completed;
* validating ExitCodes;
* googling;
* comparing checksums of all files before and after setup(too much work);
* coding replacement in setup itself to have more control(too much work);

推荐答案

你好,



过去我是用
Hello,

In the past I did this using
MakePendingFileRenameOperationsChecksum

做的,然后返回自定义错误代码。



如果文件正在使用且用户选择忽略,则Inno安装程序将设置重启挂起标志。



示例脚本:



and returning a custom error code.

If a file is in use and the user selects ignore, then Inno setup will set a reboot pending flag.

Example script:

Source: "MyProg.exe"; DestDir: "{app}";
Source: "MyProg.chm"; DestDir: "{app}"; Flags: restartreplace;
Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme;

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

[Code]
var
  Restarted: Boolean;
  ChecksumBefore: String;
  ChecksumAfter: String;

procedure ExitProcess(exitCode:integer);
  external 'ExitProcess@kernel32.dll stdcall';

procedure ReturnRebootNecessary();
begin
    ExitProcess(9); //Custom exit code
end;

function InitializeSetup(): Boolean;
begin
    ChecksumBefore := MakePendingFileRenameOperationsChecksum;
    Result := True;
end;

procedure DeinitializeSetup();
begin
    ChecksumAfter := MakePendingFileRenameOperationsChecksum;
    if ChecksumBefore <> ChecksumAfter then
    begin
         ReturnRebootNecessary();
    end;
end;





谢谢。



Thanks.


这篇关于如何检测静音创建是否完全(100%)完成了简单的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆