mirror of
https://github.com/reactos/reactos.git
synced 2025-07-24 16:53:45 +00:00
Use inflib
svn path=/trunk/; revision=19517
This commit is contained in:
parent
1c781d1933
commit
5976ea377e
7 changed files with 158 additions and 1875 deletions
File diff suppressed because it is too large
Load diff
|
@ -1,136 +0,0 @@
|
|||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2002, 2003 ReactOS Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id$
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS text-mode setup
|
||||
* FILE: subsys/system/usetup/infcache.h
|
||||
* PURPOSE: INF file parser that caches contents of INF file in memory
|
||||
* PROGRAMMER: Royce Mitchell III
|
||||
* Eric Kohl
|
||||
*/
|
||||
|
||||
#ifndef __INFCACHE_H__
|
||||
#define __INFCACHE_H__
|
||||
|
||||
|
||||
#define STATUS_BAD_SECTION_NAME_LINE (0xC0700001)
|
||||
#define STATUS_SECTION_NAME_TOO_LONG (0xC0700002)
|
||||
#define STATUS_WRONG_INF_STYLE (0xC0700003)
|
||||
#define STATUS_NOT_ENOUGH_MEMORY (0xC0700004)
|
||||
|
||||
#define MAX_INF_STRING_LENGTH 512
|
||||
|
||||
typedef PVOID HINF, *PHINF;
|
||||
|
||||
typedef struct _INFCONTEXT
|
||||
{
|
||||
PVOID Inf;
|
||||
// PVOID CurrentInf;
|
||||
PVOID Section;
|
||||
PVOID Line;
|
||||
} INFCONTEXT, *PINFCONTEXT;
|
||||
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
NTSTATUS
|
||||
InfOpenBufferedFile(PHINF InfHandle,
|
||||
PVOID Buffer,
|
||||
ULONG BufferSize,
|
||||
PULONG ErrorLine);
|
||||
|
||||
NTSTATUS
|
||||
InfOpenFile (PHINF InfHandle,
|
||||
PUNICODE_STRING FileName,
|
||||
PULONG ErrorLine);
|
||||
|
||||
VOID
|
||||
InfCloseFile (HINF InfHandle);
|
||||
|
||||
|
||||
BOOLEAN
|
||||
InfFindFirstLine (HINF InfHandle,
|
||||
PCWSTR Section,
|
||||
PCWSTR Key,
|
||||
PINFCONTEXT Context);
|
||||
|
||||
BOOLEAN
|
||||
InfFindNextLine (PINFCONTEXT ContextIn,
|
||||
PINFCONTEXT ContextOut);
|
||||
|
||||
BOOLEAN
|
||||
InfFindFirstMatchLine (PINFCONTEXT ContextIn,
|
||||
PCWSTR Key,
|
||||
PINFCONTEXT ContextOut);
|
||||
|
||||
BOOLEAN
|
||||
InfFindNextMatchLine (PINFCONTEXT ContextIn,
|
||||
PCWSTR Key,
|
||||
PINFCONTEXT ContextOut);
|
||||
|
||||
|
||||
LONG
|
||||
InfGetLineCount (HINF InfHandle,
|
||||
PCWSTR Section);
|
||||
|
||||
LONG
|
||||
InfGetFieldCount (PINFCONTEXT Context);
|
||||
|
||||
|
||||
BOOLEAN
|
||||
InfGetBinaryField (PINFCONTEXT Context,
|
||||
ULONG FieldIndex,
|
||||
PUCHAR ReturnBuffer,
|
||||
ULONG ReturnBufferSize,
|
||||
PULONG RequiredSize);
|
||||
|
||||
BOOLEAN
|
||||
InfGetIntField (PINFCONTEXT Context,
|
||||
ULONG FieldIndex,
|
||||
PLONG IntegerValue);
|
||||
|
||||
BOOLEAN
|
||||
InfGetMultiSzField (PINFCONTEXT Context,
|
||||
ULONG FieldIndex,
|
||||
PWSTR ReturnBuffer,
|
||||
ULONG ReturnBufferSize,
|
||||
PULONG RequiredSize);
|
||||
|
||||
BOOLEAN
|
||||
InfGetStringField (PINFCONTEXT Context,
|
||||
ULONG FieldIndex,
|
||||
PWSTR ReturnBuffer,
|
||||
ULONG ReturnBufferSize,
|
||||
PULONG RequiredSize);
|
||||
|
||||
|
||||
|
||||
BOOLEAN
|
||||
InfGetData (PINFCONTEXT Context,
|
||||
PWCHAR *Key,
|
||||
PWCHAR *Data);
|
||||
|
||||
BOOLEAN
|
||||
InfGetDataField (PINFCONTEXT Context,
|
||||
ULONG FieldIndex,
|
||||
PWCHAR *Data);
|
||||
|
||||
#endif /* __INFCACHE_H__ */
|
||||
|
||||
/* EOF */
|
|
@ -484,86 +484,90 @@ registry_callback (HINF hInf, PCWSTR Section, BOOLEAN Delete)
|
|||
ULONG Flags;
|
||||
ULONG Length;
|
||||
|
||||
INFCONTEXT Context;
|
||||
PINFCONTEXT Context;
|
||||
HANDLE KeyHandle;
|
||||
BOOLEAN Ok;
|
||||
|
||||
|
||||
Ok = InfFindFirstLine (hInf, Section, NULL, &Context);
|
||||
|
||||
for (;Ok; Ok = InfFindNextLine (&Context, &Context))
|
||||
if (Ok)
|
||||
{
|
||||
/* get root */
|
||||
if (!InfGetStringField (&Context, 1, Buffer, MAX_INF_STRING_LENGTH, NULL))
|
||||
continue;
|
||||
if (!GetRootKey (Buffer))
|
||||
continue;
|
||||
for (;Ok; Ok = InfFindNextLine (Context, Context))
|
||||
{
|
||||
/* get root */
|
||||
if (!InfGetStringField (Context, 1, Buffer, MAX_INF_STRING_LENGTH, NULL))
|
||||
continue;
|
||||
if (!GetRootKey (Buffer))
|
||||
continue;
|
||||
|
||||
/* get key */
|
||||
Length = wcslen (Buffer);
|
||||
if (!InfGetStringField (&Context, 2, Buffer + Length, MAX_INF_STRING_LENGTH - Length, NULL))
|
||||
*Buffer = 0;
|
||||
/* get key */
|
||||
Length = wcslen (Buffer);
|
||||
if (!InfGetStringField (Context, 2, Buffer + Length, MAX_INF_STRING_LENGTH - Length, NULL))
|
||||
*Buffer = 0;
|
||||
|
||||
DPRINT("KeyName: <%S>\n", Buffer);
|
||||
DPRINT("KeyName: <%S>\n", Buffer);
|
||||
|
||||
/* get flags */
|
||||
if (!InfGetIntField (&Context, 4, (PLONG)&Flags))
|
||||
Flags = 0;
|
||||
/* get flags */
|
||||
if (!InfGetIntField (Context, 4, (PLONG)&Flags))
|
||||
Flags = 0;
|
||||
|
||||
DPRINT("Flags: %lx\n", Flags);
|
||||
DPRINT("Flags: %lx\n", Flags);
|
||||
|
||||
RtlInitUnicodeString (&Name,
|
||||
Buffer);
|
||||
RtlInitUnicodeString (&Name,
|
||||
Buffer);
|
||||
|
||||
InitializeObjectAttributes (&ObjectAttributes,
|
||||
&Name,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL);
|
||||
InitializeObjectAttributes (&ObjectAttributes,
|
||||
&Name,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
if (Delete || (Flags & FLG_ADDREG_OVERWRITEONLY))
|
||||
{
|
||||
Status = NtOpenKey (&KeyHandle,
|
||||
KEY_ALL_ACCESS,
|
||||
&ObjectAttributes);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("NtOpenKey(%wZ) failed (Status %lx)\n", &Name, Status);
|
||||
continue; /* ignore if it doesn't exist */
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = CreateNestedKey (&KeyHandle,
|
||||
KEY_ALL_ACCESS,
|
||||
&ObjectAttributes);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("CreateNestedKey(%wZ) failed (Status %lx)\n", &Name, Status);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (Delete || (Flags & FLG_ADDREG_OVERWRITEONLY))
|
||||
{
|
||||
Status = NtOpenKey (&KeyHandle,
|
||||
KEY_ALL_ACCESS,
|
||||
&ObjectAttributes);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("NtOpenKey(%wZ) failed (Status %lx)\n", &Name, Status);
|
||||
continue; /* ignore if it doesn't exist */
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = CreateNestedKey (&KeyHandle,
|
||||
KEY_ALL_ACCESS,
|
||||
&ObjectAttributes);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("CreateNestedKey(%wZ) failed (Status %lx)\n", &Name, Status);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* get value name */
|
||||
if (InfGetStringField (&Context, 3, Buffer, MAX_INF_STRING_LENGTH, NULL))
|
||||
{
|
||||
RtlInitUnicodeString (&Value,
|
||||
Buffer);
|
||||
ValuePtr = &Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
ValuePtr = NULL;
|
||||
}
|
||||
/* get value name */
|
||||
if (InfGetStringField (Context, 3, Buffer, MAX_INF_STRING_LENGTH, NULL))
|
||||
{
|
||||
RtlInitUnicodeString (&Value,
|
||||
Buffer);
|
||||
ValuePtr = &Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
ValuePtr = NULL;
|
||||
}
|
||||
|
||||
/* and now do it */
|
||||
if (!do_reg_operation (KeyHandle, ValuePtr, &Context, Flags))
|
||||
{
|
||||
NtClose (KeyHandle);
|
||||
return FALSE;
|
||||
}
|
||||
/* and now do it */
|
||||
if (!do_reg_operation (KeyHandle, ValuePtr, Context, Flags))
|
||||
{
|
||||
NtClose (KeyHandle);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
NtClose (KeyHandle);
|
||||
NtClose (KeyHandle);
|
||||
}
|
||||
InfFreeContext(Context);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -121,7 +121,7 @@ CreateComputerTypeList(HINF InfFile)
|
|||
{
|
||||
CHAR Buffer[128];
|
||||
PGENERIC_LIST List;
|
||||
INFCONTEXT Context;
|
||||
PINFCONTEXT Context;
|
||||
PWCHAR KeyName;
|
||||
PWCHAR KeyValue;
|
||||
PWCHAR UserData;
|
||||
|
@ -145,7 +145,7 @@ CreateComputerTypeList(HINF InfFile)
|
|||
|
||||
do
|
||||
{
|
||||
if (!InfGetDataField(&Context, 1, &KeyValue))
|
||||
if (!InfGetDataField(Context, 1, &KeyValue))
|
||||
{
|
||||
/* FIXME: Handle error! */
|
||||
DPRINT("InfGetDataField() failed\n");
|
||||
|
@ -155,7 +155,7 @@ CreateComputerTypeList(HINF InfFile)
|
|||
DPRINT("KeyValue: %S\n", KeyValue);
|
||||
if (wcsstr(ComputerIdentifier, KeyValue))
|
||||
{
|
||||
if (!InfGetDataField(&Context, 0, &KeyName))
|
||||
if (!InfGetDataField(Context, 0, &KeyName))
|
||||
{
|
||||
/* FIXME: Handle error! */
|
||||
DPRINT("InfGetDataField() failed\n");
|
||||
|
@ -166,7 +166,8 @@ CreateComputerTypeList(HINF InfFile)
|
|||
wcscpy(ComputerKey, KeyName);
|
||||
}
|
||||
}
|
||||
while (InfFindNextLine(&Context, &Context));
|
||||
while (InfFindNextLine(Context, Context));
|
||||
InfFreeContext(Context);
|
||||
|
||||
List = CreateGenericList();
|
||||
if (List == NULL)
|
||||
|
@ -180,7 +181,7 @@ CreateComputerTypeList(HINF InfFile)
|
|||
|
||||
do
|
||||
{
|
||||
if (!InfGetData (&Context, &KeyName, &KeyValue))
|
||||
if (!InfGetData (Context, &KeyName, &KeyValue))
|
||||
{
|
||||
/* FIXME: Handle error! */
|
||||
DPRINT("InfGetData() failed\n");
|
||||
|
@ -201,7 +202,8 @@ CreateComputerTypeList(HINF InfFile)
|
|||
AppendGenericListEntry(List, Buffer, UserData,
|
||||
_wcsicmp(KeyName, ComputerKey) ? FALSE : TRUE);
|
||||
}
|
||||
while (InfFindNextLine(&Context, &Context));
|
||||
while (InfFindNextLine(Context, Context));
|
||||
InfFreeContext(Context);
|
||||
|
||||
return List;
|
||||
}
|
||||
|
@ -371,7 +373,7 @@ CreateDisplayDriverList(HINF InfFile)
|
|||
{
|
||||
CHAR Buffer[128];
|
||||
PGENERIC_LIST List;
|
||||
INFCONTEXT Context;
|
||||
PINFCONTEXT Context;
|
||||
PWCHAR KeyName;
|
||||
PWCHAR KeyValue;
|
||||
PWCHAR UserData;
|
||||
|
@ -395,7 +397,7 @@ CreateDisplayDriverList(HINF InfFile)
|
|||
|
||||
do
|
||||
{
|
||||
if (!InfGetDataField(&Context, 1, &KeyValue))
|
||||
if (!InfGetDataField(Context, 1, &KeyValue))
|
||||
{
|
||||
/* FIXME: Handle error! */
|
||||
DPRINT("InfGetDataField() failed\n");
|
||||
|
@ -405,7 +407,7 @@ CreateDisplayDriverList(HINF InfFile)
|
|||
DPRINT("KeyValue: %S\n", KeyValue);
|
||||
if (wcsstr(DisplayIdentifier, KeyValue))
|
||||
{
|
||||
if (!InfGetDataField(&Context, 0, &KeyName))
|
||||
if (!InfGetDataField(Context, 0, &KeyName))
|
||||
{
|
||||
/* FIXME: Handle error! */
|
||||
DPRINT("InfGetDataField() failed\n");
|
||||
|
@ -416,7 +418,8 @@ CreateDisplayDriverList(HINF InfFile)
|
|||
wcscpy(DisplayKey, KeyName);
|
||||
}
|
||||
}
|
||||
while (InfFindNextLine(&Context, &Context));
|
||||
while (InfFindNextLine(Context, Context));
|
||||
InfFreeContext(Context);
|
||||
|
||||
|
||||
List = CreateGenericList();
|
||||
|
@ -431,13 +434,13 @@ CreateDisplayDriverList(HINF InfFile)
|
|||
|
||||
do
|
||||
{
|
||||
if (!InfGetDataField(&Context, 0, &KeyName))
|
||||
if (!InfGetDataField(Context, 0, &KeyName))
|
||||
{
|
||||
DPRINT1("InfGetDataField() failed\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (!InfGetDataField(&Context, 1, &KeyValue))
|
||||
if (!InfGetDataField(Context, 1, &KeyValue))
|
||||
{
|
||||
DPRINT1("InfGetDataField() failed\n");
|
||||
break;
|
||||
|
@ -461,7 +464,8 @@ CreateDisplayDriverList(HINF InfFile)
|
|||
UserData,
|
||||
_wcsicmp(KeyName, DisplayKey) ? FALSE : TRUE);
|
||||
}
|
||||
while (InfFindNextLine(&Context, &Context));
|
||||
while (InfFindNextLine(Context, Context));
|
||||
InfFreeContext(Context);
|
||||
|
||||
#if 0
|
||||
AppendGenericListEntry(List, "Other display driver", NULL, TRUE);
|
||||
|
@ -497,7 +501,7 @@ BOOLEAN
|
|||
ProcessDisplayRegistry(HINF InfFile, PGENERIC_LIST List)
|
||||
{
|
||||
PGENERIC_LIST_ENTRY Entry;
|
||||
INFCONTEXT Context;
|
||||
PINFCONTEXT Context;
|
||||
PWCHAR ServiceName;
|
||||
ULONG StartValue;
|
||||
NTSTATUS Status;
|
||||
|
@ -517,7 +521,7 @@ ProcessDisplayRegistry(HINF InfFile, PGENERIC_LIST List)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (!InfGetDataField(&Context, 3, &ServiceName))
|
||||
if (!InfGetDataField(Context, 3, &ServiceName))
|
||||
{
|
||||
DPRINT("InfGetDataField() failed\n");
|
||||
return FALSE;
|
||||
|
@ -532,6 +536,7 @@ ProcessDisplayRegistry(HINF InfFile, PGENERIC_LIST List)
|
|||
REG_DWORD,
|
||||
&StartValue,
|
||||
sizeof(ULONG));
|
||||
InfFreeContext(Context);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("RtlWriteRegistryValue() failed (Status %lx)\n", Status);
|
||||
|
@ -549,7 +554,7 @@ CreateKeyboardDriverList(HINF InfFile)
|
|||
{
|
||||
CHAR Buffer[128];
|
||||
PGENERIC_LIST List;
|
||||
INFCONTEXT Context;
|
||||
PINFCONTEXT Context;
|
||||
PWCHAR KeyName;
|
||||
PWCHAR KeyValue;
|
||||
PWCHAR UserData;
|
||||
|
@ -566,7 +571,7 @@ CreateKeyboardDriverList(HINF InfFile)
|
|||
|
||||
do
|
||||
{
|
||||
if (!InfGetData (&Context, &KeyName, &KeyValue))
|
||||
if (!InfGetData (Context, &KeyName, &KeyValue))
|
||||
{
|
||||
/* FIXME: Handle error! */
|
||||
DPRINT("InfGetData() failed\n");
|
||||
|
@ -586,7 +591,8 @@ CreateKeyboardDriverList(HINF InfFile)
|
|||
sprintf(Buffer, "%S", KeyValue);
|
||||
AppendGenericListEntry(List, Buffer, UserData, FALSE);
|
||||
}
|
||||
while (InfFindNextLine(&Context, &Context));
|
||||
while (InfFindNextLine(Context, Context));
|
||||
InfFreeContext(Context);
|
||||
|
||||
return List;
|
||||
}
|
||||
|
@ -597,7 +603,7 @@ CreateKeyboardLayoutList(HINF InfFile)
|
|||
{
|
||||
CHAR Buffer[128];
|
||||
PGENERIC_LIST List;
|
||||
INFCONTEXT Context;
|
||||
PINFCONTEXT Context;
|
||||
PWCHAR KeyName;
|
||||
PWCHAR KeyValue;
|
||||
PWCHAR UserData;
|
||||
|
@ -607,10 +613,14 @@ CreateKeyboardLayoutList(HINF InfFile)
|
|||
if (!InfFindFirstLine (InfFile, L"NLS", L"DefaultLayout", &Context))
|
||||
return NULL;
|
||||
|
||||
if (!InfGetData (&Context, NULL, &KeyValue))
|
||||
return NULL;
|
||||
if (!InfGetData (Context, NULL, &KeyValue))
|
||||
{
|
||||
InfFreeContext(Context);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wcscpy(DefaultLayout, KeyValue);
|
||||
InfFreeContext(Context);
|
||||
|
||||
List = CreateGenericList();
|
||||
if (List == NULL)
|
||||
|
@ -619,12 +629,13 @@ CreateKeyboardLayoutList(HINF InfFile)
|
|||
if (!InfFindFirstLine (InfFile, L"KeyboardLayout", NULL, &Context))
|
||||
{
|
||||
DestroyGenericList(List, FALSE);
|
||||
InfFreeContext(Context);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if (!InfGetData (&Context, &KeyName, &KeyValue))
|
||||
if (!InfGetData (Context, &KeyName, &KeyValue))
|
||||
{
|
||||
/* FIXME: Handle error! */
|
||||
DPRINT("InfGetData() failed\n");
|
||||
|
@ -647,7 +658,8 @@ CreateKeyboardLayoutList(HINF InfFile)
|
|||
UserData,
|
||||
_wcsicmp(KeyName, DefaultLayout) ? FALSE : TRUE);
|
||||
}
|
||||
while (InfFindNextLine(&Context, &Context));
|
||||
while (InfFindNextLine(Context, Context));
|
||||
InfFreeContext(Context);
|
||||
|
||||
return List;
|
||||
}
|
||||
|
|
|
@ -395,7 +395,7 @@ CheckUnattendedSetup(VOID)
|
|||
{
|
||||
WCHAR UnattendInfPath[MAX_PATH];
|
||||
UNICODE_STRING FileName;
|
||||
INFCONTEXT Context;
|
||||
PINFCONTEXT Context;
|
||||
HINF UnattendInf;
|
||||
ULONG ErrorLine;
|
||||
NTSTATUS Status;
|
||||
|
@ -429,14 +429,16 @@ CheckUnattendedSetup(VOID)
|
|||
if (!InfFindFirstLine(UnattendInf, L"Unattend", L"Signature", &Context))
|
||||
{
|
||||
DPRINT("InfFindFirstLine() failed for section 'Unattend'\n");
|
||||
InfFreeContext(Context);
|
||||
InfCloseFile(UnattendInf);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Get pointer 'Signature' key */
|
||||
if (!InfGetData(&Context, NULL, &Value))
|
||||
if (!InfGetData(Context, NULL, &Value))
|
||||
{
|
||||
DPRINT("InfGetData() failed for key 'Signature'\n");
|
||||
InfFreeContext(Context);
|
||||
InfCloseFile(UnattendInf);
|
||||
return;
|
||||
}
|
||||
|
@ -445,6 +447,7 @@ CheckUnattendedSetup(VOID)
|
|||
if (_wcsicmp(Value, L"$ReactOS$") != 0)
|
||||
{
|
||||
DPRINT("Signature not $ReactOS$\n");
|
||||
InfFreeContext(Context);
|
||||
InfCloseFile(UnattendInf);
|
||||
return;
|
||||
}
|
||||
|
@ -453,31 +456,37 @@ CheckUnattendedSetup(VOID)
|
|||
if (!InfFindFirstLine(UnattendInf, L"Unattend", L"DestinationDiskNumber", &Context))
|
||||
{
|
||||
DPRINT("InfFindFirstLine() failed for key 'DestinationDiskNumber'\n");
|
||||
InfFreeContext(Context);
|
||||
InfCloseFile(UnattendInf);
|
||||
return;
|
||||
}
|
||||
if (!InfGetIntField(&Context, 0, &IntValue))
|
||||
if (!InfGetIntField(Context, 0, &IntValue))
|
||||
{
|
||||
DPRINT("InfGetIntField() failed for key 'DestinationDiskNumber'\n");
|
||||
InfFreeContext(Context);
|
||||
InfCloseFile(UnattendInf);
|
||||
return;
|
||||
}
|
||||
UnattendDestinationDiskNumber = IntValue;
|
||||
InfFreeContext(Context);
|
||||
|
||||
/* Search for 'DestinationPartitionNumber' in the 'Unattend' section */
|
||||
if (!InfFindFirstLine(UnattendInf, L"Unattend", L"DestinationPartitionNumber", &Context))
|
||||
{
|
||||
DPRINT("InfFindFirstLine() failed for key 'DestinationPartitionNumber'\n");
|
||||
InfFreeContext(Context);
|
||||
InfCloseFile(UnattendInf);
|
||||
return;
|
||||
}
|
||||
if (!InfGetIntField(&Context, 0, &IntValue))
|
||||
if (!InfGetIntField(Context, 0, &IntValue))
|
||||
{
|
||||
DPRINT("InfGetIntField() failed for key 'DestinationPartitionNumber'\n");
|
||||
InfFreeContext(Context);
|
||||
InfCloseFile(UnattendInf);
|
||||
return;
|
||||
}
|
||||
UnattendDestinationPartitionNumber = IntValue;
|
||||
InfFreeContext(Context);
|
||||
|
||||
/* Search for 'DestinationPartitionNumber' in the 'Unattend' section */
|
||||
if (!InfFindFirstLine(UnattendInf, L"Unattend", L"DestinationPartitionNumber", &Context))
|
||||
|
@ -488,14 +497,16 @@ CheckUnattendedSetup(VOID)
|
|||
}
|
||||
|
||||
/* Get pointer 'InstallationDirectory' key */
|
||||
if (!InfGetData(&Context, NULL, &Value))
|
||||
if (!InfGetData(Context, NULL, &Value))
|
||||
{
|
||||
DPRINT("InfGetData() failed for key 'InstallationDirectory'\n");
|
||||
InfFreeContext(Context);
|
||||
InfCloseFile(UnattendInf);
|
||||
return;
|
||||
}
|
||||
wcscpy(UnattendInstallationDirectory, Value);
|
||||
|
||||
InfFreeContext(Context);
|
||||
InfCloseFile(UnattendInf);
|
||||
|
||||
IsUnattendedSetup = TRUE;
|
||||
|
@ -516,7 +527,7 @@ SetupStartPage(PINPUT_RECORD Ir)
|
|||
NTSTATUS Status;
|
||||
WCHAR FileNameBuffer[MAX_PATH];
|
||||
UNICODE_STRING FileName;
|
||||
INFCONTEXT Context;
|
||||
PINFCONTEXT Context;
|
||||
PWCHAR Value;
|
||||
ULONG ErrorLine;
|
||||
ULONG ReturnSize;
|
||||
|
@ -630,8 +641,9 @@ SetupStartPage(PINPUT_RECORD Ir)
|
|||
|
||||
|
||||
/* Get pointer 'Signature' key */
|
||||
if (!InfGetData (&Context, NULL, &Value))
|
||||
if (!InfGetData (Context, NULL, &Value))
|
||||
{
|
||||
InfFreeContext(Context);
|
||||
PopupError("Setup found a corrupt TXTSETUP.SIF.\n",
|
||||
"ENTER = Reboot computer");
|
||||
|
||||
|
@ -649,6 +661,7 @@ SetupStartPage(PINPUT_RECORD Ir)
|
|||
/* Check 'Signature' string */
|
||||
if (_wcsicmp(Value, L"$ReactOS$") != 0)
|
||||
{
|
||||
InfFreeContext(Context);
|
||||
PopupError("Setup found an invalid signature in TXTSETUP.SIF.\n",
|
||||
"ENTER = Reboot computer");
|
||||
|
||||
|
@ -662,6 +675,7 @@ SetupStartPage(PINPUT_RECORD Ir)
|
|||
}
|
||||
}
|
||||
}
|
||||
InfFreeContext(Context);
|
||||
|
||||
CheckUnattendedSetup();
|
||||
|
||||
|
@ -2565,7 +2579,7 @@ InstallDirectoryPage(PINPUT_RECORD Ir)
|
|||
PPARTENTRY PartEntry;
|
||||
WCHAR InstallDir[51];
|
||||
PWCHAR DefaultPath;
|
||||
INFCONTEXT Context;
|
||||
PINFCONTEXT Context;
|
||||
ULONG Length;
|
||||
|
||||
if (PartitionList == NULL ||
|
||||
|
@ -2598,7 +2612,7 @@ InstallDirectoryPage(PINPUT_RECORD Ir)
|
|||
}
|
||||
|
||||
/* Read the 'DefaultPath' data */
|
||||
if (InfGetData (&Context, NULL, &DefaultPath))
|
||||
if (InfGetData (Context, NULL, &DefaultPath))
|
||||
{
|
||||
wcscpy(InstallDir, DefaultPath);
|
||||
}
|
||||
|
@ -2606,6 +2620,7 @@ InstallDirectoryPage(PINPUT_RECORD Ir)
|
|||
{
|
||||
wcscpy(InstallDir, L"\\ReactOS");
|
||||
}
|
||||
InfFreeContext(Context);
|
||||
Length = wcslen(InstallDir);
|
||||
|
||||
SetTextXY(6, 8, "Setup installs ReactOS files onto the selected partition. Choose a");
|
||||
|
@ -2670,8 +2685,8 @@ AddSectionToCopyQueue(HINF InfFile,
|
|||
PWCHAR SourceCabinet,
|
||||
PINPUT_RECORD Ir)
|
||||
{
|
||||
INFCONTEXT FilesContext;
|
||||
INFCONTEXT DirContext;
|
||||
PINFCONTEXT FilesContext;
|
||||
PINFCONTEXT DirContext;
|
||||
PWCHAR FileKeyName;
|
||||
PWCHAR FileKeyValue;
|
||||
PWCHAR DirKeyValue;
|
||||
|
@ -2702,7 +2717,7 @@ AddSectionToCopyQueue(HINF InfFile,
|
|||
do
|
||||
{
|
||||
/* Get source file name and target directory id */
|
||||
if (!InfGetData (&FilesContext, &FileKeyName, &FileKeyValue))
|
||||
if (!InfGetData (FilesContext, &FileKeyName, &FileKeyValue))
|
||||
{
|
||||
/* FIXME: Handle error! */
|
||||
DPRINT1("InfGetData() failed\n");
|
||||
|
@ -2710,7 +2725,7 @@ AddSectionToCopyQueue(HINF InfFile,
|
|||
}
|
||||
|
||||
/* Get optional target file name */
|
||||
if (!InfGetDataField (&FilesContext, 2, &TargetFileName))
|
||||
if (!InfGetDataField (FilesContext, 2, &TargetFileName))
|
||||
TargetFileName = NULL;
|
||||
|
||||
DPRINT ("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName, FileKeyValue);
|
||||
|
@ -2723,9 +2738,10 @@ AddSectionToCopyQueue(HINF InfFile,
|
|||
break;
|
||||
}
|
||||
|
||||
if (!InfGetData (&DirContext, NULL, &DirKeyValue))
|
||||
if (!InfGetData (DirContext, NULL, &DirKeyValue))
|
||||
{
|
||||
/* FIXME: Handle error! */
|
||||
InfFreeContext(DirContext);
|
||||
DPRINT1("InfGetData() failed\n");
|
||||
break;
|
||||
}
|
||||
|
@ -2741,8 +2757,11 @@ AddSectionToCopyQueue(HINF InfFile,
|
|||
/* FIXME: Handle error! */
|
||||
DPRINT1("SetupQueueCopy() failed\n");
|
||||
}
|
||||
InfFreeContext(DirContext);
|
||||
}
|
||||
while (InfFindNextLine(&FilesContext, &FilesContext));
|
||||
while (InfFindNextLine(FilesContext, FilesContext));
|
||||
|
||||
InfFreeContext(FilesContext);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -2753,7 +2772,7 @@ PrepareCopyPageInfFile(HINF InfFile,
|
|||
PINPUT_RECORD Ir)
|
||||
{
|
||||
WCHAR PathBuffer[MAX_PATH];
|
||||
INFCONTEXT DirContext;
|
||||
PINFCONTEXT DirContext;
|
||||
PWCHAR AdditionalSectionName;
|
||||
PWCHAR KeyValue;
|
||||
ULONG Length;
|
||||
|
@ -2840,7 +2859,7 @@ PrepareCopyPageInfFile(HINF InfFile,
|
|||
/* Enumerate the directory values and create the subdirectories */
|
||||
do
|
||||
{
|
||||
if (!InfGetData (&DirContext, NULL, &KeyValue))
|
||||
if (!InfGetData (DirContext, NULL, &KeyValue))
|
||||
{
|
||||
DPRINT1("break\n");
|
||||
break;
|
||||
|
@ -2883,7 +2902,9 @@ PrepareCopyPageInfFile(HINF InfFile,
|
|||
}
|
||||
}
|
||||
}
|
||||
while (InfFindNextLine (&DirContext, &DirContext));
|
||||
while (InfFindNextLine (DirContext, DirContext));
|
||||
|
||||
InfFreeContext(DirContext);
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
@ -2894,7 +2915,7 @@ PrepareCopyPage(PINPUT_RECORD Ir)
|
|||
{
|
||||
HINF InfHandle;
|
||||
WCHAR PathBuffer[MAX_PATH];
|
||||
INFCONTEXT CabinetsContext;
|
||||
PINFCONTEXT CabinetsContext;
|
||||
ULONG InfFileSize;
|
||||
PWCHAR KeyValue;
|
||||
NTSTATUS Status;
|
||||
|
@ -2940,7 +2961,7 @@ PrepareCopyPage(PINPUT_RECORD Ir)
|
|||
*/
|
||||
do
|
||||
{
|
||||
if (!InfGetData (&CabinetsContext, NULL, &KeyValue))
|
||||
if (!InfGetData (CabinetsContext, NULL, &KeyValue))
|
||||
break;
|
||||
|
||||
wcscpy(PathBuffer, SourcePath.Buffer);
|
||||
|
@ -3017,7 +3038,9 @@ PrepareCopyPage(PINPUT_RECORD Ir)
|
|||
return QUIT_PAGE;
|
||||
}
|
||||
}
|
||||
while (InfFindNextLine (&CabinetsContext, &CabinetsContext));
|
||||
while (InfFindNextLine (CabinetsContext, CabinetsContext));
|
||||
|
||||
InfFreeContext(CabinetsContext);
|
||||
|
||||
return FILE_COPY_PAGE;
|
||||
}
|
||||
|
@ -3095,7 +3118,7 @@ FileCopyPage(PINPUT_RECORD Ir)
|
|||
static PAGE_NUMBER
|
||||
RegistryPage(PINPUT_RECORD Ir)
|
||||
{
|
||||
INFCONTEXT InfContext;
|
||||
PINFCONTEXT InfContext;
|
||||
PWSTR Action;
|
||||
PWSTR File;
|
||||
PWSTR Section;
|
||||
|
@ -3164,9 +3187,9 @@ RegistryPage(PINPUT_RECORD Ir)
|
|||
|
||||
do
|
||||
{
|
||||
InfGetDataField (&InfContext, 0, &Action);
|
||||
InfGetDataField (&InfContext, 1, &File);
|
||||
InfGetDataField (&InfContext, 2, &Section);
|
||||
InfGetDataField (InfContext, 0, &Action);
|
||||
InfGetDataField (InfContext, 1, &File);
|
||||
InfGetDataField (InfContext, 2, &Section);
|
||||
|
||||
DPRINT("Action: %S File: %S Section %S\n", Action, File, Section);
|
||||
|
||||
|
@ -3203,7 +3226,9 @@ RegistryPage(PINPUT_RECORD Ir)
|
|||
}
|
||||
}
|
||||
}
|
||||
while (InfFindNextLine (&InfContext, &InfContext));
|
||||
while (InfFindNextLine (InfContext, InfContext));
|
||||
|
||||
InfFreeContext(InfContext);
|
||||
|
||||
/* Update display registry settings */
|
||||
SetStatusText(" Updating display registry settings...");
|
||||
|
@ -3647,6 +3672,7 @@ NtProcessStartup(PPEB Peb)
|
|||
RtlNormalizeProcessParams(Peb->ProcessParameters);
|
||||
|
||||
ProcessHeap = Peb->ProcessHeap;
|
||||
InfSetHeap(ProcessHeap);
|
||||
|
||||
SignalInitEvent();
|
||||
|
||||
|
|
|
@ -54,11 +54,12 @@
|
|||
/* ReactOS Version */
|
||||
#include <reactos/buildno.h>
|
||||
|
||||
#include <infros.h>
|
||||
|
||||
/* Internal Headers */
|
||||
#include "console.h"
|
||||
#include "partlist.h"
|
||||
#include "inicache.h"
|
||||
#include "infcache.h"
|
||||
#include "filequeue.h"
|
||||
#include "progress.h"
|
||||
#include "bootsup.h"
|
||||
|
|
|
@ -2,12 +2,14 @@
|
|||
<bootstrap base="reactos/system32" nameoncd="smss.exe" />
|
||||
<include base="usetup">.</include>
|
||||
<include base="zlib">.</include>
|
||||
<include base="inflib">.</include>
|
||||
<define name="__USE_W32API" />
|
||||
<define name="_DISABLE_TIDENTS" />
|
||||
<define name="_WIN32_WINNT">0x0502</define>
|
||||
<define name="__NO_CTYPE_INLINES" />
|
||||
<linkerflag>-lgcc</linkerflag>
|
||||
<library>zlib</library>
|
||||
<library>inflib</library>
|
||||
<library>vfatlib</library>
|
||||
<library>ntdll</library>
|
||||
<pch>usetup.h</pch>
|
||||
|
@ -20,7 +22,6 @@
|
|||
<file>format.c</file>
|
||||
<file>fslist.c</file>
|
||||
<file>genlist.c</file>
|
||||
<file>infcache.c</file>
|
||||
<file>inicache.c</file>
|
||||
<file>keytrans.c</file>
|
||||
<file>partlist.c</file>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue