4 |
|
Begin VB.Form Form1 |
5 |
|
BorderStyle = 3 'Fixed Dialog |
6 |
|
Caption = "i-scream Winhost" |
7 |
< |
ClientHeight = 5655 |
7 |
> |
ClientHeight = 1275 |
8 |
|
ClientLeft = 45 |
9 |
|
ClientTop = 330 |
10 |
|
ClientWidth = 4710 |
12 |
|
LinkTopic = "Form1" |
13 |
|
MaxButton = 0 'False |
14 |
|
MinButton = 0 'False |
15 |
< |
ScaleHeight = 5655 |
15 |
> |
ScaleHeight = 1275 |
16 |
|
ScaleWidth = 4710 |
17 |
|
ShowInTaskbar = 0 'False |
18 |
< |
StartUpPosition = 3 'Windows Default |
18 |
> |
StartUpPosition = 2 'CenterScreen |
19 |
> |
Visible = 0 'False |
20 |
|
Begin VB.CommandButton Hide |
21 |
|
Caption = "Hide Window" |
22 |
|
Height = 375 |
23 |
|
Left = 3120 |
24 |
< |
TabIndex = 7 |
25 |
< |
Top = 840 |
24 |
> |
TabIndex = 6 |
25 |
> |
Top = 480 |
26 |
|
Width = 1455 |
27 |
|
End |
28 |
|
Begin SysTray.SystemTray SystemTray |
37 |
|
Left = 2760 |
38 |
|
Top = 1800 |
39 |
|
End |
39 |
– |
Begin VB.TextBox Text4 |
40 |
– |
Height = 1575 |
41 |
– |
Left = 240 |
42 |
– |
MultiLine = -1 'True |
43 |
– |
ScrollBars = 2 'Vertical |
44 |
– |
TabIndex = 1 |
45 |
– |
Text = "nettest.frx":0742 |
46 |
– |
Top = 3000 |
47 |
– |
Width = 3975 |
48 |
– |
End |
40 |
|
Begin VB.CommandButton Reconfigure |
41 |
|
Caption = "Reconfigure with FilterManager" |
42 |
|
Height = 375 |
43 |
|
Left = 120 |
44 |
|
TabIndex = 0 |
45 |
< |
Top = 840 |
45 |
> |
Top = 480 |
46 |
|
Width = 2895 |
47 |
|
End |
48 |
|
Begin MSWinsockLib.Winsock TCPSock |
60 |
|
_Version = 393216 |
61 |
|
Protocol = 1 |
62 |
|
End |
72 |
– |
Begin VB.Label Label5 |
73 |
– |
Caption = "b e t a" |
74 |
– |
BeginProperty Font |
75 |
– |
Name = "MS Sans Serif" |
76 |
– |
Size = 24 |
77 |
– |
Charset = 0 |
78 |
– |
Weight = 700 |
79 |
– |
Underline = 0 'False |
80 |
– |
Italic = 0 'False |
81 |
– |
Strikethrough = 0 'False |
82 |
– |
EndProperty |
83 |
– |
Height = 615 |
84 |
– |
Left = 240 |
85 |
– |
TabIndex = 8 |
86 |
– |
Top = 120 |
87 |
– |
Width = 1815 |
88 |
– |
End |
63 |
|
Begin VB.Label Label2 |
64 |
|
Alignment = 1 'Right Justify |
65 |
|
Caption = "Next heartbeat:" |
66 |
|
Height = 255 |
67 |
|
Left = 2400 |
68 |
< |
TabIndex = 6 |
69 |
< |
Top = 480 |
68 |
> |
TabIndex = 5 |
69 |
> |
Top = 120 |
70 |
|
Width = 1455 |
71 |
|
End |
72 |
|
Begin VB.Label Label1 |
73 |
|
Alignment = 1 'Right Justify |
74 |
|
Caption = "Next UDP packet:" |
75 |
|
Height = 255 |
76 |
< |
Left = 2400 |
77 |
< |
TabIndex = 5 |
76 |
> |
Left = 120 |
77 |
> |
TabIndex = 4 |
78 |
|
Top = 120 |
79 |
|
Width = 1455 |
80 |
|
End |
83 |
|
Caption = "0" |
84 |
|
Height = 255 |
85 |
|
Left = 3960 |
86 |
< |
TabIndex = 4 |
87 |
< |
Top = 480 |
86 |
> |
TabIndex = 3 |
87 |
> |
Top = 120 |
88 |
|
Width = 615 |
89 |
|
End |
90 |
|
Begin VB.Label Label3 |
91 |
|
BorderStyle = 1 'Fixed Single |
92 |
|
Caption = "0" |
93 |
|
Height = 255 |
94 |
< |
Left = 3960 |
95 |
< |
TabIndex = 3 |
94 |
> |
Left = 1680 |
95 |
> |
TabIndex = 2 |
96 |
|
Top = 120 |
97 |
|
Width = 615 |
98 |
|
End |
101 |
|
Caption = "Status:" |
102 |
|
Height = 255 |
103 |
|
Left = 0 |
104 |
< |
TabIndex = 2 |
105 |
< |
Top = 1320 |
104 |
> |
TabIndex = 1 |
105 |
> |
Top = 960 |
106 |
|
Width = 4695 |
107 |
|
End |
108 |
|
End |
134 |
|
Dim connected As Boolean |
135 |
|
|
136 |
|
Dim CUpTime As New CUpTime |
137 |
+ |
Dim wksta As New CNetWksta |
138 |
|
|
139 |
|
Dim responseNumber As Integer |
140 |
|
|
141 |
|
Private Sub Form_Load() |
142 |
|
|
143 |
+ |
If App.PrevInstance Then |
144 |
+ |
x = MsgBox("There is already an i-scream Winhost running on this machine.", 48, "i-scream host already running") |
145 |
+ |
End |
146 |
+ |
End If |
147 |
+ |
|
148 |
|
protocolVersion = "1.1" |
149 |
|
|
150 |
|
Status.Caption = "Loading" |
151 |
|
Form1.Caption = "i-scream Winhost " & protocolVersion |
152 |
|
|
173 |
– |
Form1.Show |
174 |
– |
|
153 |
|
CUpTime.Init |
154 |
|
|
155 |
|
If CUpTime.isWin9x Then |
156 |
< |
x = MsgBox("Sorry, the i-scream host can only be used to monitor servers (i.e. not Win9x)", 48, "Not a server.") |
156 |
> |
x = MsgBox("Sorry, the i-scream host can only be used to monitor servers (i.e. not Win9x)", 48, "Not a server") |
157 |
|
End |
158 |
|
End If |
159 |
|
|
170 |
|
filterManagerHostname = Left$(buf, length) |
171 |
|
length = GetPrivateProfileInt("i-scream Winhost", "FilterManagerPort", 0, App.Path & "/winhost.ini") |
172 |
|
filterManagerTCPPort = length |
173 |
+ |
If filterManagerHostname = "" Then |
174 |
+ |
GoTo iniError |
175 |
+ |
End If |
176 |
|
On Error GoTo 0 |
177 |
|
skip: |
178 |
|
|
219 |
|
|
220 |
|
Form1.Visible = True |
221 |
|
Form1.SetFocus |
241 |
– |
|
222 |
|
|
223 |
|
End Sub |
224 |
|
|
247 |
|
' Remove linefeeds and returns from the line. |
248 |
|
response = Replace(response, Chr(13), "") |
249 |
|
response = Replace(response, Chr(10), "") |
250 |
< |
Text4.Text = Text4.Text & vbCrLf & response |
250 |
> |
'Text4.Text = Text4.Text & vbCrLf & response |
251 |
|
|
252 |
|
If connected = False Then |
253 |
|
' Perform TCP configuration (1.1) |
294 |
|
connected = True |
295 |
|
responseNumber = 0 |
296 |
|
TCPSock.Close |
297 |
< |
Text4.Text = Text4.Text & vbCrLf & " <closed>" |
297 |
> |
'Text4.Text = Text4.Text & vbCrLf & " <closed>" |
298 |
|
Status.Caption = "Configuration successful" |
299 |
|
Label3.Caption = UDPUpdateTime |
300 |
|
Label4.Caption = TCPUpdateTime |
393 |
|
memory& = memsts.dwAvailVirtual |
394 |
|
swapFree = memory& \ 1024 |
395 |
|
|
396 |
< |
uptime = GetTickCount \ 1000 |
396 |
> |
uptime = CUpTime.MilliSecs \ 1000 |
397 |
|
|
398 |
+ |
CUpTime.Capture |
399 |
+ |
cpu_time = CUpTime.CPUTime |
400 |
+ |
percent_idle = CUpTime.PercentIdle |
401 |
+ |
|
402 |
|
' build the contents of the XML packet |
403 |
|
xml = "<packet seq_no=""" & seqNo & """ machine_name=""" & machineName & """ date=""" & packetDate & """ type=""data"" ip=""" & LocalIP & """>" & _ |
404 |
|
"<os>" & _ |
410 |
|
"<processor>" & processorType & "</processor>" & _ |
411 |
|
"<uptime>" & uptime & "</uptime>" & _ |
412 |
|
"</os>" & _ |
413 |
+ |
"<cpu><idle>" & percent_idle & "</idle><user>" & cpu_time & "</user></cpu>" & _ |
414 |
|
"<memory><total>" & memTotal & "</total><free>" & memFree & "</free></memory>" & _ |
415 |
|
"<swap><total>" & swapTotal & "</total><free>" & swapFree & "</free></swap>" & _ |
416 |
|
"</packet>" |
417 |
< |
Text4.Text = Text4.Text + xml |
417 |
> |
'Text4.Text = Text4.Text + xml |
418 |
|
|
419 |
|
' Use the first winsock control to send a UDP packet. |
420 |
|
UDPSock.RemoteHost = filterHostname |