Jump to content

need advice which firewall file to use


Bettylou
 Share

Recommended Posts


Which file is the best file to use?

I have 2 firewall files that are part of a bigger program. There are 2 "IF" commands that are the difference between the two files. Both files give the correct output.

If $OFWall = False Then
If $FW <> 0 Then

Local $OFWall
If @OSVersion = "WIN_XP" Then
$oWMI = ObjGet("winmgmts:\\localhost\root\SecurityCenter")
Else
$oWMI = ObjGet("winmgmts:\\localhost\root\SecurityCenter2")
EndIf
$colItems = $oWMI.ExecQuery("Select * from FirewallProduct")
For $objFirewallProduct In $colItems
$OFWall = $objFirewallProduct.DisplayName
Next
If $OFWall = False Then
    _WinFirewall()
ElseIf $OFWall = "Privatefirewall" Then
FileWrite($File, "Private Firewall" & @CRLF)
ElseIf $OFWall = "COMODO Firewall" Then
FileWrite($File, "Comodo Firewall" & @CRLF)
ElseIf $OFWall = "ZoneAlarm Free Firewall Firewall" Then
FileWrite($File, "ZoneAlarm Free Firewall" & @CRLF)
Else
FileWrite($File, $OFWall & @CRLF)
EndIf

Func _WinFirewall()
    Local $FW = RegRead("HKLM\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile", "EnableFirewall")
If $FW <> 0 Then
FileWrite($File,  "Windows Firewall Enabled!" & @CRLF)
Else
FileWrite($File,  "Windows Firewall *Disabled*" & @CRLF)
EndIf
EndFunc
Local $FW = RegRead("HKLM\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile", "EnableFirewall")
If $FW <> 0 Then
$FW = "Enabled!"
Else
$FW = "*Disabled*"
EndIf
Local $OFWall
If @OSVersion = "WIN_XP" Then
$oWMI = ObjGet("winmgmts:\\localhost\root\SecurityCenter")
Else
$oWMI = ObjGet("winmgmts:\\localhost\root\SecurityCenter2")
EndIf
$colItems = $oWMI.ExecQuery("Select * from FirewallProduct")
For $objFirewallProduct In $colItems
$OFWall = $objFirewallProduct.DisplayName
Next
If $OFWall = False Then
FileWrite($hLogFile, "Windows Firewall is " & $FW & @CRLF)
ElseIf $OFWall = "Privatefirewall" Then
FileWrite($hLogFile, "Private Firewall" & @CRLF)
ElseIf $OFWall = "COMODO Firewall" Then
FileWrite($hLogFile, "Comodo Firewall" & @CRLF)
ElseIf $OFWall = "ZoneAlarm Free Firewall Firewall" Then
FileWrite($hLogFile, "ZoneAlarm Free Firewall" & @CRLF)
Else
FileWrite($hLogFile, $OFWall & @CRLF)
EndIf

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...