Using Search Routines
RegistryEntrySearch,
RegistryEntryPropertyMod, and
RegistryEntryMod
are used to search the Name Registry for entries having a specific property or set of modifiers. The set of entries to be searched is defined by a starting entry and a relationship. The relationship determines which entries relative to the starting entry are to be included in the search--children, parents, siblings, or descendants.
Follow these rules when using search routines:
-
When an entry iterator is created via
RegistryEntryIterateCreate, it is initialized to the default starting entry root and to the relationship of the
kRegIterDescendants
parameter. A subsequent search call using these default values will include all entries in the Name Registry.
-
You can use
RegistryEntryIterateSet
to set the iterator to some name entry other than the root, limiting the iteration to some subset of the Name Registry. To change the default relationship, specify a new relationship as a parameter to your first search call.
-
Search routines are designed to be iterative, allowing you to search for multiple instances of the same thing within a set of entries. To continue a search, make the same call again, specifying
kRegIterContinue
as the relationship. The routine will continue where it left off and will find new entries that meet the same search criteria.
-
To change the search criteria (property name, value, or modifiers) or the set of entries to be searched, reset the iterator. Use
RegistryEntryIterateSet
to set a new starting entry and then specify a new relationship in the next search call.
-
A search operation is complete when either it finds what it is looking for or the
done
parameter returns
true, indicating that there are no more name entries that meet the search criteria. When
done
is
true
no error code is returned and the contents of
foundEntry
are indeterminate. The iterator must be reset, using
RegistryEntryIterateSet, before it can be used again for a subsequent search or iterate operation.
Here is a typical search sequence:
-
Get an iterator.
-
Set the starting point if it is other than the root.
-
Set the relationship in the first search call.
-
Do the search call.
-
Repeat the search call with the relationship set to
kRegIterContinue.
© 1999 Apple Computer, Inc. (Last Updated 26 March 99)