ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

config.c
Go to the documentation of this file.
00001 /*
00002  * PROJECT:         ReactOS Kernel
00003  * LICENSE:         GPL - See COPYING in the top level directory
00004  * FILE:            ntoskrnl/ke/config.c
00005  * PURPOSE:         Configuration Tree Routines
00006  * PROGRAMMERS:     Alex Ionescu (alex.ionescu@reactos.org)
00007  */
00008 
00009 /* INCLUDES ******************************************************************/
00010 
00011 #include <ntoskrnl.h>
00012 #define NDEBUG
00013 #include <debug.h>
00014 
00015 /* FUNCTIONS *****************************************************************/
00016 
00017 /*
00018  * @implemented
00019  */
00020 PCONFIGURATION_COMPONENT_DATA
00021 NTAPI
00022 INIT_FUNCTION
00023 KeFindConfigurationEntry(IN PCONFIGURATION_COMPONENT_DATA Child,
00024                          IN CONFIGURATION_CLASS Class,
00025                          IN CONFIGURATION_TYPE Type,
00026                          IN PULONG ComponentKey OPTIONAL)
00027 {
00028     PCONFIGURATION_COMPONENT_DATA NextLink = NULL;
00029 
00030     /* Start Search at Root */
00031     return KeFindConfigurationNextEntry(Child,
00032                                         Class,
00033                                         Type,
00034                                         ComponentKey,
00035                                         &NextLink);
00036 }
00037 
00038 /*
00039  * @implemented
00040  */
00041 PCONFIGURATION_COMPONENT_DATA
00042 NTAPI
00043 INIT_FUNCTION
00044 KeFindConfigurationNextEntry(IN PCONFIGURATION_COMPONENT_DATA Child,
00045                              IN CONFIGURATION_CLASS Class,
00046                              IN CONFIGURATION_TYPE Type,
00047                              IN PULONG ComponentKey OPTIONAL,
00048                              IN PCONFIGURATION_COMPONENT_DATA *NextLink)
00049 {
00050     ULONG Key = 0;
00051     ULONG Mask = 0;
00052     PCONFIGURATION_COMPONENT_DATA Sibling;
00053     PCONFIGURATION_COMPONENT_DATA ReturnEntry;
00054 
00055     /* If we did get a key, then use it instead */
00056     if (ComponentKey)
00057     {
00058         Key = *ComponentKey;
00059         Mask = -1;
00060     }
00061 
00062     /* Loop the Components until we find a a match */
00063     while (Child)
00064     {
00065         /* Check if we are starting somewhere already */
00066         if (*NextLink)
00067         {
00068             /* If we've found the place where we started, clear and continue */
00069             if (Child == *NextLink) *NextLink = NULL;
00070         }
00071         else
00072         {
00073             /* Try to get a match */
00074             if ((Child->ComponentEntry.Class) == Class &&
00075                 (Child->ComponentEntry.Type) == Type &&
00076                 (Child->ComponentEntry.Key & Mask) == Key)
00077             {
00078                 /* Match found */
00079                 return Child;
00080             }
00081         }
00082 
00083         /* Now we've also got to lookup the siblings */
00084         Sibling = Child->Sibling;
00085         while (Sibling)
00086         {
00087             /* Check if we are starting somewhere already */
00088             if (*NextLink)
00089             {
00090                 /* If we've found the place where we started, clear and continue */
00091                 if (Sibling == *NextLink) *NextLink = NULL;
00092             }
00093             else
00094             {
00095                 /* Try to get a match */
00096                 if ((Sibling->ComponentEntry.Class == Class) &&
00097                     (Sibling->ComponentEntry.Type == Type) &&
00098                     (Sibling->ComponentEntry.Key & Mask) == Key)
00099                 {
00100                     /* Match found */
00101                     return Sibling;
00102                 }
00103             }
00104 
00105             /* We've got to check if the Sibling has a Child as well */
00106             if (Sibling->Child)
00107             {
00108                 /* We're just going to call ourselves again */
00109                 ReturnEntry = KeFindConfigurationNextEntry(Sibling->Child,
00110                                                            Class,
00111                                                            Type,
00112                                                            ComponentKey,
00113                                                            NextLink);
00114                 if (ReturnEntry) return ReturnEntry;
00115             }
00116 
00117             /* Next Sibling */
00118             Sibling = Sibling->Sibling;
00119         }
00120 
00121         /* Next Child */
00122         Child = Child->Child;
00123     }
00124 
00125     /* If we got here, nothign was found */
00126     return NULL;
00127 }

Generated on Sat May 26 2012 04:17:42 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.