<div class="content" name="ChangePermissions" uuid="3f4bf3b8-99b5-49b1-affd-f461e859c0ab"><p>The ChangePermissions method changes permissions on an open
handle.</p><dl>
<dd>
<div><pre> HRESULT ChangePermissions(
   [in] METADATA_HANDLE hMDHandle,
   [in] DWORD dwMDTimeOut,
   [in] DWORD dwMDAccessRequested
 );
</pre></div>
</dd></dl><p><b>hMDHandle: </b>An unsigned 32-bit integer value
containing the handle to change the permissions for, as returned by the <a href="a54be1d0-009a-493d-a53e-e2f7fbe87293" data-linktype="relative-path">OpenKey</a> method.</p><p><b>dwMDTimeOut: </b>An integer value specifying the
time, in milliseconds, for the method to wait on a successful permission change
operation.</p><p><b>dwMDAccessRequested: </b>A set of bit flags specifying
the requested permissions for the handle. This parameter MUST be set to at
least one of the following values.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>METADATA_PERMISSION_READ 0x00000001</td>
  <td>Open the node for reading.</td>
 </tr><tr>
  <td>METADATA_PERMISSION_WRITE 0x00000002</td>
  <td>Open the node for writing.</td>
 </tr></tbody></table>
</dd></dl><p><b>Return Values: </b>A signed 32-bit value that
indicates return status. If the method returns a negative value, it failed. If
the 12-bit facility code (bits 16–27) is set to 0x007, the value contains a
Win32 error code in the lower 16 bits. Zero or positive values indicate
success, with the lower 16 bits in positive nonzero values containing warnings
or flags defined in the method implementation. For more information about Win32
error codes and <a href="../ms-dtyp/a9046ed2-bfb2-4d56-a719-2824afce59ac" data-linktype="relative-path">HRESULT</a>
values, see <a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a>.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>0x00000000 S_OK</td>
  <td>The call was successful.</td>
 </tr><tr>
  <td>0x80070006 ERROR_INVALID_HANDLE</td>
  <td>The handle is invalid.</td>
 </tr><tr>
  <td>0x80070057 E_INVALIDARG</td>
  <td>One or more arguments are invalid.</td>
 </tr><tr>
  <td>0x80070094 ERROR_PATH_BUSY</td>
  <td>The path specified cannot be used at this time.</td>
 </tr></tbody></table>
</dd></dl><p>The <a href="1243ba70-74ca-44f9-be0b-dfd6697010b4#gt_e127848e-c66d-427d-b3aa-9f904fa4ada7" data-linktype="relative-path">opnum</a>
field value for this method is 19.</p><p>When processing this call, the <a href="1243ba70-74ca-44f9-be0b-dfd6697010b4#gt_434b0234-e970-4e8c-bdfa-e16a30d96703" data-linktype="relative-path">server</a> MUST do the
following:</p><ul><li><p><span><span> 
</span></span>Check the handle parameter. This handle is valid if it is a
handle returned from a previous OpenKey call. If the handle is invalid, return
ERROR_INVALID_HANDLE.</p>
</li><li><p><span><span> 
</span></span>Determine if it is possible to provide the requested access type
for the specified node.</p>
</li><li><p><span><span> 
</span></span>If the caller requests write access to the handle and the node
falls into part of the <a href="1243ba70-74ca-44f9-be0b-dfd6697010b4#gt_086b13f2-2715-4000-a16c-6acc3d59cc19" data-linktype="relative-path">metabase</a>
for which there are other open read handles, the server will wait for the time
period specified by <i>dwMDTimeOut</i> for the other read handles to close. If,
after this time period expires, there are still open read handles, return
ERROR_PATH_BUSY.</p>
</li><li><p><span><span> 
</span></span>If access could be provided, the server updates the state of the
handle.<a id="Appendix_A_Target_14"></a><a aria-label="Product behavior note 14" href="88fd1df0-e63e-41ca-9bf3-bedcab57cd86#Appendix_A_14" data-linktype="relative-path">&lt;14&gt;</a></p>
</li></ul></div>