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
23 KeFindConfigurationEntry(IN PCONFIGURATION_COMPONENT_DATA Child
,
24 IN CONFIGURATION_CLASS Class
,
25 IN CONFIGURATION_TYPE Type
,
26 IN PULONG ComponentKey OPTIONAL
)
28 PCONFIGURATION_COMPONENT_DATA NextLink
= NULL
;
30 /* Start Search at Root */
31 return KeFindConfigurationNextEntry(Child
,
41 PCONFIGURATION_COMPONENT_DATA
44 KeFindConfigurationNextEntry(IN PCONFIGURATION_COMPONENT_DATA Child
,
45 IN CONFIGURATION_CLASS Class
,
46 IN CONFIGURATION_TYPE Type
,
47 IN PULONG ComponentKey OPTIONAL
,
48 IN PCONFIGURATION_COMPONENT_DATA
*NextLink
)
52 PCONFIGURATION_COMPONENT_DATA Sibling
;
53 PCONFIGURATION_COMPONENT_DATA ReturnEntry
;
55 /* If we did get a key, then use it instead */
62 /* Loop the Components until we find a a match */
65 /* Check if we are starting somewhere already */
68 /* If we've found the place where we started, clear and continue */
69 if (Child
== *NextLink
) *NextLink
= NULL
;
73 /* Try to get a match */
74 if ((Child
->ComponentEntry
.Class
) == Class
&&
75 (Child
->ComponentEntry
.Type
) == Type
&&
76 (Child
->ComponentEntry
.Key
& Mask
) == Key
)
83 /* Now we've also got to lookup the siblings */
84 Sibling
= Child
->Sibling
;
87 /* Check if we are starting somewhere already */
90 /* If we've found the place where we started, clear and continue */
91 if (Sibling
== *NextLink
) *NextLink
= NULL
;
95 /* Try to get a match */
96 if ((Sibling
->ComponentEntry
.Class
== Class
) &&
97 (Sibling
->ComponentEntry
.Type
== Type
) &&
98 (Sibling
->ComponentEntry
.Key
& Mask
) == Key
)
105 /* We've got to check if the Sibling has a Child as well */
108 /* We're just going to call ourselves again */
109 ReturnEntry
= KeFindConfigurationNextEntry(Sibling
->Child
,
114 if (ReturnEntry
) return ReturnEntry
;
118 Sibling
= Sibling
->Sibling
;
122 Child
= Child
->Child
;
125 /* If we got here, nothign was found */