📄 frmoptions.frm
字号:
cINIFile.Key = "ADP"
If Check2.Value = 1 Then
cINIFile.Value = "YES"
Check4.Value = 1
Else
cINIFile.Value = "NO"
Check4.Value = 0
End If
Check2.Enabled = True
'updateCheckBoxex
End Sub
Private Sub Check3_Click()
Check3.Enabled = False
cINIFile.Section = "ALLOWALL"
cINIFile.Key = "AD"
If Check3.Value = 1 Then
cINIFile.Value = "YES"
Check1.Value = 1
Else
cINIFile.Value = "NO"
Check1.Value = 0
End If
Check3.Enabled = True
'updateCheckBoxex
End Sub
Private Sub Check4_Click()
Check4.Enabled = False
cINIFile.Section = "ALLOWALL"
cINIFile.Key = "ADP"
If Check4.Value = 1 Then
cINIFile.Value = "YES"
Check2.Value = 1
Else
cINIFile.Value = "NO"
Check2.Value = 0
End If
Check4.Enabled = True
'updateCheckBoxex
End Sub
Private Sub Check5_Click()
' Automatically allow trusted applications yes/no
Check5.Enabled = False
cINIFile.Section = "ALLOWALL"
cINIFile.Key = "AP"
If Check5.Value = 1 Then
cINIFile.Value = "YES"
Else
cINIFile.Value = "NO"
End If
Check5.Enabled = True
End Sub
Private Sub Check6_Click()
' Enable/Disable Logs
Check6.Enabled = False
cINIFile.Section = "ALLOWALL"
cINIFile.Key = "AL"
If Check6.Value = 1 Then
cINIFile.Value = "YES"
Else 'NOT CHECK5.VALUE...
cINIFile.Value = "NO"
End If
Check6.Enabled = True
End Sub
Private Sub Check7_Click()
' Prompt for file has changed crc32
Check7.Enabled = False
cINIFile.Section = "ALLOWALL"
cINIFile.Key = "NC"
If Check7.Value = 1 Then
cINIFile.Value = "YES"
Else 'NOT CHECK5.VALUE...
cINIFile.Value = "NO"
End If
Check7.Enabled = True
End Sub
Private Sub cmdFileCheck_Click()
frmMainFileCheck.Show
End Sub
Private Sub cmdModify_Click()
Dim idNum As Long
Dim strTemp As String
On Error Resume Next
' IP Rules Menu
If OptionsListView.Visible Then
idNum = OptionsListView.SelectedItem.Index
If idNum <> 0 Then
strTemp = OptionsListView.SelectedItem.Text
If LenB(strTemp) = 0 Then
strTemp = Mid$(OptionsListView.SelectedItem.SubItems(1), InStrRev(OptionsListView.SelectedItem.SubItems(1), "\") + 1)
End If
mnuRulesTRUST.Caption = "TRUST (" & strTemp & ")"
mnuRulesBLOCK.Caption = "BLOCK (" & strTemp & ")"
mnuRulesASK.Caption = "ASK (" & strTemp & ")"
PopupMenu mnuRules
Exit Sub
End If
End If
' Port Rules Menu
If frmOptionsListView.Visible Then
idNum = frmOptionsListView.SelectedItem.Index
If idNum <> 0 Then
strTemp = frmOptionsListView.SelectedItem.Text
If LenB(strTemp) = 0 Then
strTemp = Mid$(frmOptionsListView.SelectedItem.SubItems(1), InStrRev(frmOptionsListView.SelectedItem.SubItems(1), "\") + 1)
End If
mnuRulesTRUST.Caption = "TRUST (" & strTemp & ")"
mnuRulesBLOCK.Caption = "BLOCK (" & strTemp & ")"
mnuRulesASK.Caption = "ASK (" & strTemp & ")"
PopupMenu mnuRules
End If
End If
On Error GoTo 0
End Sub
Private Sub cmdOK_Click()
Unload Me
End Sub
Private Sub Command1_Click(Index As Integer)
Select Case Index
Case 0
'Case 0 Ip Address
If LenB(OptionsTxt.Text) = 0 Or OptionsTxt.Text = " " Then
GoTo Nothing_Enterd
End If
With cINIFile
.Section = "NETWORKING"
.Key = OptionsTxt.Text
.Value = "1"
End With
Set Item = OptionsListView.ListItems.Add()
With Item
.Text = OptionsTxt.Text
.SubItems(1) = "ASK"
End With
Case 1
'Nothing
Case 2
'Case 2 Port Number
If LenB(frmOptionsTxt.Text) = 0 Or frmOptionsTxt.Text = " " Then
GoTo Nothing_Enterd
End If
With cINIFile
.Section = "NETWORKING"
.Key = frmOptionsTxt.Text
.Value = "1"
End With
Set Item = frmOptionsListView.ListItems.Add()
With Item
.Text = frmOptionsTxt.Text
.SubItems(1) = "ASK"
End With
Nothing_Enterd:
' Used if nothing is put in text box
End Select
End Sub
Private Sub Form_Load()
'center the form
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
'frmMain.lblShowApplications.Caption = "Please Wait Loading Rules..."
' Get Rules for IP Address
cINIFile.Section = "NETWORKING"
StrParse = Split(cINIFile.INISection, vbNullChar)
For i = 0 To UBound(StrParse) - 1
cINIFile.Key = StrParse(i)
If LenB(cINIFile.Value) Then
Set Item = OptionsListView.ListItems.Add()
With Item
.Text = GetFileDescription(StrParse(i))
.SubItems(1) = GetRule(cINIFile.Value)
End With 'Item
End If
tmpFileName = Mid$(StrParse(i), InStrRev(StrParse(i), "\") + 1)
If Len(tmpFileName) > 8 Then
Item.Text = tmpFileName
End If
On Error Resume Next
If LenB(Item.Text) = 0 Then
OptionsListView.ListItems.Remove Item.Index
End If
If LenB(tmpFileName) = 0 Then
Item.Text = "(No Application Name)"
End If
If LenB(Item.SubItems(1)) = 0 Then
Item.SubItems(1) = "(Uknown)"
End If
If LenB(Item.SubItems(1)) = 0 Then
With Item
.Text = vbNullString
.SubItems(1) = vbNullString
.SubItems(2) = vbNullString
End With
End If
Next i
' Get Rules for Port Number
cINIFile.Section = "NETWORKING"
StrParse = Split(cINIFile.INISection, vbNullChar)
For i = 0 To UBound(StrParse) - 1
cINIFile.Key = StrParse(i)
If LenB(cINIFile.Value) Then
Set Item = frmOptionsListView.ListItems.Add()
With Item
.Text = GetFileDescription(StrParse(i))
.SubItems(1) = GetRule(cINIFile.Value)
End With 'Item
End If
tmpFileName = Mid$(StrParse(i), InStrRev(StrParse(i), "\") + 1)
If Len(tmpFileName) < 8 Then
Item.Text = tmpFileName
End If
On Error Resume Next
If LenB(Item.Text) = 0 Then
frmOptionsListView.ListItems.Remove Item.Index
End If
If LenB(tmpFileName) = 0 Then
Item.Text = "(Uknown)"
End If
If LenB(Item.SubItems(1)) = 0 Then
Item.SubItems(1) = "(Uknown)"
End If
If LenB(Item.SubItems(1)) = 0 Then
With Item
.Text = vbNullString
.SubItems(1) = vbNullString
.SubItems(2) = vbNullString
End With
End If
Next i
' Get IP Rules for check boxes
cINIFile.Section = "ALLOWALL"
cINIFile.Key = "AD"
If cINIFile.Value = "YES" Then
Check1.Value = 1
Check3.Value = 1
End If
' Get Port Rules for check boxes
cINIFile.Section = "ALLOWALL"
cINIFile.Key = "ADP"
If cINIFile.Value = "YES" Then
Check2.Value = 1
Check4.Value = 1
End If
' Get Trusted applications check box
cINIFile.Section = "ALLOWALL"
cINIFile.Key = "AP"
If cINIFile.Value = "YES" Then
Check5.Value = 1
End If
' Get Logs check box
cINIFile.Section = "ALLOWALL"
cINIFile.Key = "AL"
If cINIFile.Value = "YES" Then
Check6.Value = 1
End If
' Prompt for file has changed crc32
cINIFile.Section = "ALLOWALL"
cINIFile.Key = "NC"
If cINIFile.Value = "YES" Then
Check7.Value = 1
End If
' Load Port List and add to list view
On Error Resume Next
Open App.Path & "\PortInfo.txt" For Input As #204
Do
Input #204, PortN, Description
Set Item = lvwPort.ListItems.Add()
With Item
.Text = PortN
.SubItems(1) = Description
End With 'Item
DoEvents
Loop Until EOF(204)
Close #204
On Error GoTo 0
End Sub
Private Sub frmOptionsListView_MouseDown(Button As Integer, _
Shift As Integer, _
X As Single, _
Y As Single)
If Button = 2 Then ' if the mousebutton 2 is pressed (right)
cmdModify_Click ' then it calls the menu which is hidden to be shown
End If ' at the cordinates of the mousepointer (x,y)
End Sub
Public Function GetRule(ByVal Value As String) As String
Select Case Value
Case "" 'Nothing
GetRule = "No Set"
Case "0"
GetRule = "TRUST"
Case "1"
GetRule = "ASK"
Case "2"
GetRule = "BLOCK"
Case Else
GetRule = Value
End Select
End Function
Private Sub mnuRulesASK_Click()
'Add rule to ask this
If OptionsListView.Visible Then
With cINIFile
.Section = "NETWORKING"
.Key = OptionsListView.SelectedItem
.Value = "1"
End With 'cINIFile
OptionsListView.SelectedItem.SubItems(1) = "ASK"
Else
If frmOptionsListView.Visible Then
With cINIFile
.Section = "NETWORKING"
.Key = frmOptionsListView.SelectedItem
.Value = "1"
End With 'cINIFile
frmOptionsListView.SelectedItem.SubItems(1) = "ASK"
End If
End If
End Sub
Private Sub mnuRulesBLOCK_Click()
'Add rule to ask this
If OptionsListView.Visible Then
With cINIFile
.Section = "NETWORKING"
.Key = OptionsListView.SelectedItem
.Value = "2"
End With 'cINIFile
OptionsListView.SelectedItem.SubItems(1) = "BLOCK"
Else
If frmOptionsListView.Visible Then
With cINIFile
.Section = "NETWORKING"
.Key = frmOptionsListView.SelectedItem
.Value = "2"
End With 'cINIFile
frmOptionsListView.SelectedItem.SubItems(1) = "BLOCK"
End If
End If
End Sub
Private Sub mnuRulesTRUST_Click()
'Add rule to ask this
If OptionsListView.Visible Then
With cINIFile
.Section = "NETWORKING"
.Key = OptionsListView.SelectedItem
.Value = "0"
End With 'cINIFile
OptionsListView.SelectedItem.SubItems(1) = "TRUST"
Else
If frmOptionsListView.Visible Then
With cINIFile
.Section = "NETWORKING"
.Key = frmOptionsListView.SelectedItem
.Value = "0"
End With 'cINIFile
frmOptionsListView.SelectedItem.SubItems(1) = "TRUST"
End If
End If
End Sub
Private Sub OptionsListView_MouseDown(Button As Integer, _
Shift As Integer, _
X As Single, _
Y As Single)
If Button = 2 Then ' if the mousebutton 2 is pressed (right)
cmdModify_Click ' then it calls the menu which is hidden to be shown
End If ' at the cordinates of the mousepointer (x,y)
End Sub
Private Sub Picture1_Click(Index As Integer)
Me.Height = "7335"
Select Case Index
Case 0
Frame2.Caption = "提示信息 (IP 地址):"
Label3.Caption = "IP地址可以设置是否阻止连接。IP地址是基本的数据传输协议。"
Case 1
Frame2.Caption = "提示信息 (Disable Rules Set For Inbound Traffic):"
Label3.Caption = "If Checked then All Rules that have been set for an IP Address will ignored."
Case 2
Frame2.Caption = "提示信息 (Disable Traffic Logs):"
Label3.Caption = "Stops loging traffic. NOTE: All Security Issues will be continue to be loged."
Case 3
Frame2.Caption = "提示信息 (Allow Trustd applications):"
Label3.Caption = "If Checked then All applications known to be safe will be automatically granted access without notification. (If the application is useing a security risk (Port or IP) then the user will be prompted before access is granted."
Case 4
Frame2.Caption = "提示信息 (Set Rule for both Inbound And Outbound Traffic):"
Label3.Caption = "If Checked then rules set for Blocking will be applied to both Inbound And OutBound."
Case 5
Frame2.Caption = "提示信息 (Port Numbers):"
Label3.Caption = "The Port Number should be set to Block traffic based on the Port Number set."
Case 6
Frame2.Caption = "提示信息 (Monitor application):"
Label3.Caption = "This option will alert your if a application has been modified in any way letting you allow the change or restore the application back to the way it was originally."
Case 7
Frame2.Caption = "提示信息 (Disable Rules Set for Ports):"
Label3.Caption = "If Checked then All Rules that have been set for Ports will ignored."
Case 8
Frame2.Caption = "提示信息 (Rules Active for Outbound Traffic):"
Label3.Caption = "If Checked then All Rules that have been set for blocking Port Number based on Port Number will be Saved."
Case 9
Frame2.Caption = "提示信息 (Set Rule for both Inbound And Outbound Traffic):"
Label3.Caption = "If Checked then rules set for Blocking will be applied to both Inbound And OutBound."
End Select
End Sub
Private Sub Picture2_Click()
Me.Height = "5400"
End Sub
Private Sub SSTab1_Click(PreviousTab As Integer)
Select Case SSTab1.Tab
Case 0 'IP Rules
cmdModify.Enabled = True
OptionsListView.Visible = True
frmOptionsListView.Visible = False
Case 1 'Port Rules
cmdModify.Enabled = True
frmOptionsListView.Visible = True
OptionsListView.Visible = False
Case 2 'Configure
cmdModify.Enabled = False
Case 3 'Ports
cmdModify.Enabled = False
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -