Implement IoReportDetectedDevice

svn path=/trunk/; revision=14215
This commit is contained in:
Hervé Poussineau 2005-03-20 12:15:33 +00:00
parent 4cae592ec2
commit fcc7d2acc7

View file

@ -10,14 +10,14 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
//#define NDEBUG #define NDEBUG
#include <ntoskrnl.h> #include <ntoskrnl.h>
#include <internal/debug.h> #include <internal/debug.h>
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
/* /*
* @unimplemented * @implemented
*/ */
NTSTATUS NTSTATUS
STDCALL STDCALL
@ -32,24 +32,38 @@ IoReportDetectedDevice(
IN OUT PDEVICE_OBJECT *DeviceObject) IN OUT PDEVICE_OBJECT *DeviceObject)
{ {
PDEVICE_NODE DeviceNode; PDEVICE_NODE DeviceNode;
NTSTATUS Status; PDEVICE_OBJECT Pdo;
NTSTATUS Status = STATUS_SUCCESS;
DPRINT("IoReportDetectedDevice called (partly implemented)\n"); DPRINT("IoReportDetectedDevice (DeviceObject %p, *DeviceObject %p)\n",
/* Use IopRootDeviceNode for now */ DeviceObject, DeviceObject ? *DeviceObject : NULL);
Status = IopCreateDeviceNode(IopRootDeviceNode, NULL, &DeviceNode);
if (!NT_SUCCESS(Status)) /* if *DeviceObject is not NULL, we must use it as a PDO,
* and don't create a new one.
*/
if (DeviceObject && *DeviceObject)
Pdo = *DeviceObject;
else
{ {
DPRINT("IopCreateDeviceNode() failed (Status 0x%08x)\n", Status); /* create a new PDO and return it in *DeviceObject */
return Status; Status = IopCreateDeviceNode(IopRootDeviceNode, NULL, &DeviceNode);
if (!NT_SUCCESS(Status))
{
DPRINT("IopCreateDeviceNode() failed (Status 0x%08lx)\n", Status);
return Status;
}
Pdo = DeviceNode->PhysicalDeviceObject;
if (DeviceObject)
*DeviceObject = Pdo;
} }
Status = IopInitializePnpServices(DeviceNode, FALSE); /* we don't need to call AddDevice and send IRP_MN_START_DEVICE */
if (!NT_SUCCESS(Status))
{ /* FIXME: save this device into the root-enumerated list, so this
DPRINT("IopInitializePnpServices() failed (Status 0x%08x)\n", Status); * device would be detected as a PnP device during next startups.
return Status; */
}
return IopInitializeDevice(DeviceNode, DriverObject); return Status;
} }
/* /*
@ -66,7 +80,7 @@ IoReportResourceForDetection(
IN ULONG DeviceListSize OPTIONAL, IN ULONG DeviceListSize OPTIONAL,
OUT PBOOLEAN ConflictDetected) OUT PBOOLEAN ConflictDetected)
{ {
DPRINT("IoReportResourceForDetection UNIMPLEMENTED but returns success.\n"); DPRINT1("IoReportResourceForDetection UNIMPLEMENTED but returns success.\n");
*ConflictDetected = FALSE; *ConflictDetected = FALSE;
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }