mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 17:33:01 +00:00
[SETUPAPI]
CM_Create_DevNode_ExW: Copy the device id string into a local buffer before passing it to PNP_CreateDevInst because its 2nd argument is an 'in out' string. Using a writable string buffer prevents exceptions in case the device id passed to CM_Create_DevNode_ExW is a string constant. svn path=/trunk/; revision=51697
This commit is contained in:
parent
71fffa95de
commit
7db0796ea8
1 changed files with 6 additions and 3 deletions
|
@ -595,8 +595,9 @@ CONFIGRET WINAPI CM_Create_DevNode_ExW(
|
||||||
HSTRING_TABLE StringTable = NULL;
|
HSTRING_TABLE StringTable = NULL;
|
||||||
LPWSTR lpParentDevInst;
|
LPWSTR lpParentDevInst;
|
||||||
CONFIGRET ret = CR_SUCCESS;
|
CONFIGRET ret = CR_SUCCESS;
|
||||||
|
WCHAR szLocalDeviceID[MAX_DEVICE_ID_LEN];
|
||||||
|
|
||||||
FIXME("%p %s %p %lx %p\n",
|
TRACE("%p %s %p %lx %p\n",
|
||||||
pdnDevInst, debugstr_w(pDeviceID), dnParent, ulFlags, hMachine);
|
pdnDevInst, debugstr_w(pDeviceID), dnParent, ulFlags, hMachine);
|
||||||
|
|
||||||
if (!pSetupIsUserAdmin())
|
if (!pSetupIsUserAdmin())
|
||||||
|
@ -605,7 +606,7 @@ CONFIGRET WINAPI CM_Create_DevNode_ExW(
|
||||||
if (pdnDevInst == NULL)
|
if (pdnDevInst == NULL)
|
||||||
return CR_INVALID_POINTER;
|
return CR_INVALID_POINTER;
|
||||||
|
|
||||||
if (pDeviceID == NULL || wcslen(pDeviceID) == 0)
|
if (pDeviceID == NULL || wcslen(pDeviceID) == 0 || wcslen(pDeviceID) >= MAX_DEVICE_ID_LEN)
|
||||||
return CR_INVALID_DEVICE_ID;
|
return CR_INVALID_DEVICE_ID;
|
||||||
|
|
||||||
if (dnParent == 0)
|
if (dnParent == 0)
|
||||||
|
@ -634,10 +635,12 @@ CONFIGRET WINAPI CM_Create_DevNode_ExW(
|
||||||
if (lpParentDevInst == NULL)
|
if (lpParentDevInst == NULL)
|
||||||
return CR_INVALID_DEVNODE;
|
return CR_INVALID_DEVNODE;
|
||||||
|
|
||||||
|
wcscpy(szLocalDeviceID, pDeviceID);
|
||||||
|
|
||||||
RpcTryExcept
|
RpcTryExcept
|
||||||
{
|
{
|
||||||
ret = PNP_CreateDevInst(BindingHandle,
|
ret = PNP_CreateDevInst(BindingHandle,
|
||||||
pDeviceID,
|
szLocalDeviceID,
|
||||||
lpParentDevInst,
|
lpParentDevInst,
|
||||||
MAX_DEVICE_ID_LEN,
|
MAX_DEVICE_ID_LEN,
|
||||||
ulFlags);
|
ulFlags);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue