Düzenle

Aracılığıyla paylaş


Writing a Property Provider

A property provider retrieves and modifies individual property values for instances of a given class that is stored in the WMI repository.

The following procedure describes how to create a property provider.

To create a property provider

  1. Design and register your provider with WMI.

    Instance providers register with WMI by creating a __Win32Provider instance and a __PropertyProviderRegistration class. For more information, see Registering a Property Provider.

  2. Implement the IWbemProviderInit interface for your provider.

    WMI uses IWbemProviderInit to load and initialize a provider. This is a task common to all providers. For more information, see Initializing a Provider.

    Note

    Property providers are strongly encouraged to use the multithreading model "Both".

     

  3. Implement the IWbemPropertyProvider interface for your provider.

    The IWbemPropertyProvider interface is the primary interface for a property provider. The two main methods are GetProperty and PutProperty. For more information, see Implementing the Primary Interface for a Property Provider.

  4. Add any additional code necessary for your provider.

    When designing your provider, you will most likely need to call WMI interfaces. For more information, see Calling a Method and Maintaining Security Levels in a Provider.

    When retrieving information for a client, you may need to access the security levels for that client. For more information, see Impersonating a Client.

  5. Replace the preexisting provider with your new code.

    You do not need to perform this step if you do not have a preexisting provider to copy over. For more information, see Updating a Provider.