ReactOS 0.4.15-dev-8241-g63935f8
config.c File Reference
#include <ntoskrnl.h>
#include <debug.h>
Include dependency graph for config.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

PCONFIGURATION_COMPONENT_DATA NTAPI KeFindConfigurationEntry (IN PCONFIGURATION_COMPONENT_DATA Child, IN CONFIGURATION_CLASS Class, IN CONFIGURATION_TYPE Type, IN PULONG ComponentKey OPTIONAL)
 
PCONFIGURATION_COMPONENT_DATA NTAPI KeFindConfigurationNextEntry (IN PCONFIGURATION_COMPONENT_DATA Child, IN CONFIGURATION_CLASS Class, IN CONFIGURATION_TYPE Type, IN PULONG ComponentKey OPTIONAL, IN PCONFIGURATION_COMPONENT_DATA *NextLink)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file config.c.

Function Documentation

◆ KeFindConfigurationEntry()

PCONFIGURATION_COMPONENT_DATA NTAPI KeFindConfigurationEntry ( IN PCONFIGURATION_COMPONENT_DATA  Child,
IN CONFIGURATION_CLASS  Class,
IN CONFIGURATION_TYPE  Type,
IN PULONG ComponentKey  OPTIONAL 
)

Definition at line 22 of file config.c.

26{
28
29 /* Start Search at Root */
31 Class,
32 Type,
33 ComponentKey,
34 &NextLink);
35}
Type
Definition: Type.h:7
#define NULL
Definition: types.h:112
PCONFIGURATION_COMPONENT_DATA NTAPI KeFindConfigurationNextEntry(IN PCONFIGURATION_COMPONENT_DATA Child, IN CONFIGURATION_CLASS Class, IN CONFIGURATION_TYPE Type, IN PULONG ComponentKey OPTIONAL, IN PCONFIGURATION_COMPONENT_DATA *NextLink)
Definition: config.c:42
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFDEVICE Child
Definition: wdffdo.h:536

◆ KeFindConfigurationNextEntry()

PCONFIGURATION_COMPONENT_DATA NTAPI KeFindConfigurationNextEntry ( IN PCONFIGURATION_COMPONENT_DATA  Child,
IN CONFIGURATION_CLASS  Class,
IN CONFIGURATION_TYPE  Type,
IN PULONG ComponentKey  OPTIONAL,
IN PCONFIGURATION_COMPONENT_DATA NextLink 
)

Definition at line 42 of file config.c.

47{
48 ULONG Key = 0;
49 ULONG Mask = 0;
52
53 /* If we did get a key, then use it instead */
54 if (ComponentKey)
55 {
56 Key = *ComponentKey;
57 Mask = -1;
58 }
59
60 /* Loop the Components until we find a a match */
61 while (Child)
62 {
63 /* Check if we are starting somewhere already */
64 if (*NextLink)
65 {
66 /* If we've found the place where we started, clear and continue */
67 if (Child == *NextLink) *NextLink = NULL;
68 }
69 else
70 {
71 /* Try to get a match */
72 if ((Child->ComponentEntry.Class) == Class &&
73 (Child->ComponentEntry.Type) == Type &&
74 (Child->ComponentEntry.Key & Mask) == Key)
75 {
76 /* Match found */
77 return Child;
78 }
79 }
80
81 /* Now we've also got to lookup the siblings */
82 Sibling = Child->Sibling;
83 while (Sibling)
84 {
85 /* Check if we are starting somewhere already */
86 if (*NextLink)
87 {
88 /* If we've found the place where we started, clear and continue */
89 if (Sibling == *NextLink) *NextLink = NULL;
90 }
91 else
92 {
93 /* Try to get a match */
94 if ((Sibling->ComponentEntry.Class == Class) &&
95 (Sibling->ComponentEntry.Type == Type) &&
96 (Sibling->ComponentEntry.Key & Mask) == Key)
97 {
98 /* Match found */
99 return Sibling;
100 }
101 }
102
103 /* We've got to check if the Sibling has a Child as well */
104 if (Sibling->Child)
105 {
106 /* We're just going to call ourselves again */
107 ReturnEntry = KeFindConfigurationNextEntry(Sibling->Child,
108 Class,
109 Type,
110 ComponentKey,
111 NextLink);
112 if (ReturnEntry) return ReturnEntry;
113 }
114
115 /* Next Sibling */
116 Sibling = Sibling->Sibling;
117 }
118
119 /* Next Child */
120 Child = Child->Child;
121 }
122
123 /* If we got here, nothing was found */
124 return NULL;
125}
unsigned int Mask
Definition: fpcontrol.c:82
CONFIGURATION_COMPONENT ComponentEntry
Definition: arc.h:168
struct _CONFIGURATION_COMPONENT_DATA * Sibling
Definition: arc.h:167
struct _CONFIGURATION_COMPONENT_DATA * Child
Definition: arc.h:166
CONFIGURATION_TYPE Type
Definition: arc.h:152
CONFIGURATION_CLASS Class
Definition: arc.h:151
uint32_t ULONG
Definition: typedefs.h:59

Referenced by HalpAcpiFindRsdtPhase0(), KeFindConfigurationEntry(), and KeFindConfigurationNextEntry().