tdf#84553 Correctly handle failures while getting a WMI Object.
The output before this patch : checking for active Antivirus software... C:\cygwin\home\tdf\lode\jenkins\workspace\gerrit_windows\antivirusDetection.vbs(1, 1) (null): 0x8004100E found The link for which is : https://ci.libreoffice.org/job/gerrit_windows/57035/consoleFull Change-Id: I714442739a8daf132e95b9f6a750aa7abab3561e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88465 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
parent
a7d1fed245
commit
8d8f62852a
2 changed files with 38 additions and 28 deletions
|
@ -1,4 +1,8 @@
|
|||
On Error Resume Next
|
||||
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\SecurityCenter2")
|
||||
If objWMIService is Nothing Then
|
||||
Wscript.StdOut.Write "NULL"
|
||||
Else
|
||||
Set installedAntiviruses = objWMIService.ExecQuery("Select * from AntivirusProduct")
|
||||
'Iterates through all the antivirus software,retrieved by the WMI query,present on the system and prints only the ones that are active
|
||||
'this is done by checking the 12th bit of the productState property of the antivirus
|
||||
|
@ -15,5 +19,7 @@ For Each antivirus in installedAntiviruses
|
|||
Next
|
||||
If count = 0 Then
|
||||
Wscript.StdOut.Write "NOT_FOUND"
|
||||
Else Wscript.Echo list
|
||||
Else
|
||||
Wscript.Echo list
|
||||
End if
|
||||
End if
|
|
@ -12980,6 +12980,7 @@ dnl ===================================================================
|
|||
if test $_os = WINNT ; then
|
||||
AC_MSG_CHECKING([for active Antivirus software])
|
||||
ANTIVIRUS_LIST=`cscript.exe //Nologo $SRC_ROOT/antivirusDetection.vbs`
|
||||
if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
|
||||
if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
|
||||
AC_MSG_RESULT([found])
|
||||
EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
|
||||
|
@ -12999,6 +13000,9 @@ if test $_os = WINNT ; then
|
|||
else
|
||||
AC_MSG_RESULT([not found])
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT([n/a])
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl ===================================================================
|
||||
|
|
Loading…
Reference in a new issue