https://git.reactos.org/?p=reactos.git;a=commitdiff;h=06b3ee43c24dd93f607cd…
commit 06b3ee43c24dd93f607cd3d749d309aa5ad4bf1b
Author: Hervé Poussineau <hpoussin(a)reactos.org>
AuthorDate: Mon Sep 26 23:35:09 2022 +0200
Commit: Hervé Poussineau <hpoussin(a)reactos.org>
CommitDate: Mon Sep 26 23:35:09 2022 +0200
[NTOS:PNP] Partially implement NtPlugPlayControl(PlugPlayControlQueryAndRemoveDevice)
CORE-12307
---
ntoskrnl/io/pnpmgr/plugplay.c | 38 +++++++++++++++++++++++++++++++++++++-
1 file changed, 37 insertions(+), 1 deletion(-)
diff --git a/ntoskrnl/io/pnpmgr/plugplay.c b/ntoskrnl/io/pnpmgr/plugplay.c
index e3412c4cfa3..c35aa58fd5f 100644
--- a/ntoskrnl/io/pnpmgr/plugplay.c
+++ b/ntoskrnl/io/pnpmgr/plugplay.c
@@ -1147,6 +1147,39 @@ PiControlSyncDeviceAction(
return Status;
}
+static
+NTSTATUS
+PiControlQueryRemoveDevice(
+ _In_ PPLUGPLAY_CONTROL_QUERY_REMOVE_DATA ControlData)
+{
+ PDEVICE_OBJECT DeviceObject;
+ NTSTATUS Status;
+ UNICODE_STRING DeviceInstance;
+
+ Status = IopCaptureUnicodeString(&DeviceInstance,
&ControlData->DeviceInstance);
+ if (!NT_SUCCESS(Status))
+ {
+ return Status;
+ }
+
+ DeviceObject = IopGetDeviceObjectFromDeviceInstance(&DeviceInstance);
+ if (DeviceInstance.Buffer != NULL)
+ {
+ ExFreePool(DeviceInstance.Buffer);
+ }
+ if (DeviceObject == NULL)
+ {
+ return STATUS_NO_SUCH_DEVICE;
+ }
+
+ UNIMPLEMENTED;
+ Status = STATUS_NOT_IMPLEMENTED;
+
+ ObDereferenceObject(DeviceObject);
+
+ return Status;
+}
+
/* PUBLIC FUNCTIONS **********************************************************/
/*
@@ -1400,7 +1433,10 @@ NtPlugPlayControl(IN PLUGPLAY_CONTROL_CLASS PlugPlayControlClass,
PlugPlayControlClass);
// case PlugPlayControlUnlockDevice:
-// case PlugPlayControlQueryAndRemoveDevice:
+ case PlugPlayControlQueryAndRemoveDevice:
+ if (!Buffer || BufferLength <
sizeof(PLUGPLAY_CONTROL_QUERY_REMOVE_DATA))
+ return STATUS_INVALID_PARAMETER;
+ return
PiControlQueryRemoveDevice((PPLUGPLAY_CONTROL_QUERY_REMOVE_DATA)Buffer);
case PlugPlayControlUserResponse:
if (!Buffer || BufferLength <
sizeof(PLUGPLAY_CONTROL_USER_RESPONSE_DATA))