# Function Reference

# _WinAPI_RegQueryInfoKey

Retrieves information about the specified registry key

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

## Parameters

$hKey | Handle to an open registry key. The key must have been opened with the $KEY_QUERY_VALUE access right. This handle is returned by the _WinAPI_RegCreateKey() or _WinAPI_RegOpenKey() function. It can also be one of the following predefined keys: $HKEY_CLASSES_ROOT $HKEY_CURRENT_CONFIG $HKEY_CURRENT_USER $HKEY_LOCAL_MACHINE $HKEY_PERFORMANCE_DATA $HKEY_USERS

## Return Value

Success: | The array containing the following information: [0] - The number of subkeys that are contained by the specified key. [1] - The size of the key's subkey with the longest name, in characters, not including the terminating null character. [2] - The number of values that are associated with the key. [3] - The size of the key's longest value name, in characters. The size does not include the terminating null character. [4] - The size of the longest data component among the key's values, in bytes.
Failure: | Sets the @error flag to non-zero, @extended flag may contain the system error code.

## Related

_WinAPI_RegCreateKey, _WinAPI_RegOpenKey

## See Also

Search RegQueryInfoKey in MSDN Library.

## Example

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

    Example()

    Func Example()
        Local $hKey = _WinAPI_RegOpenKey($HKEY_CLASSES_ROOT, 'CLSID', $KEY_READ)
        If @error Then
            _DebugSetup(Default, True)
            _DebugReport("! RegOpenKey @error =" & @error & @CRLF & @TAB & _WinAPI_GetErrorMessage(@extended))
            Exit
        EndIf
        Local $iCount = _WinAPI_RegQueryInfoKey($hKey)
        Local $aKey[$iCount[0]][2], $tLocalFILETIME, $tFileWriteTime
        For $i = 0 To UBound($aKey) - 1
            $aKey[$i][0] = _WinAPI_RegEnumKey($hKey, $i)
            $tFileWriteTime = @extended
            If $tFileWriteTime Then
                $tLocalFILETIME = _Date_Time_FileTimeToLocalFileTime($tFileWriteTime)
                $aKey[$i][1] = _Date_Time_FileTimeToStr($tLocalFILETIME, 1)
            EndIf
        Next

        _WinAPI_RegCloseKey($hKey)

        _DebugArrayDisplay($aKey, '_WinAPI_RegEnumKey')

    EndFunc   ;==>Example