# Function Reference

# _WinAPI_GetRegKeyNameByHandle

Retrieves a name of the specified registry key

#include <WinAPIReg.au3>
_WinAPI_GetRegKeyNameByHandle ( $hKey )

## Parameters

$hKey | Handle to an open registry key.

## Return Value

Success: | The name of the key.
Failure: | Empty string and sets the @error flag to non-zero, @extended flag may contain the NTSTATUS error code.

## See Also

Search ZwQueryKey in MSDN Library.

## Example

    #include <Debug.au3>
    #include <WinAPIError.au3>
    #include <WinAPIReg.au3>

    Local $hKey = _WinAPI_RegOpenKey($HKEY_CURRENT_USER, 'Software\AutoIt v3', $KEY_QUERY_VALUE)
    If @error Then
        _DebugSetup(Default, True)
        _DebugReport("! RegOpenKey @error =" & @error & @CRLF & @TAB & _WinAPI_GetErrorMessage(@extended))
        Exit
    EndIf

    ConsoleWrite(_WinAPI_GetRegKeyNameByHandle($hKey) & @CRLF)

    _WinAPI_RegCloseKey($hKey)