mirror of
https://github.com/reactos/reactos.git
synced 2025-04-20 04:20:46 +00:00
[UMPNPMGR] PNP_CreateDevInst: A phantom device can only be created if the device did not exist before
This commit is contained in:
parent
2c391b1eab
commit
f3ac86713d
1 changed files with 15 additions and 0 deletions
|
@ -3052,6 +3052,7 @@ PNP_CreateDevInst(
|
||||||
PNP_RPC_STRING_LEN ulLength,
|
PNP_RPC_STRING_LEN ulLength,
|
||||||
DWORD ulFlags)
|
DWORD ulFlags)
|
||||||
{
|
{
|
||||||
|
HKEY hKey = NULL;
|
||||||
CONFIGRET ret = CR_SUCCESS;
|
CONFIGRET ret = CR_SUCCESS;
|
||||||
|
|
||||||
DPRINT("PNP_CreateDevInst(%p %S %S %lu 0x%08lx)\n",
|
DPRINT("PNP_CreateDevInst(%p %S %S %lu 0x%08lx)\n",
|
||||||
|
@ -3075,8 +3076,18 @@ PNP_CreateDevInst(
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Try to open the device instance key */
|
||||||
|
RegOpenKeyEx(hEnumKey, pszDeviceID, 0, KEY_READ | KEY_WRITE, &hKey);
|
||||||
|
|
||||||
if (ulFlags & CM_CREATE_DEVNODE_PHANTOM)
|
if (ulFlags & CM_CREATE_DEVNODE_PHANTOM)
|
||||||
{
|
{
|
||||||
|
/* Fail, if the device already exists */
|
||||||
|
if (hKey != NULL)
|
||||||
|
{
|
||||||
|
ret = CR_ALREADY_SUCH_DEVINST;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
/* Create the phantom device instance */
|
/* Create the phantom device instance */
|
||||||
ret = CreateDeviceInstance(pszDeviceID, TRUE);
|
ret = CreateDeviceInstance(pszDeviceID, TRUE);
|
||||||
}
|
}
|
||||||
|
@ -3086,6 +3097,10 @@ PNP_CreateDevInst(
|
||||||
ret = CreateDeviceInstance(pszDeviceID, FALSE);
|
ret = CreateDeviceInstance(pszDeviceID, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
if (hKey)
|
||||||
|
RegCloseKey(hKey);
|
||||||
|
|
||||||
DPRINT("PNP_CreateDevInst() done (returns %lx)\n", ret);
|
DPRINT("PNP_CreateDevInst() done (returns %lx)\n", ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in a new issue