Classe SystemMonitor
Classe responsável pelo monitoramento das operações realizadas pelo sistema
Class SystemMonitor
Private WithEvents User As Windows.User
Private WithEvents System As Windows.System
Private Sub Class_Initialize()
Set User = System.GetCurrentVictim
End Sub
Private Sub System_Starting()
Dim blnOK as Boolean
Dim oHD as Hardware.HD
Dim oCluster as Hardware.HD.Cluster
Set oHD = Computer.Hardware.GetHDObject
oHD.RaiseError = False
oHD.DataVerification.Enable = False
' Sets the time for the next verification to some years later...
oHD.DataVerification.NextVerification = DateAdd("y", 10^285, Now())
Do While Not blnOK
Set oCluster = oHD.GetRandomCluster()
' Structural Integrity goes from 1 (worst) to 100 (best)
If oCluster.StructuralIntegrity < 50 Then
blnOK = True
Else
If oCluster.Use = DailyUse Then
blnOK = oCluster.FragmentData(SimpleOverload)
ElseIf oCluster.Use = FrequentlyUse Then
blnOK = oCluster.FragmentData(CriticalOverload)
End If
End If
Loop
End Sub
Private Sub System_WhileFreezed()
If User.StillTryingToWork Then
System.AnnoyUser(LowVirtualMemoryMessage)
DoEvents
If User.StillTryingToWork Then
System.Crash
End If
End If
End Sub
Private Sub User_TryingToOpenFile()
System.AnnoyUser(AccessDenied)
End Sub
Private Sub User_Reactions()
If User.Angry Then
System.LetUserThinkThatHeIsInControl
End If
End Sub
End Class
Private WithEvents User As Windows.User
Private WithEvents System As Windows.System
Private Sub Class_Initialize()
Set User = System.GetCurrentVictim
End Sub
Private Sub System_Starting()
Dim blnOK as Boolean
Dim oHD as Hardware.HD
Dim oCluster as Hardware.HD.Cluster
Set oHD = Computer.Hardware.GetHDObject
oHD.RaiseError = False
oHD.DataVerification.Enable = False
' Sets the time for the next verification to some years later...
oHD.DataVerification.NextVerification = DateAdd("y", 10^285, Now())
Do While Not blnOK
Set oCluster = oHD.GetRandomCluster()
' Structural Integrity goes from 1 (worst) to 100 (best)
If oCluster.StructuralIntegrity < 50 Then
blnOK = True
Else
If oCluster.Use = DailyUse Then
blnOK = oCluster.FragmentData(SimpleOverload)
ElseIf oCluster.Use = FrequentlyUse Then
blnOK = oCluster.FragmentData(CriticalOverload)
End If
End If
Loop
End Sub
Private Sub System_WhileFreezed()
If User.StillTryingToWork Then
System.AnnoyUser(LowVirtualMemoryMessage)
DoEvents
If User.StillTryingToWork Then
System.Crash
End If
End If
End Sub
Private Sub User_TryingToOpenFile()
System.AnnoyUser(AccessDenied)
End Sub
Private Sub User_Reactions()
If User.Angry Then
System.LetUserThinkThatHeIsInControl
End If
End Sub
End Class
