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.

32 lines
940 B

  1. var Service = GetObject("winmgmts:root/default");
  2. //Create a simple embeddable object
  3. var Class = Service.Get();
  4. Class.Path_.Class = "INNEROBJ00";
  5. Class.Properties_.Add ("p", 19);
  6. Class.Put_();
  7. var Class = Service.Get ("INNEROBJ00");
  8. var Instance = Class.SpawnInstance_();
  9. Instance.p = 8778;
  10. //Create a class that uses that object
  11. var Class2 = Service.Get();
  12. Class2.Path_.Class = "EMBOBJTEST00";
  13. Class2.Properties_.Add ("p1", 13).Value = Instance;
  14. Class2.Put_();
  15. Class = GetObject("winmgmts:root/default:EMBOBJTEST00");
  16. WScript.Echo ("The current value of EMBOBJTEST00.p1.p is [8778]:", Class.p1.p);
  17. var prop = Class.p1;
  18. prop.Properties_("p") = 23;
  19. WScript.Echo ("The new value of EMBOBJTEST00.p1.p is [23]:", Class.p1.p);
  20. prop.p = 45;
  21. WScript.Echo ("The new value of EMBOBJTEST00.p1.p is [45]:", Class.p1.p);
  22. Class.p1.p=82;
  23. WScript.Echo ("The new value of EMBOBJTEST00.p1.p is [82]:", Class.p1.p);