- Fix DEVICE_NODE definition to remove ROS-only fields
- Move RTL_HEAP_PARAMETERS to umtypes.h
- Fix PROCESS_PRIORITY_CLASS_XXX definitions.
- Use PROCESS_PRIORITY_CLASS_INVALID in process creation code.
- Move and correct EX_PUSH_LOCK definition to ntifs.h
- Define KQUEUE along with KAPC_STATE if ntifs.h is not used, so that we don't force its usage
- Enable usage of EX_QUEUE_WORKER_INFO and EX_WORK_QUEUE without requiring the IFS.
- Fix definition of CsrClientConnectToServer
- Update NDK FIXME list
- Define and use a list of Bus Type GUIDs instead of saving the GUID in a ROS-only field of DEVICE_NODE.
- Use a IRP_MN_QUERY_CAPABILITIES PnP IRP to get the Address of a DeviceNode, intead of saving it inside a ROS-only field.
Modified: trunk/reactos/include/ndk/extypes.h
Modified: trunk/reactos/include/ndk/fixmes.txt
Modified: trunk/reactos/include/ndk/iotypes.h
Modified: trunk/reactos/include/ndk/ketypes.h
Modified: trunk/reactos/include/ndk/pstypes.h
Modified: trunk/reactos/include/ndk/rtltypes.h
Modified: trunk/reactos/include/ndk/umfuncs.h
Modified: trunk/reactos/include/ndk/umtypes.h
Modified: trunk/reactos/lib/kernel32/process/create.c
Modified: trunk/reactos/lib/ntdll/csr/lpc.c
Modified: trunk/reactos/ntoskrnl/include/internal/io.h
Modified: trunk/reactos/ntoskrnl/io/pnpmgr.c
Modified: trunk/reactos/w32api/include/ddk/ntifs.h

Modified: trunk/reactos/include/ndk/extypes.h
--- trunk/reactos/include/ndk/extypes.h	2005-08-10 22:15:12 UTC (rev 17271)
+++ trunk/reactos/include/ndk/extypes.h	2005-08-11 00:01:17 UTC (rev 17272)
@@ -38,10 +38,9 @@
 /* You'll need the IFS for this, so use an equivalent version */
 #ifndef _NTIFS_
 typedef PVOID EX_RUNDOWN_REF;
+typedef PVOID EX_PUSH_LOCK;
 #endif
 
-/* You'll need the IFS for these, so let's not force everyone to have it */
-#ifdef _NTIFS_
 typedef struct _EX_QUEUE_WORKER_INFO
 {
     UCHAR QueueDisabled:1;
@@ -59,7 +58,6 @@
     ULONG QueueDepthLastPass;
     EX_QUEUE_WORKER_INFO Info;
 } EX_WORK_QUEUE, *PEX_WORK_QUEUE;
-#endif
 
 typedef struct _EX_FAST_REF
 {
@@ -71,21 +69,6 @@
     };
 } EX_FAST_REF, *PEX_FAST_REF;
 
-typedef struct _EX_PUSH_LOCK
-{
-    union
-    {
-        struct
-        {
-            ULONG Waiting:1;
-            ULONG Exclusive:1;
-            ULONG Shared:30;
-        };
-        ULONG Value;
-        PVOID Ptr;
-    };
-} EX_PUSH_LOCK, *PEX_PUSH_LOCK;
-
 typedef struct _HANDLE_TABLE_ENTRY_INFO
 {
     ULONG AuditMask;

Modified: trunk/reactos/include/ndk/fixmes.txt
--- trunk/reactos/include/ndk/fixmes.txt	2005-08-10 22:15:12 UTC (rev 17271)
+++ trunk/reactos/include/ndk/fixmes.txt	2005-08-11 00:01:17 UTC (rev 17272)
@@ -2,8 +2,8 @@
 -----------
 
 Order:
-	* Priority 1 = Easiest to fix.
-	* Priority 5 = Hardest to fix.
+	* Priority 1 = Most important to fix.
+	* Priority 5 = Least important to fix.
 
 Format:
 	<Priority Level>
@@ -19,7 +19,7 @@
 	- FIXED: Some files need cleanup (Alex + Eric) [zwfuncs.h, rtlfuncs.h, rtltypes.h]
 
 	Priority 2:
-	- DEVICE_NODE has 2 fields not part of NT's defintion [iotypes.h]
+	- FIXED: DEVICE_NODE has 2 fields not part of NT's defintion (Alex) [iotypes.h]
 	- Object Callbacks don't match NT's (Alex) [obtypes.h]
 	- Remove Create Callback Hack (Alex) [obtypes.h]
 	- Object header doesn't match NT (Alex) [obtypes.h] blocks on ->
@@ -32,9 +32,9 @@
 
 	Priority 4:
 	- FIXED: Kernel and Memory Types are not architecture-specific (Eric) [ketypes.h, mmtypes.h]
-	- Win32K Builds with windows.h (Filip, bugzilla id 666) [extypes.h, ketypes.h]
+	- FIXED: Win32K Builds with windows.h (Filip) [extypes.h, ketypes.h]
 
 	Priority 5:
 	- LPC Types are totally wrong. [lpctypes.h]
 	- Missing System Info Classes [zwtypes.h]
-	- Process Priority Classes are messed up (Alex) [pstypes.h]
+	- FIXED: Process Priority Classes are messed up (Alex) [pstypes.h]

Modified: trunk/reactos/include/ndk/iotypes.h
--- trunk/reactos/include/ndk/iotypes.h	2005-08-10 22:15:12 UTC (rev 17271)
+++ trunk/reactos/include/ndk/iotypes.h	2005-08-11 00:01:17 UTC (rev 17272)
@@ -207,10 +207,6 @@
     ULONG DriverUnloadRetryCount;
     struct _DEVICE_NODE *PreviousParent;
     ULONG DeletedChidren;
-
-    /* FIXME: Not NT's */
-    GUID BusTypeGuid;
-    ULONG Address;
 } DEVICE_NODE, *PDEVICE_NODE;
 
 typedef struct _PI_RESOURCE_ARBITER_ENTRY

Modified: trunk/reactos/include/ndk/ketypes.h
--- trunk/reactos/include/ndk/ketypes.h	2005-08-10 22:15:12 UTC (rev 17271)
+++ trunk/reactos/include/ndk/ketypes.h	2005-08-11 00:01:17 UTC (rev 17272)
@@ -63,7 +63,7 @@
     CurrentApcEnvironment
 } KAPC_ENVIRONMENT;
 
-/* We don't want to force NTIFS usage only for a single structure */
+/* We don't want to force NTIFS usage only for two structures */
 #ifndef _NTIFS_
 typedef struct _KAPC_STATE
 {
@@ -73,6 +73,15 @@
     BOOLEAN KernelApcPending;
     BOOLEAN UserApcPending;
 } KAPC_STATE, *PKAPC_STATE, *RESTRICTED_POINTER PRKAPC_STATE;
+
+typedef struct _KQUEUE
+{
+    DISPATCHER_HEADER Header;
+    LIST_ENTRY EntryListHead;
+    ULONG CurrentCount;
+    ULONG MaximumCount;
+    LIST_ENTRY ThreadListHead;
+} KQUEUE, *PKQUEUE, *RESTRICTED_POINTER PRKQUEUE;
 #endif
 
 typedef struct _KNODE

Modified: trunk/reactos/include/ndk/pstypes.h
--- trunk/reactos/include/ndk/pstypes.h	2005-08-10 22:15:12 UTC (rev 17271)
+++ trunk/reactos/include/ndk/pstypes.h	2005-08-11 00:01:17 UTC (rev 17272)
@@ -36,12 +36,13 @@
 #define USER_SHARED_DATA (0x7FFE0000)
 
 /* Process priority classes */
-#define PROCESS_PRIORITY_CLASS_IDLE	            0
-#define PROCESS_PRIORITY_CLASS_BELOW_NORMAL     1
-#define PROCESS_PRIORITY_CLASS_NORMAL	        2
-#define PROCESS_PRIORITY_CLASS_ABOVE_NORMAL     3
-#define PROCESS_PRIORITY_CLASS_HIGH	            4
-#define PROCESS_PRIORITY_CLASS_REALTIME	        5
+#define PROCESS_PRIORITY_CLASS_INVALID          0
+#define PROCESS_PRIORITY_CLASS_IDLE             1
+#define PROCESS_PRIORITY_CLASS_NORMAL           2
+#define PROCESS_PRIORITY_CLASS_HIGH             3
+#define PROCESS_PRIORITY_CLASS_REALTIME         4
+#define PROCESS_PRIORITY_CLASS_BELOW_NORMAL     5
+#define PROCESS_PRIORITY_CLASS_ABOVE_NORMAL     6
 
 /* Global Flags */
 #define FLG_STOP_ON_EXCEPTION          0x00000001

Modified: trunk/reactos/include/ndk/rtltypes.h
--- trunk/reactos/include/ndk/rtltypes.h	2005-08-10 22:15:12 UTC (rev 17271)
+++ trunk/reactos/include/ndk/rtltypes.h	2005-08-11 00:01:17 UTC (rev 17272)
@@ -40,11 +40,11 @@
 #define EXCEPTION_TARGET_UNWIND 0x20
 #define EXCEPTION_COLLIDED_UNWIND 0x20
 
-#define  EH_NONCONTINUABLE   0x01
-#define  EH_UNWINDING        0x02
-#define  EH_EXIT_UNWIND      0x04
-#define  EH_STACK_INVALID    0x08
-#define  EH_NESTED_CALL      0x10
+#define EH_NONCONTINUABLE   0x01
+#define EH_UNWINDING        0x02
+#define EH_EXIT_UNWIND      0x04
+#define EH_STACK_INVALID    0x08
+#define EH_NESTED_CALL      0x10
 
 #define RTL_RANGE_LIST_ADD_IF_CONFLICT  0x00000001
 #define RTL_RANGE_LIST_ADD_SHARED       0x00000002
@@ -109,20 +109,16 @@
     PVOID Parameter
 );
 
-#ifndef _NTIFS_
-typedef NTSTATUS
-(NTAPI * PRTL_HEAP_COMMIT_ROUTINE) (
-    IN PVOID Base,
-    IN OUT PVOID *CommitAddress,
-    IN OUT PSIZE_T CommitSize
-);
-#endif
-
 /* TYPES *********************************************************************/
 
 typedef unsigned short RTL_ATOM;
 typedef unsigned short *PRTL_ATOM;
 
+/* Once again, we don't want to force NTIFS for something like this */
+#if !defined(_NTIFS_) && !defined(NTOS_MODE_USER)
+typedef PVOID PRTL_HEAP_PARAMETERS;
+#endif
+
 typedef ACL_REVISION_INFORMATION *PACL_REVISION_INFORMATION;
 typedef ACL_SIZE_INFORMATION *PACL_SIZE_INFORMATION;
 typedef struct _ACE
@@ -402,22 +398,6 @@
     PRTL_ATOM_TABLE_ENTRY Buckets[1];
 } RTL_ATOM_TABLE, *PRTL_ATOM_TABLE;
 
-#ifndef _NTIFS_
-typedef struct _RTL_HEAP_PARAMETERS {
-    ULONG Length;
-    SIZE_T SegmentReserve;
-    SIZE_T SegmentCommit;
-    SIZE_T DeCommitFreeBlockThreshold;
-    SIZE_T DeCommitTotalFreeThreshold;
-    SIZE_T MaximumAllocationSize;
-    SIZE_T VirtualMemoryThreshold;
-    SIZE_T InitialCommit;
-    SIZE_T InitialReserve;
-    PRTL_HEAP_COMMIT_ROUTINE CommitRoutine;
-    SIZE_T Reserved[2];
-} RTL_HEAP_PARAMETERS, *PRTL_HEAP_PARAMETERS;
-#endif
-
 /* Let Kernel Drivers use this */
 #ifndef _WINBASE_
     typedef struct _SYSTEMTIME

Modified: trunk/reactos/include/ndk/umfuncs.h
--- trunk/reactos/include/ndk/umfuncs.h	2005-08-10 22:15:12 UTC (rev 17271)
+++ trunk/reactos/include/ndk/umfuncs.h	2005-08-11 00:01:17 UTC (rev 17272)
@@ -25,7 +25,7 @@
     PVOID Unknown,
     PVOID Context,
     ULONG ContextLength,
-    PULONG Unknown2
+    PBOOLEAN ServerToServerCall
 );
 
 NTSTATUS

Modified: trunk/reactos/include/ndk/umtypes.h
--- trunk/reactos/include/ndk/umtypes.h	2005-08-10 22:15:12 UTC (rev 17271)
+++ trunk/reactos/include/ndk/umtypes.h	2005-08-11 00:01:17 UTC (rev 17272)
@@ -48,7 +48,7 @@
 #define NT_WARNING(x) ((ULONG)(x)>>30==2)
 #define NT_ERROR(x) ((ULONG)(x)>>30==3)
 
-/* Object Access Rights FIXME: Some are in w32api's psdk..,is that normal ?*/
+/* Object Access Rights */
 #define DIRECTORY_QUERY (0x0001)
 #define DIRECTORY_TRAVERSE (0x0002)
 #define DIRECTORY_CREATE_OBJECT (0x0004)
@@ -1418,7 +1418,28 @@
     PUNICODE_PREFIX_TABLE_ENTRY LastNextEntry;
 } UNICODE_PREFIX_TABLE, *PUNICODE_PREFIX_TABLE;
 
-/* FIXME - need FAST_MUTEX and PHANDLE_TABLE for RTL_ATOM_TABLE in umode! */
+typedef NTSTATUS
+(NTAPI * PRTL_HEAP_COMMIT_ROUTINE)(
+    IN PVOID Base,
+    IN OUT PVOID *CommitAddress,
+    IN OUT PSIZE_T CommitSize
+);
+
+typedef struct _RTL_HEAP_PARAMETERS
+{
+    ULONG Length;
+    SIZE_T SegmentReserve;
+    SIZE_T SegmentCommit;
+    SIZE_T DeCommitFreeBlockThreshold;
+    SIZE_T DeCommitTotalFreeThreshold;
+    SIZE_T MaximumAllocationSize;
+    SIZE_T VirtualMemoryThreshold;
+    SIZE_T InitialCommit;
+    SIZE_T InitialReserve;
+    PRTL_HEAP_COMMIT_ROUTINE CommitRoutine;
+    SIZE_T Reserved[2];
+} RTL_HEAP_PARAMETERS, *PRTL_HEAP_PARAMETERS;
+
 typedef void *FAST_MUTEX;
 typedef void *PHANDLE_TABLE;
 

Modified: trunk/reactos/lib/kernel32/process/create.c
--- trunk/reactos/lib/kernel32/process/create.c	2005-08-10 22:15:12 UTC (rev 17271)
+++ trunk/reactos/lib/kernel32/process/create.c	2005-08-11 00:01:17 UTC (rev 17272)
@@ -263,7 +263,7 @@
     }
     else
     {
-        ReturnClass = 0 /* FIXME */;
+        ReturnClass = PROCESS_PRIORITY_CLASS_INVALID;
     }
     
     return ReturnClass;

Modified: trunk/reactos/lib/ntdll/csr/lpc.c
--- trunk/reactos/lib/ntdll/csr/lpc.c	2005-08-10 22:15:12 UTC (rev 17271)
+++ trunk/reactos/lib/ntdll/csr/lpc.c	2005-08-11 00:01:17 UTC (rev 17272)
@@ -107,7 +107,7 @@
                          PVOID Unknown,
                          PVOID Context,
                          ULONG ContextLength,
-                         PULONG Unknown2)
+                         PBOOLEAN ServerToServerCall)
 {
    NTSTATUS Status;
    UNICODE_STRING PortName = RTL_CONSTANT_STRING(L"\\Windows\\ApiPort");

Modified: trunk/reactos/ntoskrnl/include/internal/io.h
--- trunk/reactos/ntoskrnl/include/internal/io.h	2005-08-10 22:15:12 UTC (rev 17271)
+++ trunk/reactos/ntoskrnl/include/internal/io.h	2005-08-11 00:01:17 UTC (rev 17272)
@@ -23,6 +23,15 @@
     IO_STATUS_BLOCK IoStatus;
 } IO_COMPLETION_PACKET, *PIO_COMPLETION_PACKET;
 
+/* List of Bus Type GUIDs */
+typedef struct _IO_BUS_TYPE_GUID_LIST
+{
+    ULONG GuidCount;
+    FAST_MUTEX Lock;
+    GUID Guids[1];
+} IO_BUS_TYPE_GUID_LIST, *PIO_BUS_TYPE_GUID_LIST;
+extern PIO_BUS_TYPE_GUID_LIST IopBusTypeGuidList;
+
 /* Packet Types */
 #define IrpCompletionPacket     0x1
 #define IrpMiniCompletionPacket 0x2

Modified: trunk/reactos/ntoskrnl/io/pnpmgr.c
--- trunk/reactos/ntoskrnl/io/pnpmgr.c	2005-08-10 22:15:12 UTC (rev 17271)
+++ trunk/reactos/ntoskrnl/io/pnpmgr.c	2005-08-11 00:01:17 UTC (rev 17272)
@@ -22,6 +22,7 @@
 /* DATA **********************************************************************/
 
 PDRIVER_OBJECT IopRootDriverObject;
+PIO_BUS_TYPE_GUID_LIST IopBusTypeGuidList = NULL;
 
 /* FUNCTIONS *****************************************************************/
 
@@ -32,6 +33,32 @@
   return DeviceObject->DeviceObjectExtension->DeviceNode;
 }
 
+NTSTATUS
+STDCALL
+IopQueryDeviceCapabilities(PDEVICE_NODE DeviceNode,
+                           PDEVICE_CAPABILITIES DeviceCaps)
+{
+    IO_STATUS_BLOCK StatusBlock;
+    IO_STACK_LOCATION Stack;
+
+    /* Set up the Header */
+    RtlZeroMemory(DeviceCaps, sizeof(DEVICE_CAPABILITIES));
+    DeviceCaps->Size = sizeof(DEVICE_CAPABILITIES);
+    DeviceCaps->Version = 1;
+    DeviceCaps->Address = -1;
+    DeviceCaps->UINumber = -1;
+
+    /* Set up the Stack */
+    RtlZeroMemory(&Stack, sizeof(IO_STACK_LOCATION));
+    Stack.Parameters.DeviceCapabilities.Capabilities = DeviceCaps;
+
+    /* Send the IRP */
+    return IopInitiatePnpIrp(DeviceNode->PhysicalDeviceObject,
+                             &StatusBlock,
+                             IRP_MN_QUERY_CAPABILITIES,
+                             &Stack);
+}
+
 /*
  * @implemented
  */
@@ -57,9 +84,11 @@
   OUT PULONG ResultLength)
 {
   PDEVICE_NODE DeviceNode = IopGetDeviceNode(DeviceObject);
+  DEVICE_CAPABILITIES DeviceCaps;
   ULONG Length;
   PVOID Data = NULL;
   PWSTR Ptr;
+  NTSTATUS Status;
 
   DPRINT("IoGetDeviceProperty(0x%p %d)\n", DeviceObject, DeviceProperty);
 
@@ -75,34 +104,61 @@
 
     /* Complete, untested */
     case DevicePropertyBusTypeGuid:
-      *ResultLength = 39 * sizeof(WCHAR);
-      if (BufferLength < (39 * sizeof(WCHAR)))
-        return STATUS_BUFFER_TOO_SMALL;
-      swprintf((PWSTR)PropertyBuffer,
-        L"{%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
-        DeviceNode->BusTypeGuid.Data1,
-        DeviceNode->BusTypeGuid.Data2,
-        DeviceNode->BusTypeGuid.Data3,
-        DeviceNode->BusTypeGuid.Data4[0],
-        DeviceNode->BusTypeGuid.Data4[1],
-        DeviceNode->BusTypeGuid.Data4[2],
-        DeviceNode->BusTypeGuid.Data4[3],
-        DeviceNode->BusTypeGuid.Data4[4],
-        DeviceNode->BusTypeGuid.Data4[5],
-        DeviceNode->BusTypeGuid.Data4[6],
-        DeviceNode->BusTypeGuid.Data4[7]);
-      return STATUS_SUCCESS;
+        /* Sanity check */
+        if ((DeviceNode->ChildBusTypeIndex != 0xFFFF) && 
+            (DeviceNode->ChildBusTypeIndex < IopBusTypeGuidList->GuidCount))
+        {
+            /* Return the GUID */
+            *ResultLength = sizeof(GUID);
 
+            /* Check if the buffer given was large enough */
+            if (BufferLength < *ResultLength)
+            {
+                return STATUS_BUFFER_TOO_SMALL;
+            }
+
+            /* Copy the GUID */
+            RtlCopyMemory(PropertyBuffer, 
+                          &(IopBusTypeGuidList->Guids[DeviceNode->ChildBusTypeIndex]),
+                          sizeof(GUID));
+            return STATUS_SUCCESS;
+        }
+        else
+        {
+            return STATUS_OBJECT_NAME_NOT_FOUND;
+        }
+        break;
+
     case DevicePropertyLegacyBusType:
       Length = sizeof(INTERFACE_TYPE);
       Data = &DeviceNode->ChildInterfaceType;
       break;
 
     case DevicePropertyAddress:
-      Length = sizeof(ULONG);
-      Data = &DeviceNode->Address;
-      break;
 
+        /* Query the device caps */
+        Status = IopQueryDeviceCapabilities(DeviceNode, &DeviceCaps);
+        if (NT_SUCCESS(Status) && (DeviceCaps.Address != -1))
+        {
+            /* Return length */
+            *ResultLength = sizeof(ULONG);
+
+            /* Check if the buffer given was large enough */
+            if (BufferLength < *ResultLength)
+            {
+                return STATUS_BUFFER_TOO_SMALL;
+            }
+
+            /* Return address */
+            *(PULONG)PropertyBuffer = DeviceCaps.Address;
+            return STATUS_SUCCESS;
+        }
+        else
+        {
+            return STATUS_OBJECT_NAME_NOT_FOUND;
+        }
+        break;
+
 //    case DevicePropertyUINumber:
 //      if (DeviceNode->CapabilityFlags == NULL)
 //         return STATUS_INVALID_DEVICE_REQUEST;
@@ -453,6 +509,66 @@
   return STATUS_UNSUCCESSFUL;
 }
 
+USHORT
+STDCALL
+IopGetBusTypeGuidIndex(LPGUID BusTypeGuid)
+{
+    USHORT i = 0, FoundIndex = 0xFFFF;
+    ULONG NewSize;
+    PVOID NewList;
+    
+    /* Acquire the lock */
+    ExAcquireFastMutex(&IopBusTypeGuidList->Lock);
+
+    /* Loop all entries */
+    while (i < IopBusTypeGuidList->GuidCount)
+    {
+        /* Try to find a match */
+        if (RtlCompareMemory(BusTypeGuid,
+                             &IopBusTypeGuidList->Guids[i],
+                             sizeof(GUID)))
+        {
+            /* Found it */
+            FoundIndex = i;
+            goto Quickie;
+        }
+    }
+
+    /* Check if we have to grow the list */
+    if (IopBusTypeGuidList->GuidCount)
+    {
+        /* Calculate the new size */
+        NewSize = sizeof(IO_BUS_TYPE_GUID_LIST) +
+                 (sizeof(GUID) * IopBusTypeGuidList->GuidCount);
+
+        /* Allocate the new copy */
+        NewList = ExAllocatePool(PagedPool, NewSize);
+
+        /* Now copy them, decrease the size too */
+        NewSize -= sizeof(GUID);
+        RtlCopyMemory(NewList, IopBusTypeGuidList, NewSize);
+
+        /* Free the old list */
+        ExFreePool(IopBusTypeGuidList);
+
+        /* Use the new buffer */
+        IopBusTypeGuidList = NewList;
+    }
+
+    /* Copy the new GUID */
+    RtlCopyMemory(&IopBusTypeGuidList->Guids[IopBusTypeGuidList->GuidCount],
+                  BusTypeGuid,
+                  sizeof(GUID));
+
+    /* The new entry is the index */
+    FoundIndex = IopBusTypeGuidList->GuidCount;
+    IopBusTypeGuidList->GuidCount++;
+
+Quickie:
+    ExReleaseFastMutex(&IopBusTypeGuidList->Lock);
+    return FoundIndex;
+}
+
 /*
  * DESCRIPTION
  * 	Creates a device node
@@ -1212,28 +1328,13 @@
       DPRINT("IopInitiatePnpIrp() failed (Status %x)\n", Status);
    }
 
-   RtlZeroMemory(&DeviceCapabilities, sizeof(DEVICE_CAPABILITIES));
-   DeviceCapabilities.Size = sizeof(DEVICE_CAPABILITIES);
-   DeviceCapabilities.Version = 1;
-   DeviceCapabilities.Address = -1;
-   DeviceCapabilities.UINumber = -1;
-
-   Stack.Parameters.DeviceCapabilities.Capabilities = &DeviceCapabilities;
-   Status = IopInitiatePnpIrp(
-      DeviceNode->PhysicalDeviceObject,
-      &IoStatusBlock,
-      IRP_MN_QUERY_CAPABILITIES,
-      &Stack);
+   Status = IopQueryDeviceCapabilities(DeviceNode, &DeviceCapabilities);
    if (NT_SUCCESS(Status))
    {
-   }
-   else
-   {
       DPRINT("IopInitiatePnpIrp() failed (Status %x)\n", Status);
    }
 
    DeviceNode->CapabilityFlags = *(PULONG)((ULONG_PTR)&DeviceCapabilities + 4);
-   DeviceNode->Address = DeviceCapabilities.Address;
 
    if (!DeviceCapabilities.UniqueID)
    {
@@ -1457,20 +1558,16 @@
 
       DeviceNode->ChildBusNumber = BusInformation->BusNumber;
       DeviceNode->ChildInterfaceType = BusInformation->LegacyBusType;
-      memcpy(&DeviceNode->BusTypeGuid,
-             &BusInformation->BusTypeGuid,
-             sizeof(GUID));
+      DeviceNode->ChildBusTypeIndex = IopGetBusTypeGuidIndex(&BusInformation->BusTypeGuid);
       ExFreePool(BusInformation);
    }
    else
    {
       DPRINT("IopInitiatePnpIrp() failed (Status %x)\n", Status);
 
-      DeviceNode->ChildBusNumber = -1;
-      DeviceNode->ChildInterfaceType = -1;
-      memset(&DeviceNode->BusTypeGuid,
-             0,
-             sizeof(GUID));
+      DeviceNode->ChildBusNumber = 0xFFFFFFF0;
+      DeviceNode->ChildInterfaceType = InterfaceTypeUndefined;
+      DeviceNode->ChildBusTypeIndex = -1;
    }
 
    DPRINT("Sending IRP_MN_QUERY_RESOURCES to device stack\n");
@@ -2026,6 +2123,11 @@
 
    KeInitializeSpinLock(&IopDeviceTreeLock);
 
+   /* Initialize the Bus Type GUID List */
+   IopBusTypeGuidList = ExAllocatePool(PagedPool, sizeof(IO_BUS_TYPE_GUID_LIST));
+   RtlZeroMemory(IopBusTypeGuidList, sizeof(IO_BUS_TYPE_GUID_LIST));
+   ExInitializeFastMutex(&IopBusTypeGuidList->Lock);
+
    /* Initialize PnP-Event notification support */
    Status = IopInitPlugPlayEvents();
    if (!NT_SUCCESS(Status))

Modified: trunk/reactos/w32api/include/ddk/ntifs.h
--- trunk/reactos/w32api/include/ddk/ntifs.h	2005-08-10 22:15:12 UTC (rev 17271)
+++ trunk/reactos/w32api/include/ddk/ntifs.h	2005-08-11 00:01:17 UTC (rev 17272)
@@ -627,6 +627,31 @@
     } DUMMYUNIONNAME;
 } EX_RUNDOWN_REF, *PEX_RUNDOWN_REF;
 
+#define EX_PUSH_LOCK_LOCK_V          ((ULONG_PTR)0x0)
+#define EX_PUSH_LOCK_LOCK            ((ULONG_PTR)0x1)
+#define EX_PUSH_LOCK_WAITING         ((ULONG_PTR)0x2)
+#define EX_PUSH_LOCK_WAKING          ((ULONG_PTR)0x4)
+#define EX_PUSH_LOCK_MULTIPLE_SHARED ((ULONG_PTR)0x8)
+#define EX_PUSH_LOCK_SHARE_INC       ((ULONG_PTR)0x10)
+#define EX_PUSH_LOCK_PTR_BITS        ((ULONG_PTR)0xf)
+
+typedef struct _EX_PUSH_LOCK
+{
+    union
+    {
+        struct
+        {
+            ULONG_PTR Locked:1;
+            ULONG_PTR Waiting:1;
+            ULONG_PTR Waking:1;
+            ULONG_PTR MultipleShared:1;
+            ULONG_PTR Shared:sizeof (ULONG_PTR) * 8 - 4;
+        };
+        ULONG_PTR Value;
+        PVOID Ptr;
+    };
+} EX_PUSH_LOCK, *PEX_PUSH_LOCK;
+
 typedef struct _FILE_ACCESS_INFORMATION {
     ACCESS_MASK AccessFlags;
 } FILE_ACCESS_INFORMATION, *PFILE_ACCESS_INFORMATION;