[UMPNPMGR] GenerateDeviceID must fail, if pszDeviceID contains backslashes

This commit is contained in:
Eric Kohl 2022-04-19 23:14:23 +02:00
parent 291a94cd6f
commit 0296fce00e

View file

@ -3004,11 +3004,20 @@ 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;
}
/* Generated ID is: Root\<Device ID>\<Instance number> */
dwInstanceNumber = 0;
while (dwError == ERROR_SUCCESS)