Редактиране

Споделяне чрез


Registering a Property Provider

To create a WMI property provider you must register the __Win32Provider instance that represents your provider using an instance of __PropertyProviderRegistration. As a COM object, your provider must register with the operating system and WMI. The following procedure assumes that you have already implemented the registration process as described in Registering a Provider.

The following procedure describes how to register a property provider.

To register a property provider

  1. Create an instance of the __Win32Provider class that describes the property provider.

    The __Win32Provider class accepts the default values for other properties, such as the TRUE value for the Pure property. For more information, see __Win32Provider.

  2. Create an instance of the __PropertyProviderRegistration class that describes the feature set of the provider.

    The __PropertyProviderRegistration class inherits many properties from the __ObjectProviderRegistration parent class, which provides Boolean values that indicate support for particular features and an array of strings to indicate query support.

    Be sure to tag the class with both the Dynamic and Provider qualifiers. The Dynamic qualifier signals that WMI should use a dynamic provider to retrieve the class instances that contain the supported properties. The Provider qualifier specifies the name of the provider that WMI should use.

WMI calls NewQuery on an event provider when a client consumer registers an event filter query that contains references to events supported by that event provider. So the event provider responsible for instance modification events for the EmailClass class can be set up to generate notifications only for sender. When the provider receives a query requesting notification of changes to the subject property, the provider can start generating those notifications. In this scenario, WMI is not required to discard the notifications that report recipient changes only.

The following MOF code example describes instances that can be used to register a property provider.

  instance of __Win32Provider as $P
  {
    Name    = "PropProvider" ;
    ClsId   = "{E30EC6A0-23CF-11d1-8FDE-0000F804AA5C}" ;
  };    

  instance of __PropertyProviderRegistration
  {
    Provider = $P;
    SupportsGet = TRUE;
    SupportsPut = FALSE;
  };

Note

Only administrators can register or delete a property provider by creating an instance of __Win32Provider and __PropertyProviderRegistration.