<div class="content" name="PutClassAsync" uuid="efa6fc62-70f9-405e-a745-fdebb40de5b5"><p>The IWbemServices::PutClassAsync method is the asynchronous
version of the <a href="92f52cfe-fde5-43de-8dcb-6e3d50650fc5" data-linktype="relative-path">IWbemServices::PutClass</a>
method. The PutClassAsync method creates a new class or updates an existing
class. The server MUST NOT allow the creation of classes that have names that
begin or end with an underscore because those names are reserved for system
classes. If the class name does not conform to the CLASS-NAME element defined
in WQL, the server MUST return WBEM_E_INVALID_PARAMETER.</p><dl>
<dd>
<div><pre> HRESULT PutClassAsync(
   [in] IWbemClassObject* pObject,
   [in] long lFlags,
   [in] IWbemContext* pCtx,
   [in] IWbemObjectSink* pResponseHandler
 );
</pre></div>
</dd></dl><p><b>pObject: </b>MUST be a pointer to an <a href="46710c5c-d7ab-4e4c-b4a5-ebff311fdcd1" data-linktype="relative-path">IWbemClassObject</a> <a href="6837a7cb-ba2d-46b1-802c-fce2fd5a6ad6#gt_e5ba77ec-1a10-4a4e-a980-c81942237b34" data-linktype="relative-path">interface pointer</a> that MUST
contain the class information to create a new class or update an existing
class. The class that is specified by the parameter MUST have been correctly
initialized with all the required property values. This parameter MUST NOT be
NULL.</p><p><b>lFlags: </b>Specifies the behavior of the PutClassAsync
method. Flag behavior MUST be interpreted as specified in the following table.</p><dl>
<dd>
<p>The server MUST accept a combination of zero or more
flags from the following table and MUST comply with all the restrictions in a
flag description. Any other DWORD value that does not match a flag condition
MUST be treated as not valid.</p>
</dd>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>WBEM_FLAG_USE_AMENDED_QUALIFIERS 0x00020000</td>
  <td>If this bit is set, the server SHOULD ignore all the amended qualifiers while it creates or updates a CIM class.&lt;36&gt; If this bit is not set, the server SHOULD include all the qualifiers, including amended qualifiers, while it updates or creates a CIM class.</td>
 </tr><tr>
  <td>WBEM_FLAG_UPDATE_ONLY 0x00000001</td>
  <td>The server MUST update a CIM class pObject if the CIM class is present. This flag is mutually exclusive with WBEM_FLAG_CREATE_ONLY. If none of these flags are set, the server MUST create or update a CIM class pObject.</td>
 </tr><tr>
  <td>WBEM_FLAG_CREATE_ONLY 0x00000002</td>
  <td>The server MUST create a CIM class pObject if the CIM class is not already present.</td>
 </tr><tr>
  <td>WBEM_FLAG_UPDATE_FORCE_MODE 0x00000040</td>
  <td>The server MUST forcefully update the class even when conflicting child classes exist.</td>
 </tr><tr>
  <td>WBEM_FLAG_UPDATE_SAFE_MODE 0x00000020</td>
  <td>The server MUST update the class as long as the change does not cause any conflicts with existing child classes or instances. This flag is mutually exclusive with WBEM_FLAG_UPDATE_FORCE_MODE. If none of these flags are set, the server MUST update the class if there is no derived class, if there is no instance for that class, or if the class is unchanged.</td>
 </tr><tr>
  <td>WBEM_FLAG_SEND_STATUS 0x00000080</td>
  <td>If this bit is not set, the server MUST make one final IWbemObjectSink::SetStatus method call on the interface pointer that is provided in the pResponseHandler parameter. If this bit is set, the server MAY make intermediate IWbemObjectSink::SetStatus calls on the interface pointer prior to call completion.</td>
 </tr></tbody></table>
</dd></dl><p><b>pCtx: </b>MUST be a pointer to an <a href="18c8f1a1-652f-43b7-9186-6098bc303a8d" data-linktype="relative-path">IWbemContext</a> interface,
which MUST contain additional information that the client wants to pass to the
server. If the <i>pCtx</i> parameter is NULL, the parameter MUST be ignored.</p><p><b>pResponseHandler: </b>MUST be a pointer to an <a href="0ddb4f22-371a-4697-af5b-d4184b179b68" data-linktype="relative-path">IWbemObjectSink</a> interface
object that is implemented by the client of this method. The parameter MUST NOT
be NULL.</p><p><b>Return Values: </b>This method MUST return an
HRESULT value that MUST indicate the status of the method call. The server MUST
return WBEM_S_NO_ERROR (specified in section <a href="a2899649-a5a3-4b13-9ffa-d8394dcdac63" data-linktype="relative-path">2.2.11</a>) to indicate the
successful completion of the method.</p><dl>
<dd>
<p><b>WBEM_S_NO_ERROR</b> (0x00)</p>
</dd></dl><p>The following validation happens before asynchronous
operation is started:</p><p>The <a href="6837a7cb-ba2d-46b1-802c-fce2fd5a6ad6#gt_f3ef2572-95cf-4c5c-b3c9-551fd648f409" data-linktype="relative-path">security
principal</a> that makes the call MUST have WBEM_REMOTE_ENABLE and WBEM_ENABLE
accesses to the namespace; otherwise, WBEM_E_ACCESS_DENIED MUST be returned.</p><p>Requirements mentioned in the parameter definitions are also
checked before starting asynchronous operation.</p><p>If successful, the server MUST create a new entry in <b>AsyncOperationTable</b>
as specified in section <a href="83a955c3-2fba-4d06-bd88-76ed9bbada43" data-linktype="relative-path">3.1.1.1.3</a>.</p><p>The following validation happens asynchronously:</p><p>The server MUST first determine whether the class is dynamic
or static.  If the class exists in the <b>ClassTable</b> for the namespace,
then it is static when <b>InstanceProviderId</b> is NULL and dynamic otherwise.
If the class does not exist in the <b>ClassTable</b>, then WMI MUST iterate
through each entry in <b>ProviderTable</b> with <b>IsClassProvider</b> set to
TRUE, calling the <b>IsClassSupported</b> entrypoint (described in section <a href="cbd8970e-ea3e-4a2b-b4ea-64dd22944c3e" data-linktype="relative-path">3.1.4.17.14</a>). If a
provider returns TRUE, then the algorithm is terminated and the class is
dynamic. Otherwise, the class is static.</p><p>If the CIM class being updated is <a href="6837a7cb-ba2d-46b1-802c-fce2fd5a6ad6#gt_b11172af-9369-448d-9722-444eb52b21cb" data-linktype="relative-path">dynamic</a>, the security
principal that makes the call MUST have WBEM_WRITE_PROVIDER access to the
namespace; otherwise, WBEM_E_ACCESS_DENIED MUST be returned.</p><p>If the CIM class being updated is static, the security
principal that makes the call MUST have WBEM_FULL_WRITE access to the
namespace; otherwise, WBEM_E_ACCESS_DENIED MUST be returned.</p><p>If the CIM class being created or updated is dynamic, the
server MUST obtain <b>SupportsPut</b> for the given provider in the <b>ProviderTable</b>.
If <b>SupportsPut</b> is FALSE, the server MUST return
WBEM_E_PROVIDER_NOT_CAPABLE.</p><p>The server MUST return WBEM_E_CANNOT_BE_SINGLETON if an
attempt is made to mark a class as a Singleton that has a nonsingleton
superclass or a class with key properties.</p><p>In response to the IWbemServices::PutClassAsync method, the
server MUST evaluate the <i>pObject</i> parameter (previously specified) and it
MUST add or update this class into the current namespace. The method MUST fail
if <i>pObject</i> represents a read-only class, if the method parameters or
their combinations are not valid (as previously specified), or if the server is
unable to execute the method. The method MUST fail with WBEM_E_NOT_FOUND if <i>pObject</i>
property __SUPERCLASS is specified but not found in <b>ClassTable</b>.</p><p>If a new class is added or an existing class is updated, <b>ClassTable</b>
MUST be updated with the changes. If <i>pObject</i> property __SUPERCLASS is
specified, <b>DerivedClassTable</b> MUST point to the entry in the <b>ClassTable</b>
representing the SuperClass.</p><p>If the CIM class referred by <i>pObject</i> is a new entry
in the <b>ClassTable</b>, the server MUST generate a <b>__ClassCreationEvent</b>
event object upon successful creation of the class.</p><p>If the CIM class referred by <i>pObject</i> already exists
in the <b>ClassTable</b> prior to this method call,  the server MUST generate a
<b>__ClassModificationEvent</b> event object upon successfully updating the
class information.</p><p>The server MUST ensure that the value referred by __CLASS
conforms to CLASS-NAME in <a href="cf0410f3-541f-477a-848f-9133a1272725" data-linktype="relative-path">2.2.1.1</a>.
In addition:</p><ul><li><p><span><span> 
</span></span>If the value has an underscore character (&#34;_&#34;) as the
first character, the server MUST return WBEM_E_INVALID_OPERATION.</p>
</li><li><p><span><span> 
</span></span>If the value has an underscore character as the last character
prior to NULL, the server MUST return WBEM_E_INVALID_OBJECT.</p>
</li><li><p><span><span> 
</span></span>The server SHOULD enforce a maximum length for the _CLASS
property (see section <a href="a95f02df-dedf-45ba-8c76-05b5b7d9cd3b" data-linktype="relative-path">2.2</a>)
of the object pointed to by the <b>pObject</b> parameter, and return
WBEM_E_QUOTA_VIOLATION if the limit is exceeded.<a id="Appendix_A_Target_37"></a><a aria-label="Product behavior note 37" href="27182640-aa3f-43b6-941f-a77d25f798e8#Appendix_A_37" data-linktype="relative-path">&lt;37&gt;</a></p>
</li></ul></div>