https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7cc5163bfa5972597bc2827393626e880b8ec311
commit 7cc5163bfa5972597bc2827393626e880b8ec311 Author: Eric Kohl <[email protected]> AuthorDate: Sun Apr 17 13:52:59 2022 +0200 Commit: Eric Kohl <[email protected]> CommitDate: Sun Apr 17 13:52:59 2022 +0200 [UMPNPMGR] Add checks to PNP_GetRelatedDeviceInstance PNP_GetRelatedDeviceInstance must fail if we try to retrieve the parent or a sibling of the root device. --- base/services/umpnpmgr/rpcserver.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/base/services/umpnpmgr/rpcserver.c b/base/services/umpnpmgr/rpcserver.c index 34bdf848966..470a9b67622 100644 --- a/base/services/umpnpmgr/rpcserver.c +++ b/base/services/umpnpmgr/rpcserver.c @@ -781,6 +781,14 @@ PNP_GetRelatedDeviceInstance( if (!IsValidDeviceInstanceID(pDeviceID)) return CR_INVALID_DEVINST; + /* The root device does not have a parent device or sibling devices */ + if ((ulRelationship == PNP_GET_PARENT_DEVICE_INSTANCE) || + (ulRelationship == PNP_GET_SIBLING_DEVICE_INSTANCE)) + { + if (IsRootDeviceInstanceID(pDeviceID)) + return CR_NO_SUCH_DEVINST; + } + RtlInitUnicodeString(&PlugPlayData.TargetDeviceInstance, pDeviceID);
