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
HSTRING_TABLE StringTable = NULL;
LPWSTR lpParentDevInst;
CONFIGRET ret = CR_SUCCESS;
HSTRING_TABLE StringTable = NULL;
LPWSTR lpParentDevInst;
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);
if (!pSetupIsUserAdmin())
pdnDevInst, debugstr_w(pDeviceID), dnParent, ulFlags, hMachine);
if (!pSetupIsUserAdmin())
if (pdnDevInst == NULL)
return CR_INVALID_POINTER;
if (pdnDevInst == NULL)
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;
if (dnParent == 0)
return CR_INVALID_DEVICE_ID;
if (dnParent == 0)
if (lpParentDevInst == NULL)
return CR_INVALID_DEVNODE;
if (lpParentDevInst == NULL)
return CR_INVALID_DEVNODE;
+ wcscpy(szLocalDeviceID, pDeviceID);
+
RpcTryExcept
{
ret = PNP_CreateDevInst(BindingHandle,
RpcTryExcept
{
ret = PNP_CreateDevInst(BindingHandle,
lpParentDevInst,
MAX_DEVICE_ID_LEN,
ulFlags);
lpParentDevInst,
MAX_DEVICE_ID_LEN,
ulFlags);