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 PCONFIGURATION_COMPONENT_DATA NextLink
= NULL
;
29 /* Start Search at Root */
30 return KeFindConfigurationNextEntry(Child
,
40 PCONFIGURATION_COMPONENT_DATA
42 KeFindConfigurationNextEntry(IN PCONFIGURATION_COMPONENT_DATA Child
,
43 IN CONFIGURATION_CLASS Class
,
44 IN CONFIGURATION_TYPE Type
,
45 IN PULONG ComponentKey OPTIONAL
,
46 IN PCONFIGURATION_COMPONENT_DATA
*NextLink
)
50 PCONFIGURATION_COMPONENT_DATA Sibling
;
51 PCONFIGURATION_COMPONENT_DATA ReturnEntry
;
53 /* If we did get a key, then use it instead */
60 /* Loop the Components until we find a a match */
63 /* Check if we are starting somewhere already */
66 /* If we've found the place where we started, clear and continue */
67 if (Child
== *NextLink
) *NextLink
= NULL
;
71 /* Try to get a match */
72 if ((Child
->ComponentEntry
.Class
) == Class
&&
73 (Child
->ComponentEntry
.Type
) == Type
&&
74 (Child
->ComponentEntry
.Key
& Mask
) == Key
)
81 /* Now we've also got to lookup the siblings */
82 Sibling
= Child
->Sibling
;
85 /* Check if we are starting somewhere already */
88 /* If we've found the place where we started, clear and continue */
89 if (Sibling
== *NextLink
) *NextLink
= NULL
;
93 /* Try to get a match */
94 if ((Sibling
->ComponentEntry
.Class
== Class
) &&
95 (Sibling
->ComponentEntry
.Type
== Type
) &&
96 (Sibling
->ComponentEntry
.Key
& Mask
) == Key
)
103 /* We've got to check if the Sibling has a Child as well */
106 /* We're just going to call ourselves again */
107 ReturnEntry
= KeFindConfigurationNextEntry(Sibling
->Child
,
112 if (ReturnEntry
) return ReturnEntry
;
116 Sibling
= Sibling
->Sibling
;
120 Child
= Child
->Child
;
123 /* If we got here, nothign was found */