Author: hpoussin
Date: Wed Jul 19 09:19:11 2017
New Revision: 75374
URL: 
http://svn.reactos.org/svn/reactos?rev=75374&view=rev
Log:
[SETUPAPI] Do not crash when encountering a device with HardwareIDs
Modified:
    trunk/reactos/dll/win32/setupapi/driver.c
Modified: trunk/reactos/dll/win32/setupapi/driver.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/driver.…
==============================================================================
--- trunk/reactos/dll/win32/setupapi/driver.c   [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/setupapi/driver.c   [iso-8859-1] Wed Jul 19 09:19:11 2017
@@ -1109,23 +1109,26 @@
                                 }
                                 /* FIXME: Check ExcludeFromSelect list */
                                 DriverAlreadyAdded = FALSE;
-                                for (DriverRank = 0, currentId = (LPCWSTR)HardwareIDs;
!DriverAlreadyAdded && *currentId; currentId += strlenW(currentId) + 1,
DriverRank++)
+                                if (HardwareIDs)
                                 {
-                                    if (strcmpiW(DeviceId, currentId) == 0)
+                                    for (DriverRank = 0, currentId =
(LPCWSTR)HardwareIDs; !DriverAlreadyAdded && *currentId; currentId +=
strlenW(currentId) + 1, DriverRank++)
                                     {
-                                        AddDriverToList(
-                                            pDriverListHead,
-                                            DriverType,
-                                            &ClassGuid,
-                                            ContextDevice,
-                                            currentInfFileDetails,
-                                            FullInfFileName,
-                                            ProviderName,
-                                            ManufacturerName,
-                                            currentId,
-                                            DriverDate, DriverVersion,
-                                            DriverRank  + (i == 2 ? 0 : 0x1000 + i - 3));
-                                        DriverAlreadyAdded = TRUE;
+                                        if (strcmpiW(DeviceId, currentId) == 0)
+                                        {
+                                            AddDriverToList(
+                                                pDriverListHead,
+                                                DriverType,
+                                                &ClassGuid,
+                                                ContextDevice,
+                                                currentInfFileDetails,
+                                                FullInfFileName,
+                                                ProviderName,
+                                                ManufacturerName,
+                                                currentId,
+                                                DriverDate, DriverVersion,
+                                                DriverRank  + (i == 2 ? 0 : 0x1000 + i -
3));
+                                            DriverAlreadyAdded = TRUE;
+                                        }
                                     }
                                 }
                                 if (CompatibleIDs)