The RegQueryInfoKey function retrieves information about a specified registry key.
LONG RegQueryInfoKey (
HKEY hKey, |
// handle of key to query |
LPTSTR lpClass, |
// address of buffer for class string |
LPDWORD lpcbClass, |
// address of size of class string buffer |
LPDWORD lpReserved, |
// reserved |
LPDWORD lpcSubKeys, |
// address of buffer for number of subkeys |
LPDWORD lpcbMaxSubKeyLen, |
// address of buffer for longest subkey name length |
LPDWORD lpcbMaxClassLen, |
// address of buffer for longest class string length |
LPDWORD lpcValues, |
// address of buffer for number of value entries |
LPDWORD lpcbMaxValueNameLen, |
// address of buffer for longest value name length |
LPDWORD lpcbMaxValueLen, |
// address of buffer for longest value data length |
LPDWORD lpcbSecurityDescriptor, |
// address of buffer for security descriptor length |
PFILETIME lpftLastWriteTime |
// address of buffer for last write time |
); |
HKEY_CLASSES_ROOT
HKEY_CURRENT_CONFIG
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
Windows NT only: HKEY_PERFORMANCE_DATA
Windows 95 only: HKEY_DYN_DATA
If lpClass is NULL, lpcbClass can be NULL.
Windows NT: If the lpClass parameter is a valid address, but the lpcbClass parameter is not (for example, it is NULL), the function returns ERROR_INVALID_PARAMETER.
Windows 95: If the lpClass parameter is a valid address, but the
lpcbClass parameter is not (for example, it is NULL), the function
returns ERROR_SUCCESS instead of ERROR_INVALID_PARAMETER. To ensure
compatibility with other platforms, verify that lpcbClass is valid
before calling the function.
If you are querying the registry on a computer running Windows NT, the function sets the members of the FILETIME structure to indicate the last time that the key or any of its value entries was modified.
If you are querying the registry on a computer running Windows 95, the function sets the members of the FILETIME structure to zero. This is because the Windows 95 operating system does not keep track of registry key last write time information.
If the function succeeds, the return value is ERROR_SUCCESS.
If the function fails, the return value is a nonzero error code defined in WINERROR.H. You can use the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag to get a generic description of the error.
The key identified by the hKey parameter must have been opened with KEY_QUERY_VALUE access (KEY_READ access includes KEY_QUERY_VALUE access).
FILETIME, RegDeleteKey, RegEnumKey, RegEnumKeyEx, RegEnumValue, RegQueryValue, RegQueryValueEx