Writing a Method Provider
A method provider allows WMI access to the methods of a class. For example, a class that represents an application may have a method that terminates the application.
Changing the order of method input and output parameters when updating an existing method provider can cause failure for applications that call the method. The order of the input or output parameters is established by the value of the ID qualifier on each parameter. The first parameter has an ID value of zero. Add new input parameters at the end of the existing parameters rather than inserting them in the already established sequence.
The following procedure describes how to implement a method provider.
To implement a method provider
Design and register your class provider with WMI.
Implement the IWbemProviderInit interface for your provider.Note Method providers are strongly encouraged to use the multithreading model "Both".
Implement the IWbemServices::ExecMethodAsync method for your provider.
The IWbemServices interface is the primary interface for a method provider. For more information, see Implementing the Primary Interface for a Method Provider.
Add any additional code necessary for your 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.
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.