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.

61 lines
2.1 KiB

  1. #***************************************************************************
  2. #This script tests the manipulation of property values, in the case that the
  3. #property is a not an array type
  4. #***************************************************************************
  5. use OLE;
  6. use Win32;
  7. $locator = CreateObject OLE 'WbemScripting.SWbemLocator';
  8. $service = $locator->ConnectServer (".", "root/default");
  9. $class = $service->Get();
  10. $class->{Path_}->{Class} = "PROP00";
  11. $class->{Properties_}->Add( "p1", 19);
  12. $class->{Properties_}->{p1}->{Value} = 327;
  13. print ("The initial value of p1 is ");
  14. $property = $class->{Properties_}->{p1}->{Value};
  15. print ($property);
  16. #print ($class->{Properties_}->{p1}); - doesn't work - have to specify ->{Value}
  17. #****************************************
  18. #First pass of tests works on non-dot API
  19. #****************************************
  20. print ("\nPASS 1 - Use Non-Dot Notation\n");
  21. #Verify we can report the value of an element of the property value
  22. $v = $class->{Properties_}->{p1}->{Value};
  23. print ("By indirection p1 has value: $v");
  24. print ("\n");
  25. #Verify we can report the value directly
  26. print ("By direct access p1 has value: ");
  27. print ($class->{Properties_}->{p1}->{Value});
  28. print ("\n");
  29. #Verify we can set the value of a single property value element
  30. $class->{Properties_}->{p1} = 234;
  31. print ("After direct assignment p1 has value: ");
  32. print ($class->{Properties_}->{p1}->{Value});
  33. print ("\n");
  34. #****************************************
  35. #Second pass of tests works on dot API
  36. #****************************************
  37. print ("\nPASS 2 - Use Dot Notation\n");
  38. #Verify we can report the value of an element of the property value
  39. $v = $class->{p1};
  40. print ("By indirection p1 has value: $v");
  41. print ("\n");
  42. #Verify we can report the value directly
  43. print ("By direct access p1 has value: ");
  44. print ($class->{p1});
  45. print ("\n");
  46. #Verify we can set the value of a single property value element
  47. $class->{p1} = 232234;
  48. print ("After direct assignment p1 has value: ");
  49. print ($class->{p1});
  50. print ("\n");