4 |
|
Begin VB.Form Form1 |
5 |
|
BorderStyle = 3 'Fixed Dialog |
6 |
|
Caption = "i-scream Winhost" |
7 |
< |
ClientHeight = 1185 |
7 |
> |
ClientHeight = 1380 |
8 |
|
ClientLeft = 45 |
9 |
|
ClientTop = 330 |
10 |
< |
ClientWidth = 4710 |
10 |
> |
ClientWidth = 4635 |
11 |
|
Icon = "nettest.frx":0000 |
12 |
|
LinkTopic = "Form1" |
13 |
|
MaxButton = 0 'False |
14 |
|
MinButton = 0 'False |
15 |
< |
ScaleHeight = 1185 |
16 |
< |
ScaleWidth = 4710 |
15 |
> |
ScaleHeight = 1380 |
16 |
> |
ScaleWidth = 4635 |
17 |
|
ShowInTaskbar = 0 'False |
18 |
|
StartUpPosition = 2 'CenterScreen |
19 |
|
Visible = 0 'False |
20 |
|
Begin VB.CommandButton Command1 |
21 |
|
Caption = "more" |
22 |
|
Height = 255 |
23 |
< |
Left = 3960 |
23 |
> |
Left = 3885 |
24 |
|
TabIndex = 8 |
25 |
< |
Top = 840 |
25 |
> |
Top = 1035 |
26 |
|
Width = 615 |
27 |
|
End |
28 |
|
Begin VB.TextBox Text1 |
32 |
|
MultiLine = -1 'True |
33 |
|
ScrollBars = 2 'Vertical |
34 |
|
TabIndex = 7 |
35 |
< |
Top = 1200 |
36 |
< |
Width = 4455 |
35 |
> |
Top = 1440 |
36 |
> |
Width = 4395 |
37 |
|
End |
38 |
|
Begin VB.CommandButton Hide |
39 |
|
Caption = "hide" |
40 |
|
Height = 255 |
41 |
< |
Left = 3960 |
41 |
> |
Left = 3225 |
42 |
|
TabIndex = 6 |
43 |
< |
Top = 480 |
43 |
> |
Top = 1035 |
44 |
|
Width = 615 |
45 |
|
End |
46 |
|
Begin SysTray.SystemTray SystemTray |
60 |
|
Height = 375 |
61 |
|
Left = 840 |
62 |
|
TabIndex = 0 |
63 |
< |
Top = 3480 |
63 |
> |
Top = 3555 |
64 |
|
Width = 2895 |
65 |
|
End |
66 |
|
Begin MSWinsockLib.Winsock TCPSock |
78 |
|
_Version = 393216 |
79 |
|
Protocol = 1 |
80 |
|
End |
81 |
+ |
Begin VB.Image Image1 |
82 |
+ |
Height = 900 |
83 |
+ |
Left = 2400 |
84 |
+ |
Picture = "nettest.frx":08CA |
85 |
+ |
Top = 90 |
86 |
+ |
Width = 2100 |
87 |
+ |
End |
88 |
|
Begin VB.Label Label2 |
89 |
|
Alignment = 1 'Right Justify |
90 |
|
Caption = "Next heartbeat:" |
91 |
|
Height = 255 |
92 |
|
Left = 120 |
93 |
|
TabIndex = 5 |
94 |
< |
Top = 480 |
94 |
> |
Top = 645 |
95 |
|
Width = 1455 |
96 |
|
End |
97 |
|
Begin VB.Label Label1 |
100 |
|
Height = 255 |
101 |
|
Left = 120 |
102 |
|
TabIndex = 4 |
103 |
< |
Top = 120 |
103 |
> |
Top = 165 |
104 |
|
Width = 1455 |
105 |
|
End |
106 |
|
Begin VB.Label Label4 |
109 |
|
Height = 255 |
110 |
|
Left = 1680 |
111 |
|
TabIndex = 3 |
112 |
< |
Top = 480 |
112 |
> |
Top = 645 |
113 |
|
Width = 615 |
114 |
|
End |
115 |
|
Begin VB.Label Label3 |
118 |
|
Height = 255 |
119 |
|
Left = 1680 |
120 |
|
TabIndex = 2 |
121 |
< |
Top = 120 |
121 |
> |
Top = 165 |
122 |
|
Width = 615 |
123 |
|
End |
124 |
|
Begin VB.Label Status |
127 |
|
Height = 255 |
128 |
|
Left = 0 |
129 |
|
TabIndex = 1 |
130 |
< |
Top = 840 |
131 |
< |
Width = 3855 |
130 |
> |
Top = 1035 |
131 |
> |
Width = 3180 |
132 |
|
End |
133 |
|
End |
134 |
|
Attribute VB_Name = "Form1" |
161 |
|
|
162 |
|
Dim protocolVersion As String |
163 |
|
Dim connected As Boolean |
164 |
+ |
Dim heartBeating As Boolean |
165 |
|
|
166 |
|
Dim CUpTime As New CUpTime |
167 |
|
Dim wksta As New CNetWksta |
175 |
|
' Toggle visibility of the debug output. |
176 |
|
|
177 |
|
If windowBig Then |
178 |
< |
Form1.Height = 1500 |
178 |
> |
Form1.Height = 1755 |
179 |
|
windowBig = False |
180 |
|
Else |
181 |
< |
Form1.Height = 4350 |
181 |
> |
Form1.Height = 4380 |
182 |
|
windowBig = True |
183 |
|
End If |
184 |
|
|
257 |
|
SystemTray.Icon = Val(Form1.Icon) |
258 |
|
End Sub |
259 |
|
|
252 |
– |
Private Sub Image1_Click() |
260 |
|
|
254 |
– |
End Sub |
255 |
– |
|
261 |
|
Private Sub Reconfigure_Click() |
262 |
|
' establish a TCP connection to a filtermanager |
263 |
< |
connected = False |
264 |
< |
TCPSock.Close |
265 |
< |
TCPSock.Connect filterManagerHostname, filterManagerTCPPort |
263 |
> |
If Not heartBeating Then |
264 |
> |
connected = False |
265 |
> |
TCPSock.Close |
266 |
> |
TCPSock.Connect filterManagerHostname, filterManagerTCPPort |
267 |
> |
Else |
268 |
> |
Status.Caption = "Cannot reconfigure while heartbeating" |
269 |
> |
End If |
270 |
|
End Sub |
271 |
|
|
272 |
|
|
372 |
|
End Select |
373 |
|
Else |
374 |
|
' Perform a heartbeat (1.1) |
375 |
+ |
heartBeating = True |
376 |
|
On Error GoTo heartbeatError |
377 |
|
Select Case responseNumber |
378 |
|
Case 1: |
389 |
|
Text1.Text = Text1.Text & response & vbCrLf |
390 |
|
TCPSock.SendData lastModified & vbCrLf |
391 |
|
Case 4: |
392 |
< |
If Not response = "OK" Then GoTo heartbeatError |
392 |
> |
If Not response = "OK" Then |
393 |
> |
heartBeating = False |
394 |
> |
Reconfigure_Click |
395 |
> |
End If |
396 |
|
Text1.Text = Text1.Text & response & vbCrLf |
397 |
|
TCPSock.SendData "ENDHEARTBEAT" & vbCrLf |
398 |
|
Case 5: |
408 |
|
Exit Sub |
409 |
|
|
410 |
|
configError: |
411 |
< |
Status.Caption = "FAILED to get configuration" |
411 |
> |
heartBeating = False |
412 |
> |
Status.Caption = "FAILED to get configuration from the server" |
413 |
|
Exit Sub |
414 |
|
heartbeatError: |
415 |
+ |
heartBeating = False |
416 |
|
Status.Caption = "Heatbeat FAILED" |
417 |
|
Exit Sub |
418 |
|
End Sub |
481 |
|
cpu_time = CUpTime.CPUTime |
482 |
|
percent_idle = CUpTime.PercentIdle |
483 |
|
|
469 |
– |
'' Causes numbers to be too big :-/ |
470 |
– |
'uptime = CUpTime.MilliSecs \ 1000 |
471 |
– |
|
484 |
|
'' Doesn't work after 47 days :-/ |
485 |
|
'uptime = GetTickCount \ 1000 |
486 |
|
|
487 |
< |
secondsRunning = secondsRunning + UDPUpdateTime |
488 |
< |
uptime = secondsRunning |
487 |
> |
'secondsRunning = secondsRunning + UDPUpdateTime |
488 |
> |
'uptime = secondsRunning |
489 |
|
|
490 |
+ |
uptime = CUpTime.MilliSecs / 1000# |
491 |
+ |
|
492 |
|
userCount = wksta.LoggedOnUsers |
493 |
|
|
494 |
|
' build the contents of the XML packet |
496 |
|
"<os>" & _ |
497 |
|
"<netbios_name>" & netbiosName & "</netbios_name>" & _ |
498 |
|
"<name>" & osName & "</name>" & _ |
499 |
< |
"<version>" & osVersionMajor & "</version>" & _ |
499 |
> |
"<version>" & osVersionMajor & "." & osVersionMinor & "</version>" & _ |
500 |
|
"<release>" & osBuild & "</release>" & _ |
501 |
< |
"<platform>" & osName & "</platform>" & _ |
488 |
< |
"<minor_version>" & osVersionMinor & "</minor_version>" & _ |
489 |
< |
"<processor>" & processorType & "</processor>" & _ |
501 |
> |
"<platform>" & processorType & "</platform>" & _ |
502 |
|
"<uptime>" & uptime & "</uptime>" & _ |
503 |
|
"</os>" & _ |
504 |
|
"<users><count>" & userCount & "</count></users>" & _ |