https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8319c73e2efdb33f680138...
commit 8319c73e2efdb33f680138091a8e889ff250603e Author: Eric Kohl eric.kohl@reactos.org AuthorDate: Sat Jun 8 20:41:53 2019 +0200 Commit: Eric Kohl eric.kohl@reactos.org CommitDate: Sat Jun 8 20:42:38 2019 +0200
[NTOS:IO] Implement the PlugPlayControl.PlugPlayControlEnumerateDevice request
Drivers for Intel Pro/1000 NICs seem to install properly. --- ntoskrnl/io/pnpmgr/plugplay.c | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-)
diff --git a/ntoskrnl/io/pnpmgr/plugplay.c b/ntoskrnl/io/pnpmgr/plugplay.c index 9aafd07918..50331e2119 100644 --- a/ntoskrnl/io/pnpmgr/plugplay.c +++ b/ntoskrnl/io/pnpmgr/plugplay.c @@ -212,6 +212,39 @@ IopCaptureUnicodeString(PUNICODE_STRING DstName, PUNICODE_STRING SrcName) return Status; }
+static NTSTATUS +IopPnpEnumerateDevice(PPLUGPLAY_CONTROL_ENUMERATE_DEVICE_DATA DeviceData) +{ + PDEVICE_OBJECT DeviceObject; + UNICODE_STRING DeviceInstance; + NTSTATUS Status = STATUS_SUCCESS; + + Status = IopCaptureUnicodeString(&DeviceInstance, &DeviceData->DeviceInstance); + if (!NT_SUCCESS(Status)) + { + return Status; + } + + DPRINT("IopPnpEnumerateDevice(%wZ)\n", &DeviceInstance); + + /* Get the device object */ + DeviceObject = IopGetDeviceObjectFromDeviceInstance(&DeviceInstance); + if (DeviceInstance.Buffer != NULL) + { + ExFreePool(DeviceInstance.Buffer); + } + if (DeviceObject == NULL) + { + return STATUS_NO_SUCH_DEVICE; + } + + Status = IopEnumerateDevice(DeviceObject); + + ObDereferenceObject(DeviceObject); + + return Status; +} + static NTSTATUS IopGetInterfaceDeviceList(PPLUGPLAY_CONTROL_INTERFACE_DEVICE_LIST_DATA DeviceList) { @@ -1300,7 +1333,11 @@ NtPlugPlayControl(IN PLUGPLAY_CONTROL_CLASS PlugPlayControlClass,
switch (PlugPlayControlClass) { -// case PlugPlayControlEnumerateDevice: + case PlugPlayControlEnumerateDevice: + if (!Buffer || BufferLength < sizeof(PLUGPLAY_CONTROL_ENUMERATE_DEVICE_DATA)) + return STATUS_INVALID_PARAMETER; + return IopPnpEnumerateDevice((PPLUGPLAY_CONTROL_ENUMERATE_DEVICE_DATA)Buffer); + // case PlugPlayControlRegisterNewDevice: // case PlugPlayControlDeregisterDevice: // case PlugPlayControlInitializeDevice: