Inno Setup和VC Redistributable,并优雅地处理退出代码3010

问题描述

在我的CurStepChanged过程中,我有一些代码可以安装Visual Studio Redistributable(如果需要)。代码段:

if (bVcRedist64BitNeeded) then
begin
    if Exec(ExpandConstant(vcRedist64BitPath),'/install /passive /norestart','',SW_SHOW,ewWaitUntilTerminated,ResultCode) then begin
        { handle success if necessary; ResultCode contains the exit code }
        Log('VS Redist (64 bit) installer exit code = ' + IntToStr(ResultCode));
        if not (ResultCode = 0) then begin
            MsgBox(ExpandConstant('{cm:InstallFailed,Visual Studio x64 Redistributable}'),mbInformation,MB_OK);
            Abort();
        end;
    end
    else begin
        { The execution failed for some reason }
        Log('VS Redist (64 bit) installer exit code = ' + IntToStr(ResultCode));
        MsgBox(SysErrorMessage(ResultCode),MB_OK);
        Abort();
    end;
end;

我有一个用户说我的软件安装程序失败,所以我要求他们将日志发送给我。在所有日志的末尾,它的内容与此类似:

2020-09-05 14:37:48.034   VS Redist (64 bit) installer exit code = 3010
2020-09-05 14:37:48.035   Message box (OK):
                          The installation of Visual Studio x64 Redistributable failed. The Meeting Schedule Assistant installation will be aborted.
2020-09-05 14:38:38.352   User chose OK.
2020-09-05 14:38:38.352   CurStepChanged raised an exception.
2020-09-05 14:38:38.353   Need to restart Windows? No
2020-09-05 14:38:38.373   Exception message:
2020-09-05 14:38:38.374   Message box (OK):
                          Internal error: Expression error 'Runtime error (at 191:1960):
                          
                          Exception: Operation aborted.'
2020-09-05 14:38:40.747   User chose OK.
2020-09-05 14:38:40.747   Exception message:
2020-09-05 14:38:40.747   Message box (OK):
                          Internal error: Expression error 'Runtime error (at 191:1960):
                          
                          Exception: Operation aborted.'
2020-09-05 14:38:42.082   User chose OK.
2020-09-05 14:38:42.103   Exception message:
2020-09-05 14:38:42.104   Message box (OK):
                          Out Of Range.
2020-09-05 14:38:44.052   User chose OK.
2020-09-05 14:38:51.259   -- Run entry --
2020-09-05 14:38:51.259   Run as: Original user
2020-09-05 14:38:51.259   Type: Exec
2020-09-05 14:38:51.260   Filename: C:\Program Files (x86)\Meeting Schedule Assistant\MeetSchedAssist.exe

我注意到重做设置正在退出,结果为3010。我找不到有关redist退出代码的任何官方文档,但这似乎是软重启。无论如何,今天他们然后尝试了我的安装程序,并且安装程序成功了(因为他们昨晚已切换了PC):

2020-09-06 13:08:38.707   VS Redist (64 bit) installer exit code = 0
2020-09-06 13:09:33.070   VS Redist (32 bit) installer exit code = 0
2020-09-06 13:09:33.071   Need to restart Windows? No
2020-09-06 13:10:07.741   -- Run entry --
2020-09-06 13:10:07.741   Run as: Original user
2020-09-06 13:10:07.741   Type: Exec
2020-09-06 13:10:07.741   Filename: C:\Program Files (x86)\Meeting Schedule Assistant\MeetSchedAssist.exe

所以我假设3010表示软重启?如果是这样,有没有更好的方法可以在Inno Setup安装中处理这种情况?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)