From: Eric Kohl Date: Sat, 8 Jun 2019 18:41:53 +0000 (+0200) Subject: [NTOS:IO] Implement the PlugPlayControl.PlugPlayControlEnumerateDevice request X-Git-Tag: 0.4.14-dev~840 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=8319c73e2efdb33f680138091a8e889ff250603e [NTOS:IO] Implement the PlugPlayControl.PlugPlayControlEnumerateDevice request Drivers for Intel Pro/1000 NICs seem to install properly. --- diff --git a/ntoskrnl/io/pnpmgr/plugplay.c b/ntoskrnl/io/pnpmgr/plugplay.c index 9aafd079186..50331e21191 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: