IWbemServices::PutClass

[This is preliminary documentation and subject to change.]

The IWbemServices::PutClass method creates a new class or it updates an existing one. The class specified by the pObject parameter must have been correctly initialized with all of the required property values.

The user may not create classes with names that begin with two leading underscores. This is reserved for system classes.

HRESULT IWbemServices::PutClass(
  [in] IWbemClassObject *pObject,                
  [in] LONG lFlags,                             
  [in] IWbemContext *pCtx,                       
  [out, OPTIONAL] IWbemCallResult **ppCallResult  
);
 

Parameters

pObject
Must point to a valid class definition. The reference count is not changed.
lFlags
If WBEM_FLAG_CREATE_OR_UPDATE, the class is created if it does not exist or it is overwritten if it exists already. If WBEM_FLAG_UPDATE_ONLY, then the class must exist, and this call constitutes an update. If WBEM_FLAG_CREATE_ONLY, then this call is for creation only; the call fails if the class already exists.
pCtx
Typically NULL. Otherwise, this is a pointer to an IWbemContext object required by the dynamic class provider that is producing the class instances. The values in the context object must be specified in the documentation for the provider in question.
ppCallResult
If NULL, this is not used .If not NULL, the call returns immediately with WBEM_NO_ERROR. Then, IWbemCallResult must be polled for the result using IWbemCallResult::GetCallStatus.

Return Values

WBEM_E_ACCESS_DENIED The current user is not permitted to create or modify classes.
WBEM_E_FAILED Other unspecified errors.
WBEM_E_INCOMPLETE_CLASS Required properties for classes have not all been set.
WBEM_E_INVALID_PARAMETER An invalid parameter was specified, or the namespace could not be parsed.
WBEM_E_OUT_OF_MEMORY There was not enough memory to complete the operation.
WBEM_E_TRANSPORT_FAILURE The communications link between the current process and CIMOM has failed.
WBEM_NO_ERROR The call succeeded.
WBEM_E_ALREADY_EXISTS WBEM_FLAG_CREATE_ONLY flag was specified, but the class already exists.
WBEM_E_NOT_FOUND Update flag specified, but class is not found.

On failure, you can obtain any available information from the COM function GetErrorInfo.

See Also

Class Creation and Modification Rules, Error Objects, IWbemCallResult