RegQueryMultipleValuesA function (winreg.h)
Retrieves the type and data for a list of value names associated with an open registry key.
Syntax
LSTATUS RegQueryMultipleValuesA(
[in] HKEY hKey,
[out] PVALENTA val_list,
[in] DWORD num_vals,
[out, optional] LPSTR lpValueBuf,
[in, out, optional] LPDWORD ldwTotsize
);
Parameters
[in] 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_USERS
[out] val_list
A pointer to an array of
VALENT structures that describe one or more value entries. On input, the ve_valuename member of each structure must contain a pointer to the name of a value to retrieve. The function fails if any of the specified values do not exist in the specified key.
If the function succeeds, each element of the array contains the information for the specified value.
[in] num_vals
The number of elements in the val_list array.
[out, optional] lpValueBuf
A pointer to a buffer. If the function succeeds, the buffer receives the data for each value.
If lpValueBuf is NULL, the value pointed to by the ldwTotsize parameter must be zero, in which case the function returns ERROR_MORE_DATA and ldwTotsize receives the required size of the buffer, in bytes.
[in, out, optional] ldwTotsize
A pointer to a variable that specifies the size of the buffer pointed to by the lpValueBuf parameter, in bytes. If the function succeeds, ldwTotsize receives the number of bytes copied to the buffer. If the function fails because the buffer is too small, ldwTotsize receives the required size, in bytes.
Return value
If the function succeeds, the return value is ERROR_SUCCESS.
If the function fails, the return value is one of the following error codes.
Return code | Description |
---|---|
|
RegQueryMultipleValues cannot instantiate or access the provider of the dynamic key. |
|
The buffer pointed to by lpValueBuf was too small. In this case, ldwTotsize receives the required buffer size. |
|
The total size of the requested data (size of the val_list array + ldwTotSize) is more than the system limit of one megabyte. |
Remarks
The RegQueryMultipleValues function allows an application to query one or more values of a static or dynamic key. If the target key is a static key, the system provides all of the values in an atomic fashion. To prevent excessive serialization, the aggregate data returned by the function cannot exceed one megabyte.
If the target key is a dynamic key, its provider must provide all the values in an atomic fashion. This means the provider should fill the results buffer synchronously, providing a consistent view of all the values in the buffer while avoiding excessive serialization. The provider can provide at most one megabyte of total output data during an atomic call to this function.
RegQueryMultipleValues is supported remotely; that is, the hKey parameter passed to the function can refer to a remote computer.
Note
The winreg.h header defines RegQueryMultipleValues as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | winreg.h (include Windows.h) |
Library | Advapi32.lib |
DLL | Advapi32.dll |