Installer: Windows 7: Use "powershell.exe Get-AuthenticodeSignature fortfw.sys" to check installed KB4474419

This commit is contained in:
Nodir Temirkhodjaev 2023-12-24 11:57:02 +03:00
parent 1402d746e6
commit d364bab970

View File

@ -160,11 +160,24 @@ begin
Result := (Version.Major = 6) and (Version.Minor = 1); Result := (Version.Major = 6) and (Version.Minor = 1);
end; end;
function IsUpdateInstalled(KB: String): Boolean; function IsDriverSignatureValid(): Boolean;
var var
DriverPath: String;
DriverName: String;
WorkingDir: String;
Command: String;
ResultCode: Integer; ResultCode: Integer;
begin begin
Exec('cmd.exe', '/c "systeminfo | findstr ' + KB + '"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) DriverPath := '{app}\driver\x86';
DriverName := 'fortfw.sys';
WorkingDir := ExpandConstant('{tmp}\') + DriverPath;
ExtractTemporaryFiles(DriverPath + '\' + DriverName);
Command := '-Command "if ((Get-AuthenticodeSignature ' + DriverName
+ ').status -eq ''UnknownError'') {exit 2} else {exit 0}"';
Exec('powershell.exe', Command, WorkingDir, SW_HIDE, ewWaitUntilTerminated, ResultCode)
Result := ResultCode = 0; Result := ResultCode = 0;
end; end;
@ -344,7 +357,7 @@ begin
Exit; Exit;
end; end;
if IsWindows7() and not IsUpdateInstalled('KB4474419') then if IsWindows7() and not IsDriverSignatureValid() then
begin begin
SuppressibleMsgBox(ExpandConstant('{cm:NotCompatibleWithWindows7}'), mbCriticalError, MB_OK, IDOK); SuppressibleMsgBox(ExpandConstant('{cm:NotCompatibleWithWindows7}'), mbCriticalError, MB_OK, IDOK);