Author: mpiulachs
Date: Fri Oct 26 20:19:52 2007
New Revision: 29901
URL: 
http://svn.reactos.org/svn/reactos?rev=29901&view=rev
Log:
Implement Infs.Always section parsing to syssetup. Thanks to hpoussin for his suggestions
Modified:
    trunk/reactos/dll/win32/syssetup/install.c
Modified: trunk/reactos/dll/win32/syssetup/install.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/syssetup/install…
==============================================================================
--- trunk/reactos/dll/win32/syssetup/install.c (original)
+++ trunk/reactos/dll/win32/syssetup/install.c Fri Oct 26 20:19:52 2007
@@ -358,7 +358,7 @@
 BOOL
-ProcessSysSetupInf(VOID)
+InstallSysSetupInfDevices(VOID)
 {
     INFCONTEXT InfContext;
     TCHAR LineBuffer[256];
@@ -392,7 +392,67 @@
     return TRUE;
 }
-
+BOOL
+InstallSysSetupInfComponents(VOID)
+{
+    INFCONTEXT InfContext;
+    TCHAR NameBuffer[256];
+    TCHAR SectionBuffer[256];
+
+    if (!SetupFindFirstLine(hSysSetupInf,
+                            _T("Infs.Always"),
+                            NULL,
+                            &InfContext))
+    {
+        DPRINT("No Inf.Always section found\n");
+    }
+    else
+    {
+        do
+        {
+            if (!SetupGetStringField(&InfContext,
+                                     1, // Get the component name
+                                     NameBuffer,
+                                     sizeof(NameBuffer)/sizeof(NameBuffer[0]),
+                                     NULL))
+            {
+                DebugPrint("Error while trying to get component name \n");
+                return FALSE;
+            }
+
+            if (!SetupGetStringField(&InfContext,
+                                     2, // Get the component install section
+                                     SectionBuffer,
+                                     sizeof(SectionBuffer)/sizeof(SectionBuffer[0]),
+                                     NULL))
+            {
+                DebugPrint("Error while trying to get component install section
\n");
+                return FALSE;
+            }
+
+            DPRINT("Trying to execute install section '%S' from '%S'
\n", SectionBuffer , NameBuffer);
+
+            if (!SetupInstallFromInfSection(NULL,
+                                           hSysSetupInf,
+                                           SectionBuffer,
+                                           SPINST_ALL,
+                                           NULL,
+                                           NULL,
+                                           SP_COPY_NEWER,
+                                           NULL,
+                                           NULL,
+                                           NULL,
+                                           NULL))
+            {
+                DebugPrint("Error while trying to install : %S (Error: %lu)
\n", NameBuffer, GetLastError());
+                return FALSE;
+            }
+        }
+        while (SetupFindNextLine(&InfContext, &InfContext));
+    }
+
+    return TRUE;
+}
 static BOOL
 EnableUserModePnpManager(VOID)
@@ -502,9 +562,16 @@
         return FALSE;
     }
-    if (!ProcessSysSetupInf())
-    {
-        DebugPrint("ProcessSysSetupInf() failed!\n");
+    if (!InstallSysSetupInfDevices())
+    {
+        DebugPrint("InstallSysSetupInfDevices() failed!\n");
+        SetupCloseInfFile(hSysSetupInf);
+        return FALSE;
+    }
+
+    if(!InstallSysSetupInfComponents())
+    {
+        DebugPrint("InstallSysSetupInfComponents() failed!\n");
         SetupCloseInfFile(hSysSetupInf);
         return FALSE;
     }