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.

52 lines
1.5 KiB

  1. var Service = GetObject("winmgmts:root/default");
  2. var Class = Service.Get();
  3. Class.Path_.Class = "Qualtest00";
  4. var Qualifiers = Class.Qualifiers_;
  5. Qualifiers.Add ("qbool", true, true, true, false);
  6. Qualifiers.Add ("qsint32", 345);
  7. Qualifiers.Add ("qreal64", -345.675);
  8. Qualifiers.Add ("qstring", "freddy the frog");
  9. Qualifiers.Add ("qstring2", "freddy the froggie", false);
  10. Qualifiers.Add ("qstring3", "freddy the froggies", false, false);
  11. Qualifiers.Add ("qstring4", "freddy the froggiess", true, false);
  12. Qualifiers.Add ("qstring5", "wibble", true, true, false);
  13. Qualifiers.Add ("aqbool", new Array(true, false, true));
  14. Qualifiers.Add ("aqsint32", new Array (10, -12));
  15. Qualifiers.Add ("aqreal64", new Array(-2.3, 2.456, 12.356567897));
  16. Qualifiers.Add ("aqstring", new Array("lahdi", "dah", "wibble"));
  17. Qualifiers("qsint32").Value = 7677;
  18. WScript.Echo ("There are", Qualifiers.Count, "Qualifiers in the collection");
  19. for (var e = new Enumerator (Qualifiers);!e.atEnd();e.moveNext ())
  20. {
  21. var qualifier = e.item ();
  22. var value = qualifier.Value;
  23. if ((typeof(value) == "number") ||
  24. (typeof(value) == "string") ||
  25. (typeof(value) == "boolean"))
  26. {
  27. WScript.Echo (qualifier.Name, "=", qualifier);
  28. }
  29. else
  30. {
  31. // Assume it's an array
  32. var arrayValue = new VBArray (value).toArray();
  33. var str = qualifier.Name + " = [";
  34. for (i = 0; i < arrayValue.length; i++) {
  35. if (i > 0) {
  36. str = str + ", ";
  37. }
  38. str = str + arrayValue[i];
  39. }
  40. str = str + "]";
  41. WScript.Echo (str);
  42. }
  43. }
  44. Class.Put_ ();