Admin Production ni-theme
Current Publication

RegEnumerateValue

LabWindows/CVI

RegEnumerateValue

int RegEnumerateValue (unsigned int rootKey, const char subkeyName[], unsigned int index, char valueName[], unsigned int *valueNameLength, void *dataBuffer, unsigned int *dataLength, int *valueType);

Purpose

This function enumerates the values for the specified key in the Windows Registry. This function copies one indexed value name and data block for the key each time it is called. You must specify a Root Key, a Subkey of that Root Key, and index of the value which you want to read.

If you do not know the size of the data in the Registry, you may pass NULL for the dataBuffer parameter. The function will determine the size of the data and return it through dataSize. You may then use this value to allocate appropriate space for the data, and call the function again.

Example:

unsigned char string[512];
unsigned int size1,size2,values,i;
int type;
char valueName[MAX_PATH];

RegQueryInfoOnKey (REGKEY_HKLM, "Software\\MySubKey",
                   NULL, &values, NULL, NULL, NULL);
for(i=0;i<values;i++) {

size1 = MAX_PATH; size2 = 512;
RegEnumerateValue (REGKEY_HKLM, "Software\\MySubKey",
                   i, valueName, &size1, string, &size2,
                   &type);
if( type==_REG_SZ )
     // Process the data

}

(Linux) This function is not supported.

Parameters

Input
Name Type Description
rootKey unsigned int The Root Key under which you wish to access a Subkey and its value.

See the Windows Registry functions Class help for more information about Root Keys.
subkeyName const char[] The name of the Subkey, relative to the Root Key, from which you wish to read the value.

See the Windows Registry functions Class help for more information about Subkeys.
index unsigned int The index of the value which you wish to read.

This parameter should be zero for the first call to this function and then be incremented for subsequent calls.

See example in function help.
Output
Name Type Description
valueName char [] Buffer into which the name of the value will be stored. The buffer has to be long enough to store also the terminating NUL character.
valueNameLength unsigned int Returns the actual length of the value name. This parameter may be NULL only if the parameter valueName is NULL.

Use this parameter to pass the size of the buffer for the value name (including the terminating NUL character) and to receive the actual length of the value name read from the Windows Registry (the returned number of characters does not include the terminating NUL character).
dataBuffer void * Buffer into which the value will be stored. If the value is of type string (_REG_SZ), the buffer has to be long enough to store also the terminating NUL character.
dataLength unsigned int Returns the actual size of the data. This parameter may be NULL only if the parameter dataBuffer is NULL.

Use this parameter to pass the size of the buffer for the data (including the terminating NUL character for string type) and to receive the actual length of the data read from the Windows Registry.
valueType int Returns the actual type of the data. This parameter may be NULL.

The data type can be one of the following constants defined in the toolbox header file:

_REG_NONE
_REG_SZ
_REG_EXPAND_SZ
_REG_BINARY
_REG_DWORD
_REG_DWORD_LITTLE_ENDIAN
_REG_DWORD_BIG_ENDIAN
_REG_LINK
_REG_MULTI_SZ
_REG_RESOURCE_LIST
_REG_FULL_RESOURCE_DESCRIPTOR
_REG_RESOURCE_REQUIREMENTS_LIST

Return Value

Name Type Description
status int The status code that the function returns.

0 indicates success.

A negative value indicates an error.

This function may return a Programmer's Toolbox or UI Library error code. Call GetGeneralErrorString to obtain a text description of the error.

Additional Information

Library: Programmer's Toolbox

Include file: toolbox\toolbox.h

LabWindows/CVI compatibility: LabWindows/CVI 5.5 and later