[SETUPAPI]
[reactos.git] / reactos / dll / win32 / setupapi / devclass.c
index cae8b66..1e2a734 100644 (file)
@@ -552,6 +552,9 @@ cleanup:
     if (hKey != INVALID_HANDLE_VALUE)
         RegCloseKey(hKey);
 
+    if (Buffer && !ret)
+        MyFree(Buffer);
+
     return ret;
 }
 
@@ -697,14 +700,14 @@ SetupDiGetClassImageListExW(
         }
 
         /* Finally, add the overlay icons to the image list */
-        for (i = 0; i < 2; i++)
+        for (i = 0; i <= 2; i++)
         {
             hIcon = LoadImage(hInstance, MAKEINTRESOURCE(500 + i), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
             if (hIcon)
             {
                 idx = ImageList_AddIcon(ClassImageListData->ImageList, hIcon);
                 if (idx != -1)
-                    ImageList_SetOverlayImage(ClassImageListData->ImageList, idx, i);
+                    ImageList_SetOverlayImage(ClassImageListData->ImageList, idx, i + 1);
                 DestroyIcon(hIcon);
             }
         }
@@ -860,6 +863,7 @@ SetupDiInstallClassExW(
         InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS);
         if (!SetupDiGetDeviceInstallParamsW(hDeviceInfo, NULL, &InstallParams))
             goto cleanup;
+
         InstallParams.Flags &= ~(DI_NOVCP | DI_NOBROWSE | DI_QUIETINSTALL);
         InstallParams.Flags |= Flags & (DI_NOVCP | DI_NOBROWSE | DI_QUIETINSTALL);
         if (Flags & DI_NOVCP)
@@ -939,9 +943,9 @@ SetupDiInstallClassExW(
             if (!ret)
                 goto cleanup;
 
-            /* Install .Services section */
+            /* OPTIONAL: Install .Services section */
             lstrcatW(SectionName, DotServices);
-            ret = SetupInstallServicesFromInfSectionExW(
+            SetupInstallServicesFromInfSectionExW(
                 hInf,
                 SectionName,
                 0,
@@ -949,9 +953,6 @@ SetupDiInstallClassExW(
                 NULL,
                 NULL,
                 NULL);
-            if (!ret)
-                goto cleanup;
-
             ret = TRUE;
         }