From d364bab970a0b61c00145b8653cd3add64669183 Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Sun, 24 Dec 2023 11:57:02 +0300 Subject: [PATCH] Installer: Windows 7: Use "powershell.exe Get-AuthenticodeSignature fortfw.sys" to check installed KB4474419 --- deploy/FortFirewall.iss | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/deploy/FortFirewall.iss b/deploy/FortFirewall.iss index caa26176..72914e7b 100644 --- a/deploy/FortFirewall.iss +++ b/deploy/FortFirewall.iss @@ -160,11 +160,24 @@ begin Result := (Version.Major = 6) and (Version.Minor = 1); end; -function IsUpdateInstalled(KB: String): Boolean; +function IsDriverSignatureValid(): Boolean; var + DriverPath: String; + DriverName: String; + WorkingDir: String; + Command: String; ResultCode: Integer; 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; end; @@ -344,7 +357,7 @@ begin Exit; end; - if IsWindows7() and not IsUpdateInstalled('KB4474419') then + if IsWindows7() and not IsDriverSignatureValid() then begin SuppressibleMsgBox(ExpandConstant('{cm:NotCompatibleWithWindows7}'), mbCriticalError, MB_OK, IDOK);