test: config.c File Reference

Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# config.c File Reference

`#include "ki.h"`

Go to the source code of this file.

## Functions

PCONFIGURATION_COMPONENT_DATA | KeFindConfigurationEntry (IN PCONFIGURATION_COMPONENT_DATA Child, IN CONFIGURATION_CLASS Class, IN CONFIGURATION_TYPE Type, IN PULONG Key OPTIONAL)
PCONFIGURATION_COMPONENT_DATA | KeFindConfigurationNextEntry (IN PCONFIGURATION_COMPONENT_DATA Child, IN CONFIGURATION_CLASS Class, IN CONFIGURATION_TYPE Type, IN PULONG Key OPTIONAL, IN PCONFIGURATION_COMPONENT_DATA *Resume)

## Function Documentation

PCONFIGURATION_COMPONENT_DATA KeFindConfigurationEntry | ( | IN PCONFIGURATION_COMPONENT_DATA | Child,
|  | IN CONFIGURATION_CLASS | Class,
|  | IN CONFIGURATION_TYPE | Type,
|  | IN PULONG Key | OPTIONAL
| ) |

Definition at line 34 of file config.c.

References KeFindConfigurationNextEntry(), Key, and NULL.

Referenced by CmpInitializeHardwareConfiguration().

    00042                    :
    00043
    00044     This function search the specified configuration tree and returns a
    00045     pointer to an entry that matches the specified class, type, and key
    00046     parameters.
    00047
    00048     This routine is the same as KeFindConfurationEntryNext expect
    00049     that the search is performed from the first entry
    00050
    00051     N.B. This routine can only be called during system initialization.
    00052
    00053 --*/
    00054 {
    00055     PCONFIGURATION_COMPONENT_DATA Resume;
    00056
    00057     Resume = NULL;
    00058     return KeFindConfigurationNextEntry (Child, Class, Type, Key, &Resume);
    00059 }

PCONFIGURATION_COMPONENT_DATA KeFindConfigurationNextEntry | ( | IN PCONFIGURATION_COMPONENT_DATA | Child,
|  | IN CONFIGURATION_CLASS | Class,
|  | IN CONFIGURATION_TYPE | Type,
|  | IN PULONG Key | OPTIONAL,
|  | IN PCONFIGURATION_COMPONENT_DATA * | Resume
| ) |

Definition at line 62 of file config.c.

References _CONFIGURATION_COMPONENT_DATA::Child, _CONFIGURATION_COMPONENT::Class, _CONFIGURATION_COMPONENT_DATA::ComponentEntry, _CONFIGURATION_COMPONENT::Key, Key, NULL, _CONFIGURATION_COMPONENT_DATA::Sibling, and _CONFIGURATION_COMPONENT::Type.

Referenced by KeFindConfigurationEntry().

    00072                    :
    00073
    00074     This function search the specified configuration tree and returns a
    00075     pointer to an entry that matches the specified class, type, and key
    00076     parameters.
    00077
    00078     N.B. This routine can only be called during system initialization.
    00079
    00080 Arguments:
    00081
    00082     Child - Supplies an optional pointer to an NT configuration component.
    00083
    00084     Class - Supplies the configuration class of the entry to locate.
    00085
    00086     Type - Supplies the configuration type of the entry to locate.
    00087
    00088     Key - Supplies a pointer to an optional key value to use in locating
    00089         the specified entry.
    00090
    00091     Resume - Supplies the last returned entry for which the search
    00092         should resume from.
    00093
    00094 Return Value:
    00095
    00096     If the specified entry is located, then a pointer to the configuration
    00097     entry is returned as the function value. Otherwise, NULL is returned.
    00098
    00099 --*/
    00100
    00101 {
    00102
    00103     PCONFIGURATION_COMPONENT_DATA Entry;
    00104     ULONG MatchKey;
    00105     ULONG MatchMask;
    00106     PCONFIGURATION_COMPONENT_DATA Sibling;
    00107
    00108     //
    00109     // Initialize the match key and mask based on whether the optional key
    00110     // value is specified.
    00111     //
    00112
    00113     if (ARGUMENT_PRESENT(Key)) {
    00114         MatchMask = 0xffffffff;
    00115         MatchKey = *Key;
    00116
    00117     } else {
    00118         MatchMask = 0;
    00119         MatchKey = 0;
    00120     }
    00121
    00122     //
    00123     // Search specified configuration tree for an entry that matches the
    00124     // the specified class, type, and key.
    00125     //
    00126
    00127     while (Child != NULL) {
    00128         if (*Resume) {
    00129             //
    00130             // If resume location found, clear resume location and continue
    00131             // search with next entry
    00132             //
    00133
    00134             if (Child == *Resume) {
    00135                 *Resume = NULL;
    00136             }
    00137         } else {
    00138
    00139             //
    00140             // If the class, type, and key match, then return a pointer to
    00141             // the child entry.
    00142             //
    00143
    00144             if ((Child->ComponentEntry.Class == Class) &&
    00145                 (Child->ComponentEntry.Type == Type) &&
    00146                 ((Child->ComponentEntry.Key & MatchMask) == MatchKey)) {
    00147                 return Child;
    00148             }
    00149         }
    00150
    00151         //
    00152         // If the child has a sibling list, then search the sibling list
    00153         // for an entry that matches the specified class, type, and key.
    00154         //
    00155
    00156         Sibling = Child->Sibling;
    00157         while (Sibling != NULL) {
    00158             if (*Resume) {
    00159                 //
    00160                 // If resume location found, clear resume location and continue
    00161                 // search with next entry
    00162                 //
    00163
    00164                 if (Sibling == *Resume) {
    00165                     *Resume = NULL;
    00166                 }
    00167             } else {
    00168
    00169                 //
    00170                 // If the class, type, and key match, then return a pointer to
    00171                 // the child entry.
    00172                 //
    00173
    00174                 if ((Sibling->ComponentEntry.Class == Class) &&
    00175                     (Sibling->ComponentEntry.Type == Type) &&
    00176                     ((Sibling->ComponentEntry.Key & MatchMask) == MatchKey)) {
    00177                     return Sibling;
    00178                 }
    00179             }
    00180
    00181             //
    00182             // If the sibling has a child tree, then search the child tree
    00183             // for an entry that matches the specified class, type, and key.
    00184             //
    00185
    00186             if (Sibling->Child != NULL) {
    00187                Entry = KeFindConfigurationNextEntry (
    00188                                 Sibling->Child,
    00189                                 Class,
    00190                                 Type,
    00191                                 Key,
    00192                                 Resume
    00193                                 );
    00194
    00195                if (Entry != NULL) {
    00196                    return Entry;
    00197                }
    00198             }
    00199
    00200             Sibling = Sibling->Sibling;
    00201         }
    00202
    00203         Child = Child->Child;
    00204     }
    00205
    00206     return NULL;
    00207 }
    }