Редагувати

Поділитися через


Registering an Instance Provider

To create a WMI instance provider you must register the __Win32Provider instance that represents your provider using an instance of __InstanceProviderRegistration. 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 an instance provider.

To register an instance provider

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

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

    The __InstanceProviderRegistration 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 qualifier signals that WMI should use a Dynamic provider to retrieve the class instances. The Provider qualifier specifies the name of the provider that WMI should use.

The following code example describes how to register a __Win32Provider and __InstanceProviderRegistration instance.

instance of __Win32Provider as $P
{
    Name="TestProv";
    CLSID="{A41602A4-C038-11d1-AEB6-00C04FB68820}";
};

instance of __InstanceProviderRegistration
{
    Provider = $P;
    SupportsGet = TRUE;
    SupportsEnumeration = TRUE;
    QuerySupportLevels = { "WQL:UnarySelect" };
};