[ros-diffs] [hpoussin] 22449: Handle MachineName parameter in SetupDiCreateDeviceInfoListExW Eric, can you take care of the change in CM_Connect_MachineW?

hpoussin at svn.reactos.org hpoussin at svn.reactos.org
Wed Jun 21 11:00:17 CEST 2006


Author: hpoussin
Date: Wed Jun 21 13:00:17 2006
New Revision: 22449

URL: http://svn.reactos.ru/svn/reactos?rev=22449&view=rev
Log:
Handle MachineName parameter in SetupDiCreateDeviceInfoListExW
Eric, can you take care of the change in CM_Connect_MachineW?

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

Modified: trunk/reactos/dll/win32/setupapi/cfgmgr.c
URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/win32/setupapi/cfgmgr.c?rev=22449&r1=22448&r2=22449&view=diff
==============================================================================
--- trunk/reactos/dll/win32/setupapi/cfgmgr.c (original)
+++ trunk/reactos/dll/win32/setupapi/cfgmgr.c Wed Jun 21 13:00:17 2006
@@ -251,7 +251,14 @@
 
     TRACE("%s %p\n", debugstr_w(UNCServerName), phMachine);
 
-    pMachine = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MACHINE_INFO));
+    if (!UNCServerName)
+    {
+        FIXME("Connection to local machine not implemented\n");
+        *phMachine = NULL;
+        return CR_SUCCESS;
+    }
+
+    pMachine = HeapAlloc(GetProcessHeap(), 0, sizeof(MACHINE_INFO));
     if (pMachine == NULL)
         return CR_OUT_OF_MEMORY;
 

Modified: trunk/reactos/dll/win32/setupapi/devclass.c
URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/win32/setupapi/devclass.c?rev=22449&r1=22448&r2=22449&view=diff
==============================================================================
--- trunk/reactos/dll/win32/setupapi/devclass.c (original)
+++ trunk/reactos/dll/win32/setupapi/devclass.c Wed Jun 21 13:00:17 2006
@@ -1701,6 +1701,8 @@
         PVOID callback_context = NULL;
 
         hDeviceInfo = SetupDiCreateDeviceInfoList(NULL, NULL);
+        if (hDeviceInfo == INVALID_HANDLE_VALUE)
+            goto cleanup;
 
         InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS);
         if (!SetupDiGetDeviceInstallParamsW(hDeviceInfo, NULL, &InstallParams))

Modified: trunk/reactos/dll/win32/setupapi/devinst.c
URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/win32/setupapi/devinst.c?rev=22449&r1=22448&r2=22449&view=diff
==============================================================================
--- trunk/reactos/dll/win32/setupapi/devinst.c (original)
+++ trunk/reactos/dll/win32/setupapi/devinst.c Wed Jun 21 13:00:17 2006
@@ -160,7 +160,7 @@
     LPWSTR UNCServerName = NULL;
     DWORD size;
     DWORD rc;
-    //CONFIGRET cr;
+    CONFIGRET cr;
     HDEVINFO ret = (HDEVINFO)INVALID_HANDLE_VALUE;;
 
     TRACE("%s %p %s %p\n", debugstr_guid(ClassGuid), hwndParent,
@@ -169,7 +169,7 @@
     size = FIELD_OFFSET(struct DeviceInfoSet, szData);
     if (MachineName)
         size += (strlenW(MachineName) + 3) * sizeof(WCHAR);
-    list = HeapAlloc(GetProcessHeap(), 0, size);
+    list = MyMalloc(size);
     if (!list)
     {
         SetLastError(ERROR_NOT_ENOUGH_MEMORY);
@@ -193,13 +193,14 @@
             SetLastError(rc);
             goto cleanup;
         }
-        UNCServerName = HeapAlloc(GetProcessHeap(), 0, (strlenW(MachineName) + 3) * sizeof(WCHAR));
+        UNCServerName = MyMalloc((strlenW(MachineName) + 3) * sizeof(WCHAR));
         if (!UNCServerName)
         {
             SetLastError(ERROR_NOT_ENOUGH_MEMORY);
             goto cleanup;
         }
 
+        UNCServerName[0] = UNCServerName[1] = '\\';
         strcpyW(UNCServerName + 2, MachineName);
         list->szData[0] = list->szData[1] = '\\';
         strcpyW(list->szData + 2, MachineName);
@@ -207,27 +208,15 @@
     }
     else
     {
-        DWORD Size = MAX_PATH;
         list->HKLM = HKEY_LOCAL_MACHINE;
-        UNCServerName = HeapAlloc(GetProcessHeap(), 0, (MAX_PATH + 2) * sizeof(WCHAR));
-        if (!UNCServerName)
-        {
-            SetLastError(ERROR_NOT_ENOUGH_MEMORY);
-            goto cleanup;
-        }
-        if (!GetComputerNameW(UNCServerName + 2, &Size))
-            goto cleanup;
         list->MachineName = NULL;
-      }
-#if 0
-    UNCServerName[0] = UNCServerName[1] = '\\';
+    }
     cr = CM_Connect_MachineW(UNCServerName, &list->hMachine);
     if (cr != CR_SUCCESS)
     {
         SetLastError(GetErrorCodeFromCrCode(cr));
         goto cleanup;
     }
-#endif
     InitializeListHead(&list->DriverListHead);
     InitializeListHead(&list->ListHead);
 
@@ -240,10 +229,10 @@
         {
             if (list->HKLM != NULL && list->HKLM != HKEY_LOCAL_MACHINE)
                 RegCloseKey(list->HKLM);
-            HeapFree(GetProcessHeap(), 0, list);
-        }
-    }
-    HeapFree(GetProcessHeap(), 0, UNCServerName);
+            MyFree(list);
+        }
+    }
+    MyFree(UNCServerName);
     return ret;
 }
 




More information about the Ros-diffs mailing list