https://git.reactos.org/?p=reactos.git;a=commitdiff;h=dde7e6e25494398429cab9074fd8171f8dbf8780

commit dde7e6e25494398429cab9074fd8171f8dbf8780
Author:     Eric Kohl <[email protected]>
AuthorDate: Sun Apr 17 22:50:01 2022 +0200
Commit:     Eric Kohl <[email protected]>
CommitDate: Sun Apr 17 22:50:26 2022 +0200

    [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,24 +5976,9 @@ 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;
+    TRACE("DeviceIdBuffer: %s\n", debugstr_w(DeviceIdBuffer));
 
     if (ret == CR_SUCCESS)
     {

Reply via email to