[NTOS:IO] Implement the PlugPlayControl.PlugPlayControlEnumerateDevice request
authorEric Kohl <eric.kohl@reactos.org>
Sat, 8 Jun 2019 18:41:53 +0000 (20:41 +0200)
committerEric Kohl <eric.kohl@reactos.org>
Sat, 8 Jun 2019 18:42:38 +0000 (20:42 +0200)
Drivers for Intel Pro/1000 NICs seem to install properly.

ntoskrnl/io/pnpmgr/plugplay.c

index 9aafd07..50331e2 100644 (file)
@@ -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: