From 037bd166bca40f56539c5a0f2d93e5eb07759253 Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Fri, 10 Nov 2006 11:16:38 +0000 Subject: [PATCH] - implement a GuiRunOnce section for unatttended setup - with this we launch programs after 3rd boot (programs / scripts) - another a little step for sysreg :) svn path=/trunk/; revision=24711 --- reactos/dll/win32/syssetup/wizard.c | 53 ++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/reactos/dll/win32/syssetup/wizard.c b/reactos/dll/win32/syssetup/wizard.c index fd72f546cc6..3eaeb6708fa 100644 --- a/reactos/dll/win32/syssetup/wizard.c +++ b/reactos/dll/win32/syssetup/wizard.c @@ -1907,7 +1907,7 @@ ProcessUnattendInf(HINF hUnattendedInf) { INFCONTEXT InfContext; TCHAR szName[256]; - TCHAR szValue[256]; + TCHAR szValue[MAX_PATH]; DWORD LineLength; if (!SetupFindFirstLine(hUnattendedInf, @@ -2006,6 +2006,57 @@ ProcessUnattendInf(HINF hUnattendedInf) } 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; }