[ros-diffs] [janderwald] 24711: - implement a GuiRunOnce section for unatttended setup - with this we launch programs after 3rd boot (programs / scripts) - another a little step for sysreg :)

janderwald at svn.reactos.org janderwald at svn.reactos.org
Fri Nov 10 12:16:40 CET 2006


Author: janderwald
Date: Fri Nov 10 14:16:38 2006
New Revision: 24711

URL: http://svn.reactos.org/svn/reactos?rev=24711&view=rev
Log:
- implement a GuiRunOnce section for unatttended setup
- with this we launch programs after 3rd boot (programs / scripts)
- another a little step for sysreg :)

Modified:
    trunk/reactos/dll/win32/syssetup/wizard.c

Modified: trunk/reactos/dll/win32/syssetup/wizard.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/syssetup/wizard.c?rev=24711&r1=24710&r2=24711&view=diff
==============================================================================
--- trunk/reactos/dll/win32/syssetup/wizard.c (original)
+++ trunk/reactos/dll/win32/syssetup/wizard.c Fri Nov 10 14:16:38 2006
@@ -1907,7 +1907,7 @@
 {
   INFCONTEXT InfContext;
   TCHAR szName[256];
-  TCHAR szValue[256];
+  TCHAR szValue[MAX_PATH];
   DWORD LineLength;
 
   if (!SetupFindFirstLine(hUnattendedInf,
@@ -2006,6 +2006,57 @@
   }
   while (SetupFindNextLine(&InfContext, &InfContext));
 
+
+  if (SetupFindFirstLine(hUnattendedInf,
+                         _T("GuiRunOnce"),
+                         NULL,
+                         &InfContext))
+    {
+      HKEY hKey;
+      int i;
+
+      if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
+                        _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce"),
+                        0,
+                        KEY_SET_VALUE,
+                        &hKey) != ERROR_SUCCESS)
+        {
+          DPRINT1("Error: failed to open HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\n");
+          return TRUE;
+        }
+
+      i = 0;
+
+      do
+      {
+        if(SetupGetStringField(&InfContext, 
+                               0,
+                               szValue,
+                               sizeof(szValue) / sizeof(TCHAR),
+                               NULL))
+          {
+            TCHAR szPath[MAX_PATH];
+            _stprintf(szName, _T("%d"), i);
+            DPRINT("szName %S szValue %S\n", szName, szValue);
+
+           if (ExpandEnvironmentStrings(szValue, szPath, MAX_PATH))
+             {
+               DPRINT("value %S\n", szPath);
+               if (RegSetValueEx(hKey,
+                                 szName, 
+                                 0,
+                                 REG_SZ,
+                                 (const BYTE*)szPath,
+                                 _tcslen(szPath) * sizeof(TCHAR)) == ERROR_SUCCESS)
+                 {
+                   i++;
+                 }
+             }
+          }
+      }while(SetupFindNextLine(&InfContext, &InfContext));
+
+    RegCloseKey(hKey);
+  }
   return TRUE;
 }
 




More information about the Ros-diffs mailing list