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.

54 lines
2.1 KiB

  1. Methods Provider
  2. ================
  3. This sample demonstrates the framework necessary to implement a methods provider.
  4. To get the sample working, do the following;
  5. 1) Build using NMAKE.
  6. 2) Make sure that the classes used by the provider are defined by using the MOF compiler.
  7. Ex; mofcomp userid.mof
  8. 3) Register the DLL by using the self registration technique.
  9. Ex; c:>regsvr32 userid.dll
  10. What this provider supports
  11. ===========================
  12. This provider supports methods for the class "UserID". The only method
  13. supported in this sample is named GetUserID. Note that the method is marked
  14. as "Static" and should be executed using a path to the class. The mof definition is
  15. [dynamic: ToInstance, provider("UserIDProvider")]class UserID
  16. {
  17. [implemented, static]
  18. void GetUserID([out] string sDomain, [out] string sUser,
  19. [out] string sImpLevel,
  20. [out] string sPrivileges [],
  21. [out] boolean bPrivilegesEnabled []);
  22. };
  23. The method returns the current user credentials of the client.
  24. Using WbemTest application to execute the sample
  25. ================================================
  26. To see the provider in action you must use wbemtest application to execute methods
  27. using this provider. The following are directions on how to see the methods provider in
  28. action.
  29. 1)type wbemtest at command prompt
  30. ex: c:>wbemtest
  31. 2)Connect to root\default
  32. 3)Click Execute Method Button
  33. 4)Type in the Object Path: In this case "UserID".
  34. 5)A default method should appear in the Method box named "GetUserID".
  35. 6)Click Execute!
  36. 7)The values should be returned in Edit-Out-Parameters.
  37. Using the userid.vbs sample to execute the sample
  38. ====================================================
  39. The method provider sample can also be called using the userid.vbs
  40. sample program. Before running it, this provider should be setup first
  41. using the steps listed above.