Implement partly IoReportResourceForDetection() and IoReportDetectedDevice(), just enough to support serial driver
Modified: trunk/reactos/ntoskrnl/io/pnpreport.c

Modified: trunk/reactos/ntoskrnl/io/pnpreport.c
--- trunk/reactos/ntoskrnl/io/pnpreport.c	2005-03-18 16:01:35 UTC (rev 14177)
+++ trunk/reactos/ntoskrnl/io/pnpreport.c	2005-03-18 16:51:39 UTC (rev 14178)
@@ -10,6 +10,7 @@
 
 /* INCLUDES ******************************************************************/
 
+//#define NDEBUG
 #include <ntoskrnl.h>
 #include <internal/debug.h>
 
@@ -30,8 +31,25 @@
   IN BOOLEAN ResourceAssigned,
   IN OUT PDEVICE_OBJECT *DeviceObject)
 {
-  DPRINT("IoReportDetectedDevice called (UNIMPLEMENTED)\n");
-  return STATUS_NOT_IMPLEMENTED;
+  PDEVICE_NODE DeviceNode;
+  NTSTATUS Status;
+  
+  DPRINT("IoReportDetectedDevice called (partly implemented)\n");
+  /* Use IopRootDeviceNode for now */
+  Status = IopCreateDeviceNode(IopRootDeviceNode, NULL, &DeviceNode);
+  if (!NT_SUCCESS(Status))
+  {
+    DPRINT("IopCreateDeviceNode() failed (Status 0x%08x)\n", Status);
+    return Status;
+  }
+  
+  Status = IopInitializePnpServices(DeviceNode, FALSE);
+  if (!NT_SUCCESS(Status))
+  {
+    DPRINT("IopInitializePnpServices() failed (Status 0x%08x)\n", Status);
+    return Status;
+  }
+  return IopInitializeDevice(DeviceNode, DriverObject);
 }
 
 /*
@@ -48,8 +66,9 @@
   IN ULONG DeviceListSize   OPTIONAL,
   OUT PBOOLEAN ConflictDetected)
 {
-  DPRINT("IoReportResourceForDetection called (UNIMPLEMENTED)\n");
-  return STATUS_NOT_IMPLEMENTED;
+  DPRINT("IoReportResourceForDetection UNIMPLEMENTED but returns success.\n");
+  *ConflictDetected = FALSE;
+  return STATUS_SUCCESS;
 }
 
 /*
@@ -61,7 +80,7 @@
   IN PDEVICE_OBJECT PhysicalDeviceObject,
   IN PVOID NotificationStructure)
 {
-  DPRINT("IoReportTargetDeviceChange called (UNIMPLEMENTED)\n");
+  DPRINT1("IoReportTargetDeviceChange called (UNIMPLEMENTED)\n");
   return STATUS_NOT_IMPLEMENTED;
 }
 
@@ -76,7 +95,7 @@
   IN PDEVICE_CHANGE_COMPLETE_CALLBACK Callback  OPTIONAL,
   IN PVOID Context  OPTIONAL)
 {
-  DPRINT("IoReportTargetDeviceChangeAsynchronous called (UNIMPLEMENTED)\n");
+  DPRINT1("IoReportTargetDeviceChangeAsynchronous called (UNIMPLEMENTED)\n");
   return STATUS_NOT_IMPLEMENTED;
 }