Provider::ExecMethod(ParsedObjectPath,BSTR,long,CInstance,CInstance,MethodContext) method (provider.h)
[The Provider class is part of the WMI Provider Framework which is now considered in final state, and no further development, enhancements, or updates will be available for non-security related issues affecting these libraries. The MI APIs should be used for all new development.]
The ExecMethod method is called by WMI to invoke a method on a class or instance.
HRESULT ExecMethod( ParsedObjectPath *pParsedObjectPath, BSTR bstrMethodName, long lFlags, CInstance *pInParams, CInstance *pOutParams, MethodContext *pContext );
Name of the method that is invoked.
Bitmask of flags with information about the execute method operation. This is the value specified by the client in the IWbemServices::ExecMethod method. Few clients use the lFlags parameters. You can safely ignore lFlags in most provider implementations.
The following flag is handled by (and filtered out) by WMI:
Pointer to the method input parameters.
Pointer to the method output parameters.
The default framework provider implementation of this method returns WBEM_E_PROVIDER_NOT_CAPABLE to the calling method. The IWbemServices::ExecMethod method lists the most common return values, although you can choose to return any COM return code.
Return values for methods may be one of two types:
- HRESULT is used to indicate WMI type errors: WBEM_E_OUT_OF_MEMORY, WBEM_E_NOT_FOUND, and so on.
- The return value from the method (such as uint32) returns the result from the method.
WMI calls ExecMethod when a client calls IWbemServices::ExecMethod against your class. Therefore, you must implement ExecMethod if your provider supports one or more methods. The following list describes a common implementation of ExecMethod:
- Determine which method the client called by examining the bstrMethodName parameter.
Retrieve the input parameters from the pInParams parameter, using the Get methods from the CInstance class, such as CInstance::GetCHString.
A method may have input parameters, output parameters, both input and output parameters, or no input or output parameters.
Set the output parameters in the pOutParams parameter, using the Set methods of the CInstance class, such as CInstance::SetByte or CInstance::SetStringArray.
In addition to declaring the [out] properties as specified in the return declaration, you must also declare the return value for the method, as defined in the ReturnValue property. You do not have to declare a return value if if the return value is void.
|Minimum supported client||Windows Vista|
|Minimum supported server||Windows Server 2008|
|Header||provider.h (include FwCommon.h)|