[Win32 API] RegQueryInfoKey
저장소/VC++RegQueryInfoKey Function
Retrieves information about the specified registry key.
LONG WINAPI RegQueryInfoKey( __in HKEY hKey, __out LPTSTR lpClass, __in_out LPDWORD lpcClass, LPDWORD lpReserved, __out LPDWORD lpcSubKeys, __out LPDWORD lpcMaxSubKeyLen, __out LPDWORD lpcMaxClassLen, __out LPDWORD lpcValues, __out LPDWORD lpcMaxValueNameLen, __out LPDWORD lpcMaxValueLen, __out LPDWORD lpcbSecurityDescriptor, __out PFILETIME lpftLastWriteTime );
Parameters
- hKey
-
A handle to an open registry key. The key must have been opened with the KEY_QUERY_VALUE access right. For more information, see Registry Key Security and Access Rights.
This handle is returned by the RegCreateKeyEx, RegCreateKeyTransacted, RegOpenKeyEx, or RegOpenKeyTransacted 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_USERSWindows Me/98/95: This parameter can also be the following key:
- HKEY_DYN_DATA
- lpClass
-
A pointer to a buffer that receives the key class. This parameter can be NULL.
- lpcClass
-
A pointer to a variable that specifies the size of the buffer pointed to by the lpClass parameter, in characters.
The size should include the terminating null character. When the function returns, this variable contains the size of the class string that is 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 terminating null character.
If lpClass is NULL, lpcClass can be NULL.
If the lpClass parameter is a valid address, but the lpcClass parameter is not, for example, it is NULL, then the function returns ERROR_INVALID_PARAMETER.
Windows Me/98/95: If the lpClass parameter is a valid address, but the lpcClass parameter is not, for example, it is NULL, then the function returns ERROR_SUCCESS instead of ERROR_INVALID_PARAMETER. To ensure compatibility with other platforms, verify that lpcClass is valid before calling the function.
- lpReserved
-
This parameter is reserved and must be NULL.
- lpcSubKeys
-
A pointer to a variable that receives the number of subkeys that are contained by the specified key. This parameter can be NULL.
- lpcMaxSubKeyLen
-
A pointer to a variable that receives the size of the key's subkey with the longest name, in Unicode characters, not including the terminating null character. This parameter can be NULL.
Windows Me/98/95: The size includes the terminating null character.
- lpcMaxClassLen
-
A pointer to a variable that receives the size of the longest string that specifies a subkey class, in Unicode characters. The count returned does not include the terminating null character. This parameter can be NULL.
- lpcValues
-
A pointer to a variable that receives the number of values that are associated with the key. This parameter can be NULL.
- lpcMaxValueNameLen
-
A pointer to a variable that receives the size of the key's longest value name, in Unicode characters. The size does not include the terminating null character. This parameter can be NULL.
- lpcMaxValueLen
-
A pointer to a variable that receives the size of the longest data component among the key's values, in bytes. This parameter can be NULL.
- lpcbSecurityDescriptor
-
A pointer to a variable that receives the size of the key's security descriptor, in bytes. This parameter can be NULL.
- lpftLastWriteTime
-
A pointer to a FILETIME structure that receives the last write time. This parameter can be NULL.
The function sets the members of the FILETIME structure to indicate the last time that the key or any of its value entries is modified.
Windows Me/98/95: The function sets the members of the FILETIME structure to 0 (zero), because the system does not keep track of registry key last write time information.
Return Value
If the function succeeds, the return value is ERROR_SUCCESS.
If the function fails, the return value is a
If the lpClass buffer is too small to receive the name of the class, the function returns ERROR_MORE_DATA.
Example Code
For an example, see Enumerating Registry Subkeys.
Requirements
Client |
Requires Windows Vista, Windows XP, Windows 2000 Professional, Windows NT Workstation, Windows Me, Windows 98, or Windows 95. |
---|---|
Server |
Requires Windows Server 2008, Windows Server 2003, Windows 2000 Server, or Windows NT Server. |
Header |
Declared in Winreg.h; include Windows.h. |
Library |
Use Advapi32.lib. |
DLL |
Requires Advapi32.dll. |
Unicode |
Implemented as RegQueryInfoKeyW (Unicode) and RegQueryInfoKeyA (ANSI). |
'저장소 > VC++' 카테고리의 다른 글
[MFC] Esc Key 또는 Return Key에 의해 Dialog가 닫힐 때 처리 방법 (0) | 2011.01.26 |
---|---|
[MFC] OnCancel(), OnClose(), OnDestroy(), OnOK() 그리고 Dialog 소멸자 (0) | 2011.01.04 |
[Win32 API] Registry Element Size Limits (0) | 2010.12.16 |
[Win32 API] RegEnumKeyEx (0) | 2010.12.16 |
[Win32 API] File Version (0) | 2010.11.09 |