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,25 +32,39 @@ 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);
/* 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
{
/* create a new PDO and return it in *DeviceObject */
Status = IopCreateDeviceNode(IopRootDeviceNode, NULL, &DeviceNode); Status = IopCreateDeviceNode(IopRootDeviceNode, NULL, &DeviceNode);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT("IopCreateDeviceNode() failed (Status 0x%08x)\n", Status); DPRINT("IopCreateDeviceNode() failed (Status 0x%08lx)\n", Status);
return Status; return Status;
} }
Pdo = DeviceNode->PhysicalDeviceObject;
if (DeviceObject)
*DeviceObject = Pdo;
}
/* we don't need to call AddDevice and send IRP_MN_START_DEVICE */
/* FIXME: save this device into the root-enumerated list, so this
* device would be detected as a PnP device during next startups.
*/
Status = IopInitializePnpServices(DeviceNode, FALSE);
if (!NT_SUCCESS(Status))
{
DPRINT("IopInitializePnpServices() failed (Status 0x%08x)\n", Status);
return Status; return Status;
} }
return IopInitializeDevice(DeviceNode, DriverObject);
}
/* /*
* @unimplemented * @unimplemented
@ -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;
} }