3.1.4.3 CloseKey (Opnum 18)

The CloseKey method closes a handle to a node.

 HRESULT CloseKey(
   [in] METADATA_HANDLE hMDHandle
 );

hMDHandle: An unsigned 32-bit integer value containing the handle to close, as returned by the OpenKey method.

Return Values: 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 HRESULT values, see [MS-ERREF].

Return value/code

Description

0x00000000

S_OK

The call was successful.

0x80070006

ERROR_INVALID_HANDLE

The handle is invalid.

The opnum field value for this method is 18.

When processing this call, the server MUST do the following:

  • Check the handle parameter. This handle is valid if it is either the master root handle or a handle returned from a previous OpenKey (section 3.1.4.2) call. If the handle is invalid, return the ERROR_INVALID_HANDLE error.

  • Decrease the internal lock count in the state of the handle and release the lock, if it is possible.