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.

85 lines
2.9 KiB

  1. var Service = GetObject("winmgmts:root/default");
  2. //Create a simple embeddable object
  3. var Class = Service.Get();
  4. Class.Path_.Class = "INNEROBJ01";
  5. var Property = Class.Properties_.Add ("p", 19);
  6. Class.Properties_.Add ("q", 8).Value = "resnais";
  7. Property.Qualifiers_.Add ("fred", "wibbley");
  8. Property.Qualifiers_.Add ("dibnah", "wobbley");
  9. Class.Qualifiers_.Add ("stavisky", "providence");
  10. Class.Qualifiers_.Add ("muriel", "brouillard");
  11. Class.Put_();
  12. var Class = Service.Get ("INNEROBJ01");
  13. Class.p = 8778;
  14. //Create a class that uses that object
  15. var Class2 = Service.Get();
  16. Class2.Path_.Class = "EMBOBJTEST01";
  17. Class2.Properties_.Add ("p1", 13).Value = Class;
  18. //Now modify the path
  19. Class.Path_.Class = "LAGUERRE";
  20. WScript.Echo ("The current value of EMBOBJTEST01.p1.Path_.Class is [LAGUERRE]:", Class2.p1.Path_.Class);
  21. WScript.Echo ();
  22. //Modify the qualifier set of the class
  23. Class.Qualifiers_.Remove ("muriel");
  24. Class.Qualifiers_.Add ("fumer", "pasdefumer");
  25. var Qualifier = Class.Qualifiers_("stavisky");
  26. Qualifier.Value = "melo";
  27. WScript.Echo ("Qualifiers of EMBOBJTEST01.p1 are [(fumer,pasdefumer),(stavisky,melo)]:");
  28. for (e = new Enumerator (Class2.p1.Qualifiers_); !e.atEnd(); e.moveNext())
  29. {
  30. var Qualifier = e.item();
  31. WScript.Echo (Qualifier.Name, Qualifier.Value);
  32. }
  33. WScript.Echo ("Qualifier [stavisky] has flavor [-1,-1,-1]:", Class2.p1.Qualifiers_("stavisky").IsOverridable,
  34. Class2.p1.Qualifiers_("stavisky").PropagatesToInstance,
  35. Class2.p1.Qualifiers_("stavisky").PropagatesToSubclass);
  36. var Qualifier = Class.Qualifiers_("stavisky");
  37. Qualifier.IsOverridable = false;
  38. Qualifier.PropagatesToInstance = false;
  39. Qualifier.PropagatesToSubclass = false;
  40. WScript.Echo ("Qualifier [stavisky] has flavor [0,0,0]:", Class2.p1.Qualifiers_("stavisky").IsOverridable,
  41. Class2.p1.Qualifiers_("stavisky").PropagatesToInstance,
  42. Class2.p1.Qualifiers_("stavisky").PropagatesToSubclass);
  43. //Modify the qualifier set of the property
  44. Class.Properties_("p").Qualifiers_.Remove ("fred");
  45. Class.Properties_("p").Qualifiers_.Add ("steeple", "jack");
  46. Class.Properties_("p").Qualifiers_("dibnah").Value = "demolition";
  47. WScript.Echo ();
  48. WScript.Echo ("Qualifiers of EMBOBJTEST01.p1.p are [(steeple,jack),(dibnah,demolition)]:");
  49. for (e = new Enumerator (Class2.p1.Properties_("p").Qualifiers_); !e.atEnd(); e.moveNext())
  50. {
  51. var Qualifier = e.item();
  52. WScript.Echo (Qualifier.Name, Qualifier.Value);
  53. }
  54. //Modify the property set of the property
  55. Class.Properties_.Remove ("q");
  56. Class.Properties_.Add ("r", 19).Value = 27;
  57. Class.Properties_("p").Value = 99;
  58. WScript.Echo();
  59. WScript.Echo ("Properties of EMBOBJTEST01.p1 are [(p,99),(r,27)]:");
  60. for (e = new Enumerator (Class2.p1.Properties_); !e.atEnd(); e.moveNext())
  61. {
  62. var Property = e.item();
  63. WScript.Echo (Property.Name, Property.Value);
  64. }
  65. Class2.Put_();