From dde7e6e25494398429cab9074fd8171f8dbf8780 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sun, 17 Apr 2022 22:50:01 +0200 Subject: [PATCH] [SETUPAPI] CM_Locate_DevNode_ExW: The root device does not need to be validated --- dll/win32/setupapi/cfgmgr.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/dll/win32/setupapi/cfgmgr.c b/dll/win32/setupapi/cfgmgr.c index e411c887f75..4a4e18ad621 100644 --- a/dll/win32/setupapi/cfgmgr.c +++ b/dll/win32/setupapi/cfgmgr.c @@ -5948,6 +5948,19 @@ CM_Locate_DevNode_ExW( if (pDeviceID != NULL && lstrlenW(pDeviceID) != 0) { lstrcpyW(DeviceIdBuffer, pDeviceID); + + RpcTryExcept + { + /* Validate the device ID */ + ret = PNP_ValidateDeviceInstance(BindingHandle, + DeviceIdBuffer, + ulFlags); + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + ret = RpcStatusToCmStatus(RpcExceptionCode()); + } + RpcEndExcept; } else { @@ -5963,25 +5976,10 @@ CM_Locate_DevNode_ExW( ret = RpcStatusToCmStatus(RpcExceptionCode()); } RpcEndExcept; - - if (ret != CR_SUCCESS) - return CR_FAILURE; } + TRACE("DeviceIdBuffer: %s\n", debugstr_w(DeviceIdBuffer)); - RpcTryExcept - { - /* Validate the device ID */ - ret = PNP_ValidateDeviceInstance(BindingHandle, - DeviceIdBuffer, - ulFlags); - } - RpcExcept(EXCEPTION_EXECUTE_HANDLER) - { - ret = RpcStatusToCmStatus(RpcExceptionCode()); - } - RpcEndExcept; - if (ret == CR_SUCCESS) { *pdnDevInst = pSetupStringTableAddString(StringTable, DeviceIdBuffer, 1);