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.

138 lines
4.0 KiB

  1. on error resume next
  2. 'First pass - on mutable object
  3. WScript.Echo "************************"
  4. WScript.Echo "PASS 1 - SWbemObjectPath"
  5. WScript.Echo "************************"
  6. WScript.Echo ""
  7. Set Path = CreateObject("WbemScripting.SWbemObjectPath")
  8. WScript.Echo "Expect """""
  9. WScript.Echo """" & Path.DisplayName & """"
  10. WScript.Echo ""
  11. Path.DisplayName = "winmgmts:{impersonationlevel=impersonate,authenticationLevel=pkt}!root/cimv2:Win32_Wibble.Name=10,Zip=7"
  12. WScript.Echo "Initial Value"
  13. WScript.Echo Path.DisplayName
  14. WScript.Echo ""
  15. Path.DisplayName = "winmgmts:{"
  16. WScript.Echo "Single brace"
  17. WScript.Echo Path.DisplayName
  18. WScript.Echo ""
  19. if err <> 0 then
  20. WScript.Echo "Got expected error: ", Err.Description, Err.Source, Err.Number
  21. WScript.Echo ""
  22. err.clear
  23. end if
  24. Path.DisplayName = "winmgmts:{impersonationLevel=impersonate}}!root/cimv2:Win32_Wibble.Name=10,Zip=7"
  25. WScript.Echo "Unbalanced braces"
  26. WScript.Echo Path.DisplayName
  27. WScript.Echo ""
  28. if err <> 0 then
  29. WScript.Echo "Got expected error: ", Err.Description, Err.Source, Err.Number
  30. WScript.Echo ""
  31. err.clear
  32. end if
  33. Path.DisplayName = "winmgmts:{authenticationLevel=impersonate}!root/cimv2:Win32_Wibble.Name=10,Zip=7"
  34. WScript.Echo "Inappropriate authentication level"
  35. WScript.Echo Path.DisplayName
  36. WScript.Echo ""
  37. if err <> 0 then
  38. WScript.Echo "Got expected error: ", Err.Description, Err.Source, Err.Number
  39. WScript.Echo ""
  40. err.clear
  41. end if
  42. Path.DisplayName = "winmgmts:{impersonationLevel=impersonate,impersonationLevel=identify}!root/cimv2:Win32_Wibble.Name=10,Zip=7"
  43. WScript.Echo "Attempt to set impersonation level twice"
  44. WScript.Echo Path.DisplayName
  45. WScript.Echo ""
  46. if err <> 0 then
  47. WScript.Echo "Got expected error: ", Err.Description, Err.Source, Err.Number
  48. WScript.Echo ""
  49. err.clear
  50. end if
  51. Path.DisplayName = "winmgmts:{authenticationLevel=default,authenticationLevel=pktPrivacy}!root/cimv2:Win32_Wibble.Name=10,Zip=7"
  52. WScript.Echo "Attempt to set authentication level twice"
  53. WScript.Echo Path.DisplayName
  54. WScript.Echo ""
  55. if err <> 0 then
  56. WScript.Echo "Got expected error: ", Err.Description, Err.Source, Err.Number
  57. WScript.Echo ""
  58. err.clear
  59. end if
  60. Path.DisplayName = "winmgmts:{authenticationLevel=none,}!"
  61. WScript.Echo "Trailing comma"
  62. WScript.Echo Path.DisplayName
  63. WScript.Echo ""
  64. if err <> 0 then
  65. WScript.Echo "Got expected error: ", Err.Description, Err.Source, Err.Number
  66. WScript.Echo ""
  67. err.clear
  68. end if
  69. Path.DisplayName = "winmgmts:{authenticationLevel=call,impersonationLevel=identify,}"
  70. WScript.Echo "Trailing comma (2)"
  71. WScript.Echo Path.DisplayName
  72. WScript.Echo ""
  73. if err <> 0 then
  74. WScript.Echo "Got expected error: ", Err.Description, Err.Source, Err.Number
  75. WScript.Echo ""
  76. err.clear
  77. end if
  78. Path.DisplayName = "winmgmts:{,authenticationLevel=pkt,impersonationLevel=delegate}!"
  79. WScript.Echo "Leading comma"
  80. WScript.Echo Path.DisplayName
  81. WScript.Echo ""
  82. if err <> 0 then
  83. WScript.Echo "Got expected error: ", Err.Description, Err.Source, Err.Number
  84. WScript.Echo ""
  85. err.clear
  86. end if
  87. Path.DisplayName = "winmgmts:authenticationLevel=pktIntegrity,impersonationLevel=identify}"
  88. WScript.Echo "Missing {"
  89. WScript.Echo Path.DisplayName
  90. WScript.Echo ""
  91. if err <> 0 then
  92. WScript.Echo "Got expected error: ", Err.Description, Err.Source, Err.Number
  93. WScript.Echo ""
  94. err.clear
  95. end if
  96. Path.DisplayName = "winmgmts:{authenticationLevel=pktPrivacy,impersonationLevel=identify!root/default"
  97. WScript.Echo "Missing }"
  98. WScript.Echo Path.DisplayName
  99. WScript.Echo ""
  100. if err <> 0 then
  101. WScript.Echo "Got expected error: ", Err.Description, Err.Source, Err.Number
  102. WScript.Echo ""
  103. err.clear
  104. end if
  105. Path.DisplayName = "winmgmts:{authenticationLevel=pktPrivacy,impersonationLevel=identify}root/default:__Cimomidentification=@"
  106. WScript.Echo "Missing !"
  107. WScript.Echo Path.DisplayName
  108. WScript.Echo ""
  109. if err <> 0 then
  110. WScript.Echo "Got expected error: ", Err.Description, Err.Source, Err.Number
  111. WScript.Echo ""
  112. err.clear
  113. end if