[NTOSKRNL]
[reactos.git] / reactos / ntoskrnl / io / pnpmgr / pnpmgr.c
index f288d26..5721591 100644 (file)
@@ -64,6 +64,13 @@ IopInitializeDevice(PDEVICE_NODE DeviceNode,
 {
    PDEVICE_OBJECT Fdo;
    NTSTATUS Status;
+    
+   if (!DriverObject)
+   {
+      /* Special case for bus driven devices */
+      DeviceNode->Flags |= DNF_ADDED;
+      return STATUS_SUCCESS;
+   }
 
    if (!DriverObject->DriverExtension->AddDevice)
    {
@@ -1897,11 +1904,15 @@ IopActionInitChildServices(PDEVICE_NODE DeviceNode,
    {
       /* We don't need to worry about loading the driver because we're
        * being driven in raw mode so our parent must be loaded to get here */
-      Status = IopStartDevice(DeviceNode);
-      if (!NT_SUCCESS(Status))
+      Status = IopInitializeDevice(DeviceNode, NULL);
+      if (NT_SUCCESS(Status))
       {
-          DPRINT1("IopStartDevice(%wZ) failed with status 0x%08x\n",
-                  &DeviceNode->InstancePath, Status);
+          Status = IopStartDevice(DeviceNode);
+          if (!NT_SUCCESS(Status))
+          {
+              DPRINT1("IopStartDevice(%wZ) failed with status 0x%08x\n",
+                      &DeviceNode->InstancePath, Status);
+          }
       }
    }
    else
@@ -3027,7 +3038,7 @@ PnpBusTypeGuidGet(IN USHORT Index,
     
     /* Release lock and return status */
     ExReleaseFastMutex(&PnpBusTypeGuidList->Lock);
-    return Index;
+    return Status;
 }
 
 NTSTATUS
@@ -3035,10 +3046,11 @@ NTAPI
 PpIrpQueryCapabilities(IN PDEVICE_OBJECT DeviceObject,
                        OUT PDEVICE_CAPABILITIES DeviceCaps)
 {
-    PAGED_CODE();
     PVOID Dummy;
     IO_STACK_LOCATION Stack;
-    
+
+    PAGED_CODE();
+
     /* Set up the Header */
     RtlZeroMemory(DeviceCaps, sizeof(DEVICE_CAPABILITIES));
     DeviceCaps->Size = sizeof(DEVICE_CAPABILITIES);