Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.5 KiB

  1. Attribute VB_Name = "Utility"
  2. Option Explicit
  3. 'This is a total hack, but it works
  4. Public LatestKeyhole As String
  5. Public Type prop
  6. Name As String
  7. Value As Variant
  8. End Type
  9. 'Public Function CreateInstance(wsoServices As DIWbemServices, classname As String, Props() As prop, n As Node) As Integer
  10. ' 'This function has not been tested yet.
  11. '
  12. ' 'RETURN:
  13. ' 'TRUE : Succeeded
  14. ' 'FALSE : Failed
  15. '
  16. ' CreateInstance = False
  17. '
  18. ' On Error Resume Next
  19. ' Dim c As DWbemClassObject
  20. ' Dim r As DIWbemCallResult
  21. ' Dim s As String
  22. ' Dim i As Integer
  23. '
  24. ' wsoServices.GetObject classname, 0, Nothing, c, Nothing
  25. ' If CheckError(Err.Number, n, "Getobject: " & classname) Then Exit Function
  26. '
  27. ' For i = LBound(Props) To UBound(Props)
  28. ' If Props(i).Name <> "" Then
  29. ' c.Put Props(i).Name, 0, Props(i).Value, 0
  30. ' If CheckError(Err.Number, n, "Put: " & Props(i).Name) Then Exit Function
  31. ' End If
  32. ' Next i
  33. '
  34. ' wsoServices.PutInstance c, 0, Nothing, r
  35. ' If CheckError(Err.Number, n, "PutInstance: " & classname) Then Exit Function
  36. ' r.GetResultString -1, s
  37. ' LatestKeyhole = s
  38. '
  39. ' CreateInstance = True
  40. 'End Function
  41. '
  42. Public Function WaitSecs(PauseTime As Integer)
  43. 'Should pause for X seconds
  44. Dim Start
  45. Start = Timer
  46. Do While Timer < Start + PauseTime
  47. DoEvents
  48. Loop
  49. 'Debug.Print "Paused for " & PauseTime & " seconds."
  50. End Function