# RegQueryInfoOnKey

int RegQueryInfoOnKey (unsigned int rootKey, const char subkeyName[], unsigned int *numberOfSubkeys, unsigned int *numberOfValues, unsigned int *maxSubkeyLength, unsigned int *maxValueNameLength, unsigned int *maxValueLength);

## Purpose

This function gathers information about the specified Key Value in the Windows Registry. You must specify a Root Key, and a Subkey of that Root Key which you want to read.

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

}

## Parameters

Input
Name | Type | Description
rootKey | unsigned integer | The Root Key under which you wish to access a Subkey and its information. See the Windows Registry functions Class help for more information on Root Keys.
subkeyName | const char [] | The name of the Subkey, relative to the Root Key, about which you wish to obtain information. See the Windows Registry functions Class help for more information on Subkeys.
Output
Name | Type | Description
numberOfSubkeys | unsigned integer * | Returns the actual number of Subkeys associated with the specified registry Key. This parameter may be NULL.
numberOfValues | unsigned integer * | Returns the actual number of values associated with the specified registry Key. This parameter may be NULL.
maxSubkeyLength | unsigned integer * | Returns the length of the key's subkey with the longest name. This parameter may be NULL. The length does not include the terminating NUL character.
maxValueNameLength | unsigned integer * | Returns the length of the longest value name associated with the specified registry Key. This parameter may be NULL. The length does not include the terminating NUL character.
maxValueLength | unsigned integer * | Returns the length of the longest value associated with the specified registry Key. This parameter may be NULL. If the data type is string (_REG_SZ), the length includes the terminating NUL character.

## Return Value

Name | Type | Description
status | integer | 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.