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 <APIRegConstants.au3>
#include <Array.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIError.au3>
#include <WinAPIReg.au3>

Local $hKey = _WinAPI_RegOpenKey($HKEY_CLASSES_ROOT, 'CLSID', $KEY_READ)
If @error Then
    MsgBox(BitOR($MB_ICONERROR, $MB_SYSTEMMODAL), @extended, _WinAPI_GetErrorMessage(@extended))
    Exit
EndIf
Local $iCount = _WinAPI_RegQueryInfoKey($hKey)
Local $aKey[$iCount[0]]
For $i = 0 To UBound($aKey) - 1
    $aKey[$i] = _WinAPI_RegEnumKey($hKey, $i)
Next

_WinAPI_RegCloseKey($hKey)

_ArrayDisplay($aKey, '_WinAPI_RegEnumKey')