RegQueryInfoKey (Compact 2013)

3/26/2014

This function retrieves information about a specified registry key.

Syntax

LONG RegQueryInfoKey( 
  HKEY hKey, 
  LPWSTR lpClass, 
  LPDWORD lpcbClass, 
  LPDWORD lpReserved, 
  LPDWORDlpcSubKeys, 
  LPDWORD lpcbMaxSubKeyLen, 
  LPDWORD lpcbMaxClassLen, 
  LPDWORD lpcValues, 
  LPDWORD lpcbMaxValueNameLen, 
  LPDWORD lpcbMaxValueLen, 
  LPDWORD lpcbSecurityDescriptor, 
  PFILETIME lpftLastWriteTime 
); 

Parameters

  • hKey
    [in] Handle to a currently open key or any of the following predefined reserved handle values:

    • HKEY_LOCAL_MACHINE
    • HKEY_CLASSES_ROOT
    • HKEY_CURRENT_USER
    • HKEY_USERS
  • lpClass
    [out] Pointer to a buffer that receives the key's class name. This parameter can be set to NULL.
  • lpcbClass
    [in, out] Pointer to a variable that specifies the size, in characters, of the buffer pointed to by lpClass. This size includes the terminating null character. When the function returns, this variable contains the length of the class string stored in the buffer. The count returned does not include the terminating null character. If the buffer is not big enough, the function returns ERROR_MORE_DATA, and the variable contains the size of the string, in characters, without counting the null character.

    If lpClass is set to NULL, lpcbClass can be set to NULL.

    If lpClass is a valid address, but this parameter is not, the function returns ERROR_INVALID_PARAMETER.

  • lpReserved
    [in] Reserved. Set to NULL.
  • lpcSubKeys
    [out] Pointer to a variable that receives the number of subkeys contained by the specified key. This parameter can be set to NULL.
  • lpcbMaxSubKeyLen
    [out] Pointer to a variable that receives the length, in characters, of the key's subkey with the longest name. The count returned does not include the terminating null character. This parameter can be set to NULL.
  • lpcbMaxClassLen
    [out] Pointer to a variable that receives the length, in characters, of the longest string specifying a subkey class. The count returned does not include the terminating null character. This parameter can be set to NULL.
  • lpcValues
    [out] Pointer to a variable that receives the number of values associated with the key. This parameter can be set to NULL.
  • lpcbMaxValueNameLen
    [out] Pointer to a variable that receives the length, in characters, of the key's longest value name. The count returned does not include the terminating null character. This parameter can be set to NULL.
  • lpcbMaxValueLen
    [out] Pointer to a variable that receives the length, in bytes, of the longest data component among the values of the key. This parameter can be set to NULL.
  • lpcbSecurityDescriptor
    [in] Not used. Set to NULL.
  • lpftLastWriteTime
    [in] Ignored. Set to NULL.

Return Value

ERROR_SUCCESS indicates success. A nonzero error code defined in Winerror.h indicates failure. To get a generic description of the error, call the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag set. The message resource is optional, so FormatMessage might fail.

Requirements

Header

winreg.h

Library

coredll.lib

See Also

Reference

Registry Functions
RegDeleteKey
RegEnumKeyEx
RegEnumValue
RegQueryValueEx