Export (0) Print
Expand All

IWbemServices::DeleteClass method

The IWbemServices::DeleteClass method deletes the specified class from the current namespace. If a dynamic instance provider is associated with the class, the provider is unregistered, and it is no longer called for by that class. Any classes that derive from the deleted class are also deleted, and their associated providers are unregistered. All outstanding static instances of the specified class and its subclasses are also deleted when the class is deleted.

If a dynamic class provider provides the class, the success of the deletion depends on whether the provider supports class deletion.

Note  System classes cannot be deleted.

Syntax


HRESULT DeleteClass(
  [in]   const BSTR strClass,
  [in]   LONG lFlags,
  [in]   IWbemContext *pCtx,
  [out]  IWbemCallResult **ppCallResult
);

Parameters

strClass [in]

Name of the class targeted for deletion.

lFlags [in]

One of the following values can be set.

FlagMeaning
WBEM_FLAG_RETURN_IMMEDIATELY

This flag causes this to be a semisynchronous call. For more information, see Calling a Method.

WBEM_FLAG_OWNER_UPDATE

Indicates that the caller is a push provider.

 

pCtx [in]

Typically NULL. Otherwise, this is a pointer to an IWbemContext object that may be used by the provider deleting the class. The values in the context object must be specified in the documentation for the provider in question. For more information about this parameter, see Making Calls to WMI.

ppCallResult [out]

If NULL, this parameter is not used. If ppCallResult is specified, it must be set to point to NULL on entry. If the lFlags parameter contains WBEM_FLAG_RETURN_IMMEDIATELY, this call returns immediately with WBEM_S_NO_ERROR. The ppCallResult parameter receives a pointer to a new IWbemCallResult object, which can then be polled to obtain the result using the GetCallStatus method.

Return value

This method returns an HRESULT indicating the status of the method call. The following table lists the value contained within an HRESULT.

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

COM-specific error codes may also be returned if network problems cause you to lose the remote connection to Windows Management.

Return codeDescription
WBEM_E_ACCESS_DENIED

The current user does not have permission to delete classes.

WBEM_E_FAILED

This indicates other unspecified errors.

WBEM_E_INVALID_CLASS

The specified class does not exist.

WBEM_E_CLASS_HAS_CHILDREN

Deleting this class would invalidate a subclass.

WBEM_E_INVALID_OPERATION

Deletion is not supported for the specified class. It may have been a system class or a class supplied by a dynamic provider that does not support class deletion.

WBEM_E_INVALID_PARAMETER

A specified parameter is not valid.

WBEM_E_OUT_OF_MEMORY

There was not enough memory to complete the operation.

WBEM_E_SHUTTING_DOWN

Windows Management service was probably stopped and restarted. A new call to ConnectServer is needed.

WBEM_E_TRANSPORT_FAILURE

This indicates the failure of the remote procedure call (RPC) link between the current process and Windows Management.

WBEM_S_NO_ERROR

The call succeeded.

 

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2003

Header

Wbemcli.h (include Wbemidl.h)

Library

Wbemuuid.lib

DLL

Fastprox.dll;
Esscli.dll;
Framedyn.dll;
Ntevt.dll;
Stdprov.dll;
Viewprov.dll;
Wbemcomn.dll;
Wbemcore.dll;
Wbemess.dll;
Wbemsvc.dll;
Wmipicmp.dll;
Wmidcprv.dll;
Wmipjobj.dll;
Wmiprvsd.dll

See also

IWbemServices
Retrieving an Error Code
IWbemServices::DeleteClassAsync

 

 

Show:
© 2014 Microsoft