Add an ARC Header for future purposes (PPC, ARM, etc, ARCLoader) and implement KeFindConfigurationNextEntry and fix the definition
Added: trunk/reactos/include/arc/
Added: trunk/reactos/include/arc/arc.h
Modified: trunk/reactos/include/ddk/kefuncs.h
Modified: trunk/reactos/include/ddk/ketypes.h
Modified: trunk/reactos/ntoskrnl/ke/device.c

Added: trunk/reactos/include/arc/arc.h
--- trunk/reactos/include/arc/arc.h	2005-06-14 14:44:11 UTC (rev 15910)
+++ trunk/reactos/include/arc/arc.h	2005-06-14 17:37:07 UTC (rev 15911)
@@ -0,0 +1,45 @@
+/* ARC LOADER TYPES *********************************************************/
+
+#ifndef __INCLUDE_ARC_H
+#define __INCLUDE_ARC_H
+
+/* Types */
+
+typedef enum _IDENTIFIER_FLAG
+{
+    Failed = 0x01,
+    ReadOnly = 0x02,
+    Removable = 0x04,
+    ConsoleIn = 0x08,
+    ConsoleOut = 0x10,
+    Input = 0x20,
+    Output = 0x40
+} IDENTIFIER_FLAG;
+
+typedef enum _CONFIGURATION_CLASS
+{
+    SystemClass,
+    ProcessorClass,
+    CacheClass,
+    AdapterClass,
+    ControllerClass,
+    PeripheralClass,
+    MemoryClass,
+    MaximumClass
+} CONFIGURATION_CLASS;
+
+typedef struct _CONFIGURATION_COMPONENT
+{
+    CONFIGURATION_CLASS Class;
+    CONFIGURATION_TYPE Type;
+    IDENTIFIER_FLAG Flags;
+    USHORT Version;
+    USHORT Revision;
+    ULONG Key;
+    ULONG AffinityMask;
+    ULONG ConfigurationDataLength;
+    ULONG IdentifierLength;
+    LPSTR Identifier;
+} CONFIGURATION_COMPONENT, *PCONFIGURATION_COMPONENT;
+
+#endif

Modified: trunk/reactos/include/ddk/kefuncs.h
--- trunk/reactos/include/ddk/kefuncs.h	2005-06-14 14:44:11 UTC (rev 15910)
+++ trunk/reactos/include/ddk/kefuncs.h	2005-06-14 17:37:07 UTC (rev 15911)
@@ -636,25 +636,25 @@
 	IN PKTHREAD *Thread OPTIONAL
 );
 
-PVOID
+PCONFIGURATION_COMPONENT_DATA
 STDCALL
-KeFindConfigurationEntry(
-    IN PVOID Unknown,
-    IN ULONG Class,
+KeFindConfigurationNextEntry(
+    IN PCONFIGURATION_COMPONENT_DATA Child,
+    IN CONFIGURATION_CLASS Class,
     IN CONFIGURATION_TYPE Type,
-    IN PULONG RegKey
+    IN PULONG ComponentKey OPTIONAL,
+    IN PCONFIGURATION_COMPONENT_DATA *NextLink
 );
-
-PVOID
+                             
+PCONFIGURATION_COMPONENT_DATA
 STDCALL
-KeFindConfigurationNextEntry(
-    IN PVOID Unknown,
-    IN ULONG Class,
+KeFindConfigurationEntry(
+    IN PCONFIGURATION_COMPONENT_DATA Child,
+    IN CONFIGURATION_CLASS Class,
     IN CONFIGURATION_TYPE Type,
-    IN PULONG RegKey,
-    IN PVOID *NextLink
+    IN PULONG ComponentKey OPTIONAL
 );
-
+                         
 VOID
 STDCALL
 KeFlushEntireTb(

Modified: trunk/reactos/include/ddk/ketypes.h
--- trunk/reactos/include/ddk/ketypes.h	2005-06-14 14:44:11 UTC (rev 15910)
+++ trunk/reactos/include/ddk/ketypes.h	2005-06-14 17:37:07 UTC (rev 15911)
@@ -5,6 +5,8 @@
 
 /* include ntos/ketypes.h here? */
 
+#include <arc/arc.h>
+
 # define RESTRICTED_POINTER __restrict
 
 struct _KMUTANT;
@@ -339,6 +341,14 @@
     LONGLONG High;
 } M128, *PM128;
 
+typedef struct _CONFIGURATION_COMPONENT_DATA 
+{
+    struct _CONFIGURATION_COMPONENT_DATA *Parent;
+    struct _CONFIGURATION_COMPONENT_DATA *Child;
+    struct _CONFIGURATION_COMPONENT_DATA *Sibling;
+    CONFIGURATION_COMPONENT Component;
+} CONFIGURATION_COMPONENT_DATA, *PCONFIGURATION_COMPONENT_DATA;
+
 typedef struct _KEXCEPTION_FRAME {
     ULONG64 P1Home;
     ULONG64 P2Home;

Modified: trunk/reactos/ntoskrnl/ke/device.c
--- trunk/reactos/ntoskrnl/ke/device.c	2005-06-14 14:44:11 UTC (rev 15910)
+++ trunk/reactos/ntoskrnl/ke/device.c	2005-06-14 17:37:07 UTC (rev 15911)
@@ -1,5 +1,4 @@
-/* $Id$
- *
+/*
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/ke/device.c
@@ -13,43 +12,122 @@
 #include <internal/debug.h>
 
 /*
- * @unimplemented
+ * @implemented
  */
+PCONFIGURATION_COMPONENT_DATA
 STDCALL
-PVOID
-KeFindConfigurationNextEntry(
-    IN PVOID Unknown,
-    IN ULONG Class,
-    IN CONFIGURATION_TYPE Type,
-    IN PULONG RegKey,
-    IN PVOID *NextLink
-)
+INIT_FUNCTION
+KeFindConfigurationEntry(IN PCONFIGURATION_COMPONENT_DATA Child,
+                         IN CONFIGURATION_CLASS Class,
+                         IN CONFIGURATION_TYPE Type,
+                         IN PULONG ComponentKey OPTIONAL)
 {
-	UNIMPLEMENTED;
-	return 0;
+    /* Start Search at Root */
+    return KeFindConfigurationNextEntry(Child, 
+                                        Class, 
+                                        Type, 
+                                        ComponentKey, 
+                                        NULL);
 }
 
 /*
  * @implemented
  */
+PCONFIGURATION_COMPONENT_DATA
 STDCALL
-PVOID
-KeFindConfigurationEntry(
-    IN PVOID Unknown,
-    IN ULONG Class,
-    IN CONFIGURATION_TYPE Type,
-    IN PULONG RegKey
-)
+INIT_FUNCTION
+KeFindConfigurationNextEntry(IN PCONFIGURATION_COMPONENT_DATA Child,
+                             IN CONFIGURATION_CLASS Class,
+                             IN CONFIGURATION_TYPE Type,
+                             IN PULONG ComponentKey OPTIONAL,
+                             IN PCONFIGURATION_COMPONENT_DATA *NextLink)
 {
-	/* Start Search at Root */
-	return KeFindConfigurationNextEntry(Unknown, Class, Type, RegKey, NULL);
+    ULONG Key = 0;    
+    ULONG Mask = 0;
+    PCONFIGURATION_COMPONENT_DATA Sibling;
+    PCONFIGURATION_COMPONENT_DATA ReturnEntry;
+    
+    /* If we did get a key, then use it instead */
+    if (ComponentKey)
+    {
+        Key = *ComponentKey;
+        Mask = -1;
+    }
+    
+    /* Loop the Components until we find a a match */
+    while (Child)
+    {
+        /* Check if we are starting somewhere already */
+        if (*NextLink)
+        {
+            /* If we've found the place where we started, clear and continue */
+            if (Child == *NextLink) *NextLink = NULL;
+        } 
+        else
+        {
+            /* Try to get a match */
+            if (Child->Component.Class == Class &&
+                Child->Component.Type == Type &&
+                (Child->Component.Key & Mask) == Key)
+            {
+                /* Match found */
+                return Child;
+            }
+        }
+        
+        /* Now we've also got to lookup the siblings */
+        Sibling = Child->Sibling;
+        while (Sibling)
+        {
+            /* Check if we are starting somewhere already */
+            if (*NextLink)
+            {
+                /* If we've found the place where we started, clear and continue */
+                if (Sibling == *NextLink) *NextLink = NULL;
+            } 
+            else
+            {
+                /* Try to get a match */
+                if (Sibling->Component.Class == Class &&
+                    Sibling->Component.Type == Type &&
+                    (Sibling->Component.Key & Mask) == Key)
+                {
+                    /* Match found */
+                    return Sibling;
+                }
+            }
+            
+            /* We've got to check if the Sibling has a Child as well */
+            if (Sibling->Child)
+            {
+                /* We're just going to call ourselves again */
+                if ((ReturnEntry = KeFindConfigurationNextEntry(Sibling->Child,
+                                                                Class,
+                                                                Type,
+                                                                ComponentKey,
+                                                                NextLink)))
+                {
+                    return ReturnEntry;
+                }
+            }
+            
+            /* Next Sibling */
+            Sibling = Sibling->Sibling;
+        }
+        
+        /* Next Child */
+        Child = Child->Child;
+    }
+    
+    /* If we got here, nothign was found */
+    return NULL;
 }
 
 /*
  * @implemented
  */
+VOID
 STDCALL
-VOID
 KeFlushEntireTb(
     IN BOOLEAN Unknown,
     IN BOOLEAN CurrentCpuOnly
@@ -97,8 +175,8 @@
 /*
  * @implemented
  */
+VOID
 STDCALL
-VOID
 KeSetDmaIoCoherency(
     IN ULONG Coherency
 )
@@ -109,8 +187,8 @@
 /*
  * @implemented
  */
+KAFFINITY
 STDCALL
-KAFFINITY
 KeQueryActiveProcessors (
     VOID
     )