IsDotNetInstalled Inno Setup 函数中的“MinServicePack”参数是什么

What is the `MinServicePack` parameter in IsDotNetInstalled Inno Setup function

我刚刚注意到 Inno Setup 6.0.4 现已发布,它有一个新的 IsDotNetInstalled 功能。

目前我一直在用这个脚本查看是否安装了4.6.2:

{ Determines if .NET 4.6.2 (or higher) is installed }
function IsDotNetDetected(): boolean;
var
    strKey64: string;
    strKey86: string;
    dwInstalled: cardinal;
begin
  strKey64 := 'SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v4\Full';
  strKey86 := 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full';

  result := false; { Assume .NET Framework 4.6.2 is not installed }

  { For more information, see: }
  { http://msdn.microsoft.com/en-us/library/hh925568%28v=vs.110%29.aspx#net_b }
  if(Is64BitInstallMode()) then begin
    if (RegValueExists(HKLM, strKey64, 'Release')) then begin
      RegQueryDWordValue(HKLM, strKey64, 'Release', dwInstalled);
      if(dwInstalled >= 378675) then begin
        result := true;
      end;
    end;
  end
  else begin
    if (RegValueExists(HKLM, strKey86, 'Release')) then begin
      RegQueryDWordValue(HKLM, strKey86, 'Release', dwInstalled);
      if(dwInstalled >= 378675) then begin
        result := true;
      end;
    end;
  end;
end;

上面的代码是在这里调用的:

function PrepareToInstall(var NeedsRestart: Boolean): String;
begin
  result := '';

  dotNetNeeded := not IsDotNetDetected();

  if(dotNetNeeded) then begin
    if (MsgBox(ExpandConstant('{cm:DotNet_NeedToDownload}'),
                      mbConfirmation, MB_OKCANCEL) = IDCANCEL) then begin
      result := ExpandConstant('{cm:DotNet_InstallAborted}');
      Abort();
    end;
  end;

  if (bDownloadHelpDocSetup) then
    DoDeleteFile(ExpandConstant('{app}\MeetSchedAssist.chm'));
end;

我已经阅读了帮助主题,我似乎可以将这段代码简化为:

function PrepareToInstall(var NeedsRestart: Boolean): String;
begin
  result := '';

  dotNetNeeded := not IsDotNetInstalled(net462, 0);

  if(dotNetNeeded) then begin
    if (MsgBox(ExpandConstant('{cm:DotNet_NeedToDownload}'),
                      mbConfirmation, MB_OKCANCEL) = IDCANCEL) then begin
      result := ExpandConstant('{cm:DotNet_InstallAborted}');
      Abort();
    end;
  end;

  if (bDownloadHelpDocSetup) then
    DoDeleteFile(ExpandConstant('{app}\MeetSchedAssist.chm'));
end;

我注意到示例代码也使用它来格式化错误消息:

FmtMessage(SetupMessage(msgWinVersionTooLowError), ['.NET Framework', '4.6.2'])

这里的MinServicePack参数是什么?

感谢您的澄清。

我找到了关于 MinServicePack here 的答案。它指出:

// service -- Specify any non-negative integer for the required service pack level:
//    0               No service packs required
//    1, 2, etc.      Service pack 1, 2, etc. required