From 27453fb7594ea0c545217242a16092eed6099071 Mon Sep 17 00:00:00 2001 From: Stanislav Motylkov Date: Wed, 20 Apr 2022 02:38:41 +0300 Subject: [PATCH] [UMPNPMGR] Fix hang when installing devices. Addendum to 0296fce00. --- base/services/umpnpmgr/rpcserver.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/base/services/umpnpmgr/rpcserver.c b/base/services/umpnpmgr/rpcserver.c index 1d933e6942b..74a289205d0 100644 --- a/base/services/umpnpmgr/rpcserver.c +++ b/base/services/umpnpmgr/rpcserver.c @@ -3004,19 +3004,14 @@ GenerateDeviceID( _In_ PNP_RPC_STRING_LEN ulLength) { WCHAR szGeneratedInstance[MAX_DEVICE_ID_LEN]; - PWCHAR ptr; HKEY hKey; DWORD dwInstanceNumber; DWORD dwError = ERROR_SUCCESS; CONFIGRET ret = CR_SUCCESS; /* Fail, if the device name contains backslashes */ - ptr = pszDeviceID; - while (*ptr != UNICODE_NULL) - { - if (*ptr == L'\\') - return CR_INVALID_DEVICE_ID; - } + if (wcschr(pszDeviceID, L'\\') != NULL) + return CR_INVALID_DEVICE_ID; /* Generated ID is: Root\\ */ dwInstanceNumber = 0;