https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3d9a702d2b4d37889edaa…
commit 3d9a702d2b4d37889edaa5c6305123360f7684fe
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Sun Oct 13 15:49:13 2019 +0200
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Sun Oct 13 15:49:13 2019 +0200
[UMPNPMGR] Implement PNP_QueryRemove()
---
base/services/umpnpmgr/rpcserver.c | 32 ++++++++++++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
diff --git a/base/services/umpnpmgr/rpcserver.c b/base/services/umpnpmgr/rpcserver.c
index 32ff58d5865..bef58c8895a 100644
--- a/base/services/umpnpmgr/rpcserver.c
+++ b/base/services/umpnpmgr/rpcserver.c
@@ -2950,8 +2950,36 @@ PNP_QueryRemove(
DWORD ulNameLength,
DWORD ulFlags)
{
- UNIMPLEMENTED;
- return CR_CALL_NOT_IMPLEMENTED;
+ PLUGPLAY_CONTROL_QUERY_REMOVE_DATA PlugPlayData;
+ NTSTATUS Status;
+ DWORD ret = CR_SUCCESS;
+
+ DPRINT1("PNP_QueryRemove(%p %S %p %p %lu 0x%lx)\n",
+ hBinding, pszDeviceID, pVetoType, pszVetoName,
+ ulNameLength, ulFlags);
+
+ if (ulFlags & ~CM_REMOVE_BITS)
+ return CR_INVALID_FLAG;
+
+ if (pVetoType != NULL)
+ *pVetoType = PNP_VetoTypeUnknown;
+
+ if (pszVetoName != NULL && ulNameLength > 0)
+ *pszVetoName = UNICODE_NULL;
+
+ RtlZeroMemory(&PlugPlayData, sizeof(PlugPlayData));
+ RtlInitUnicodeString(&PlugPlayData.DeviceInstance,
+ pszDeviceID);
+ PlugPlayData.VetoName = pszVetoName;
+ PlugPlayData.NameLength = ulNameLength;
+
+ Status = NtPlugPlayControl(PlugPlayControlQueryAndRemoveDevice,
+ &PlugPlayData,
+ sizeof(PlugPlayData));
+ if (!NT_SUCCESS(Status))
+ ret = NtStatusToCrError(Status);
+
+ return ret;
}