کد:
Function VmCheck() As Boolean
Dim str20 As String = Environment.UserName
Dim enumerator As IEnumerator
Dim str19 As String = "SELECT * FROM Win32_VideoController"
Dim arguments As Object() = New Object() {str19}
Dim copyBack As Boolean() = New Boolean() {True}
If copyBack(0) Then
str19 = CStr(Microsoft.VisualBasic.CompilerServices.Conversions.ChangeType(System.Runtime.CompilerServices.RuntimeHelpers.GetObjectValue(arguments(0)), GetType(String)))
End If
Dim objectValue As Object = System.Runtime.CompilerServices.RuntimeHelpers.GetObjectValue(Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Interaction.GetObject("winmgmts:", Nothing), Nothing, "ExecQuery", arguments, Nothing, Nothing, copyBack))
Try
enumerator = DirectCast(objectValue, IEnumerable).GetEnumerator
Do While enumerator.MoveNext
Dim left As Object = Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(System.Runtime.CompilerServices.RuntimeHelpers.GetObjectValue(enumerator.Current), Nothing, "Description", New Object(0 - 1) {}, Nothing, Nothing, Nothing)
If InStr(left, "VM Additions S3 Trio32/64") Then
VmCheck = True
MsgBox(left)
Exit Function
End If
If InStr(left, "S3 Trio32/64") Then
VmCheck = True
MsgBox(left)
Exit Function
End If
If InStr(left, "VirtualBox Graphics Adapter") Then
VmCheck = True
MsgBox(left)
Continue Do
Exit Function
End If
If InStr(left, "VMware SVGA II") Then
VmCheck = True
MsgBox(left)
Exit Function
Continue Do
End If
Loop
VmCheck = False
Exit Function
Finally
If TypeOf enumerator Is IDisposable Then
TryCast(enumerator, IDisposable).Dispose()
End If
End Try
End Function