From 3d9a702d2b4d37889edaa5c6305123360f7684fe Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sun, 13 Oct 2019 15:49:13 +0200 Subject: [PATCH] [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; } -- 2.17.1