- Fix IoReportDetectedDevice to use the caller's driver object

svn path=/trunk/; revision=53392
This commit is contained in:
Cameron Gutman 2011-08-23 03:57:24 +00:00
parent 4ee1da837b
commit 6cf62841ad
4 changed files with 15 additions and 13 deletions

View file

@ -1022,6 +1022,7 @@ PnpRootDriverEntry(
NTSTATUS
PnpRootCreateDevice(
IN PUNICODE_STRING ServiceName,
IN OPTIONAL PDRIVER_OBJECT DriverObject,
OUT PDEVICE_OBJECT *PhysicalDeviceObject,
OUT OPTIONAL PUNICODE_STRING FullInstancePath
);

View file

@ -690,7 +690,7 @@ IopCreateDeviceNode(PDEVICE_NODE ParentNode,
RtlAppendUnicodeStringToString(&FullServiceName, &LegacyPrefix);
RtlAppendUnicodeStringToString(&FullServiceName, ServiceName1);
Status = PnpRootCreateDevice(&FullServiceName, &PhysicalDeviceObject, &Node->InstancePath);
Status = PnpRootCreateDevice(&FullServiceName, NULL, &PhysicalDeviceObject, &Node->InstancePath);
if (!NT_SUCCESS(Status))
{
DPRINT1("PnpRootCreateDevice() failed with status 0x%08X\n", Status);

View file

@ -202,12 +202,12 @@ IoReportDetectedDevice(IN PDRIVER_OBJECT DriverObject,
if (DeviceObject && *DeviceObject)
{
Pdo = *DeviceObject;
DeviceNode = IopGetDeviceNode(*DeviceObject);
}
else
{
/* Create the PDO */
Status = PnpRootCreateDevice(&ServiceName,
DriverObject,
&Pdo,
NULL);
if (!NT_SUCCESS(Status))
@ -215,18 +215,18 @@ IoReportDetectedDevice(IN PDRIVER_OBJECT DriverObject,
DPRINT("PnpRootCreateDevice() failed (Status 0x%08lx)\n", Status);
return Status;
}
}
/* Create the device node for the new PDO */
Status = IopCreateDeviceNode(IopRootDeviceNode,
Pdo,
NULL,
&DeviceNode);
/* Create the device node for the new PDO */
Status = IopCreateDeviceNode(IopRootDeviceNode,
Pdo,
NULL,
&DeviceNode);
if (!NT_SUCCESS(Status))
{
DPRINT("IopCreateDeviceNode() failed (Status 0x%08lx)\n", Status);
return Status;
}
if (!NT_SUCCESS(Status))
{
DPRINT("IopCreateDeviceNode() failed (Status 0x%08lx)\n", Status);
return Status;
}
/* We don't call AddDevice for devices reported this way */

View file

@ -130,6 +130,7 @@ LocateChildDevice(
NTSTATUS
PnpRootCreateDevice(
IN PUNICODE_STRING ServiceName,
IN OPTIONAL PDRIVER_OBJECT DriverObject,
OUT PDEVICE_OBJECT *PhysicalDeviceObject,
OUT OPTIONAL PUNICODE_STRING FullInstancePath)
{
@ -271,7 +272,7 @@ tryagain:
/* Initialize a device object */
Status = IoCreateDevice(
PnpRootDeviceObject->DriverObject,
DriverObject ? DriverObject : PnpRootDeviceObject->DriverObject,
sizeof(PNPROOT_PDO_DEVICE_EXTENSION),
NULL,
FILE_DEVICE_CONTROLLER,