Repeated calls to RegistryPropertyIterate use the iterator returned by RegistryPropertyIterateCreate to iterate through a succession of properties.
OSStatus RegistryPropertyIterate (
RegPropertyIter *cookie,
RegPropertyName *foundProperty,
Boolean *done);
RegistryPropertyIterate moves from property to property among the properties of the name entry specified in a prior RegistryPropertyIterateCreate call (see previous section). It returns the name of the next property in foundProperty, or true in done if all properties have been iterated through.
Listing 10-8 shows code that uses RegistryPropertyIterate to iterate through all the properties for a given name entry.
Listing 10-8 Iterating through properties
OSStatus IterateDeviceProperties(
constRegEntryID *deviceEntry
)
{
RegPropertyNameBuf propertyName;
RegPropertyIter cookie;
Boolean done;
OSStatus err = noErr;
err = RegistryPropertyIterateCreate(deviceEntry, &cookie);
if (err!=noErr) {
do{
err = RegistryPropertyIterate(&cookie, &propertyName[0], &done);
if (err != noErr)
break;
/*
* Do something with the property, given the property name
* you can use RegistryPropertyGetSize to determine the size
* of the value and and RegistryPropertyGet to retrieve the value.
*/
} while (!done && err == noErr);
}
RegistryPropertyIterateDispose(&cookie);
returnerr;
}