[SETUP] Add support for archtitcure specific inf sections and use it for x64 computer type

This commit is contained in:
Timo Kreuzer 2019-07-27 09:56:37 +02:00
parent a71a6531ef
commit 85616bc8b2
2 changed files with 52 additions and 16 deletions

View file

@ -433,16 +433,18 @@ DefaultProcessEntry(
}
PGENERIC_LIST
CreateComputerTypeList(
IN HINF InfFile)
BOOLEAN
AddComputerTypeEntries(
_In_ HINF InfFile,
PGENERIC_LIST List,
_In_ PWSTR SectionName)
{
PGENERIC_LIST List;
INFCONTEXT Context;
PCWSTR KeyName;
PCWSTR KeyValue;
WCHAR ComputerIdentifier[128];
WCHAR ComputerKey[32];
ULONG Count1, Count2;
/* Get the computer identification */
if (!GetComputerIdentifier(ComputerIdentifier, 128))
@ -453,10 +455,10 @@ CreateComputerTypeList(
DPRINT("Computer identifier: '%S'\n", ComputerIdentifier);
/* Search for matching device identifier */
if (!SpInfFindFirstLine(InfFile, L"Map.Computer", NULL, &Context))
if (!SpInfFindFirstLine(InfFile, SectionName, NULL, &Context))
{
/* FIXME: error message */
return NULL;
return FALSE;
}
do
@ -467,7 +469,7 @@ CreateComputerTypeList(
{
/* FIXME: Handle error! */
DPRINT("INF_GetDataField() failed\n");
return NULL;
return FALSE;
}
DPRINT("KeyValue: %S\n", KeyValue);
@ -481,7 +483,7 @@ CreateComputerTypeList(
{
/* FIXME: Handle error! */
DPRINT("INF_GetDataField() failed\n");
return NULL;
return FALSE;
}
DPRINT("Computer key: %S\n", KeyName);
@ -489,16 +491,40 @@ CreateComputerTypeList(
INF_FreeData(KeyName);
} while (SpInfFindNextLine(&Context, &Context));
Count1 = AddEntriesFromInfSection(List,
InfFile,
L"Computer",
&Context,
DefaultProcessEntry,
ComputerKey);
Count2 = AddEntriesFromInfSection(List,
InfFile,
L"Computer.NT" INF_ARCH,
&Context,
DefaultProcessEntry,
ComputerKey);
if ((Count1 == -1) && (Count2 == -1))
{
return FALSE;
}
return TRUE;
}
PGENERIC_LIST
CreateComputerTypeList(
IN HINF InfFile)
{
PGENERIC_LIST List;
BOOLEAN Success;
List = CreateGenericList();
if (List == NULL)
return NULL;
if (AddEntriesFromInfSection(List,
InfFile,
L"Computer",
&Context,
DefaultProcessEntry,
ComputerKey) == -1)
Success = AddComputerTypeEntries(InfFile, List, L"Map.Computer");
Success |= AddComputerTypeEntries(InfFile, List, L"Map.Computer.NT" INF_ARCH);
if (!Success)
{
DestroyGenericList(List, TRUE);
return NULL;