Author: ekohl
Date: Fri May 13 15:15:40 2011
New Revision: 51697

URL: http://svn.reactos.org/svn/reactos?rev=51697&view=rev
Log:
[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.

Modified:
    trunk/reactos/dll/win32/setupapi/cfgmgr.c

Modified: trunk/reactos/dll/win32/setupapi/cfgmgr.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/cfgmgr.c?rev=51697&r1=51696&r2=51697&view=diff
==============================================================================
--- trunk/reactos/dll/win32/setupapi/cfgmgr.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/setupapi/cfgmgr.c [iso-8859-1] Fri May 13 15:15:40 
2011
@@ -595,8 +595,9 @@
     HSTRING_TABLE StringTable = NULL;
     LPWSTR lpParentDevInst;
     CONFIGRET ret = CR_SUCCESS;
-
-    FIXME("%p %s %p %lx %p\n",
+    WCHAR szLocalDeviceID[MAX_DEVICE_ID_LEN];
+
+    TRACE("%p %s %p %lx %p\n",
           pdnDevInst, debugstr_w(pDeviceID), dnParent, ulFlags, hMachine);
 
     if (!pSetupIsUserAdmin())
@@ -605,7 +606,7 @@
     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)
@@ -634,10 +635,12 @@
     if (lpParentDevInst == NULL)
         return CR_INVALID_DEVNODE;
 
+    wcscpy(szLocalDeviceID, pDeviceID);
+
     RpcTryExcept
     {
         ret = PNP_CreateDevInst(BindingHandle,
-                                pDeviceID,
+                                szLocalDeviceID,
                                 lpParentDevInst,
                                 MAX_DEVICE_ID_LEN,
                                 ulFlags);


Reply via email to