- 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
This commit is contained in:
Johannes Anderwald 2006-11-10 11:16:38 +00:00
parent d22e48600b
commit 037bd166bc

View file

@ -1907,7 +1907,7 @@ ProcessUnattendInf(HINF hUnattendedInf)
{ {
INFCONTEXT InfContext; INFCONTEXT InfContext;
TCHAR szName[256]; TCHAR szName[256];
TCHAR szValue[256]; TCHAR szValue[MAX_PATH];
DWORD LineLength; DWORD LineLength;
if (!SetupFindFirstLine(hUnattendedInf, if (!SetupFindFirstLine(hUnattendedInf,
@ -2006,6 +2006,57 @@ ProcessUnattendInf(HINF hUnattendedInf)
} }
while (SetupFindNextLine(&InfContext, &InfContext)); 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; return TRUE;
} }