2 * PROJECT: ReactOS Kernel
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: ntoskrnl/ke/config.c
5 * PURPOSE: Configuration Tree Routines
6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
9 /* INCLUDES ******************************************************************/
15 /* FUNCTIONS *****************************************************************/
20 PCONFIGURATION_COMPONENT_DATA
22 KeFindConfigurationEntry(IN PCONFIGURATION_COMPONENT_DATA Child
,
23 IN CONFIGURATION_CLASS Class
,
24 IN CONFIGURATION_TYPE Type
,
25 IN PULONG ComponentKey OPTIONAL
)
27 /* Start Search at Root */
28 return KeFindConfigurationNextEntry(Child
,
38 PCONFIGURATION_COMPONENT_DATA
40 KeFindConfigurationNextEntry(IN PCONFIGURATION_COMPONENT_DATA Child
,
41 IN CONFIGURATION_CLASS Class
,
42 IN CONFIGURATION_TYPE Type
,
43 IN PULONG ComponentKey OPTIONAL
,
44 IN PCONFIGURATION_COMPONENT_DATA
*NextLink
)
48 PCONFIGURATION_COMPONENT_DATA Sibling
;
49 PCONFIGURATION_COMPONENT_DATA ReturnEntry
;
51 /* If we did get a key, then use it instead */
58 /* Loop the Components until we find a a match */
61 /* Check if we are starting somewhere already */
64 /* If we've found the place where we started, clear and continue */
65 if (Child
== *NextLink
) *NextLink
= NULL
;
69 /* Try to get a match */
70 if ((Child
->ComponentEntry
.Class
) == Class
&&
71 (Child
->ComponentEntry
.Type
) == Type
&&
72 (Child
->ComponentEntry
.Key
& Mask
) == Key
)
79 /* Now we've also got to lookup the siblings */
80 Sibling
= Child
->Sibling
;
83 /* Check if we are starting somewhere already */
86 /* If we've found the place where we started, clear and continue */
87 if (Sibling
== *NextLink
) *NextLink
= NULL
;
91 /* Try to get a match */
92 if ((Sibling
->ComponentEntry
.Class
== Class
) &&
93 (Sibling
->ComponentEntry
.Type
== Type
) &&
94 (Sibling
->ComponentEntry
.Key
& Mask
) == Key
)
101 /* We've got to check if the Sibling has a Child as well */
104 /* We're just going to call ourselves again */
105 ReturnEntry
= KeFindConfigurationNextEntry(Sibling
->Child
,
110 if (ReturnEntry
) return ReturnEntry
;
114 Sibling
= Sibling
->Sibling
;
118 Child
= Child
->Child
;
121 /* If we got here, nothign was found */