mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 16:12:58 +00:00
[SETUPLIB][REACTOS][USETUP] Further improve the interfacing with INF and File-Queue APIs.
This allows using some of the SetupApi.dll functions when SETUPLIB is used in the (Win32) GUI 1st-stage installer "REACTOS", while using the custom implemented NT-aware functions in "USETUP".
This commit is contained in:
parent
44c101c9dc
commit
8f1ab791fa
22 changed files with 702 additions and 396 deletions
|
@ -1,14 +1,15 @@
|
||||||
|
|
||||||
add_definitions(${I18N_DEFS})
|
add_definitions(${I18N_DEFS})
|
||||||
|
|
||||||
include_directories(utils)
|
include_directories(spapisup utils)
|
||||||
|
|
||||||
list(APPEND SOURCE
|
list(APPEND SOURCE
|
||||||
|
spapisup/fileqsup.c
|
||||||
|
spapisup/infsupp.c
|
||||||
utils/arcname.c
|
utils/arcname.c
|
||||||
utils/bldrsup.c
|
utils/bldrsup.c
|
||||||
utils/filesup.c
|
utils/filesup.c
|
||||||
utils/genlist.c
|
utils/genlist.c
|
||||||
utils/infsupp.c
|
|
||||||
utils/inicache.c
|
utils/inicache.c
|
||||||
utils/ntverrsrc.c
|
utils/ntverrsrc.c
|
||||||
utils/osdetect.c
|
utils/osdetect.c
|
||||||
|
|
|
@ -55,18 +55,6 @@
|
||||||
#define FLG_ADDREG_TYPE_MASK (0xFFFF0000 | FLG_ADDREG_BINVALUETYPE)
|
#define FLG_ADDREG_TYPE_MASK (0xFFFF0000 | FLG_ADDREG_BINVALUETYPE)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _M_IX86
|
|
||||||
#define Architecture L"x86"
|
|
||||||
#elif defined(_M_AMD64)
|
|
||||||
#define Architecture L"amd64"
|
|
||||||
#elif defined(_M_IA64)
|
|
||||||
#define Architecture L"ia64"
|
|
||||||
#elif defined(_M_ARM)
|
|
||||||
#define Architecture L"arm"
|
|
||||||
#elif defined(_M_PPC)
|
|
||||||
#define Architecture L"ppc"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* GLOBALS ******************************************************************/
|
/* GLOBALS ******************************************************************/
|
||||||
|
|
||||||
#define REGISTRY_SETUP_MACHINE L"\\Registry\\Machine\\SYSTEM\\USetup_Machine\\"
|
#define REGISTRY_SETUP_MACHINE L"\\Registry\\Machine\\SYSTEM\\USetup_Machine\\"
|
||||||
|
@ -301,13 +289,13 @@ do_reg_operation(HANDLE KeyHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(Flags & FLG_ADDREG_BINVALUETYPE) ||
|
if (!(Flags & FLG_ADDREG_BINVALUETYPE) ||
|
||||||
(Type == REG_DWORD && SetupGetFieldCount (Context) == 5))
|
(Type == REG_DWORD && SpInfGetFieldCount(Context) == 5))
|
||||||
{
|
{
|
||||||
PWCHAR Str = NULL;
|
PWCHAR Str = NULL;
|
||||||
|
|
||||||
if (Type == REG_MULTI_SZ)
|
if (Type == REG_MULTI_SZ)
|
||||||
{
|
{
|
||||||
if (!SetupGetMultiSzFieldW (Context, 5, NULL, 0, &Size))
|
if (!SpInfGetMultiSzField(Context, 5, NULL, 0, &Size))
|
||||||
Size = 0;
|
Size = 0;
|
||||||
|
|
||||||
if (Size)
|
if (Size)
|
||||||
|
@ -316,7 +304,7 @@ do_reg_operation(HANDLE KeyHandle,
|
||||||
if (Str == NULL)
|
if (Str == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
SetupGetMultiSzFieldW (Context, 5, Str, Size, NULL);
|
SpInfGetMultiSzField(Context, 5, Str, Size, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Flags & FLG_ADDREG_APPEND)
|
if (Flags & FLG_ADDREG_APPEND)
|
||||||
|
@ -334,7 +322,7 @@ do_reg_operation(HANDLE KeyHandle,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!SetupGetStringFieldW(Context, 5, NULL, 0, &Size))
|
if (!SpInfGetStringField(Context, 5, NULL, 0, &Size))
|
||||||
Size = 0;
|
Size = 0;
|
||||||
|
|
||||||
if (Size)
|
if (Size)
|
||||||
|
@ -343,7 +331,7 @@ do_reg_operation(HANDLE KeyHandle,
|
||||||
if (Str == NULL)
|
if (Str == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
SetupGetStringFieldW(Context, 5, Str, Size, NULL);
|
SpInfGetStringField(Context, 5, Str, Size, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -389,7 +377,7 @@ do_reg_operation(HANDLE KeyHandle,
|
||||||
{
|
{
|
||||||
PUCHAR Data = NULL;
|
PUCHAR Data = NULL;
|
||||||
|
|
||||||
if (!SetupGetBinaryField (Context, 5, NULL, 0, &Size))
|
if (!SpInfGetBinaryField(Context, 5, NULL, 0, &Size))
|
||||||
Size = 0;
|
Size = 0;
|
||||||
|
|
||||||
if (Size)
|
if (Size)
|
||||||
|
@ -399,7 +387,7 @@ do_reg_operation(HANDLE KeyHandle,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
DPRINT("setting binary data %wZ len %lu\n", ValueName, Size);
|
DPRINT("setting binary data %wZ len %lu\n", ValueName, Size);
|
||||||
SetupGetBinaryField (Context, 5, Data, Size, NULL);
|
SpInfGetBinaryField(Context, 5, Data, Size, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
NtSetValueKey (KeyHandle,
|
NtSetValueKey (KeyHandle,
|
||||||
|
@ -435,27 +423,27 @@ registry_callback(HINF hInf, PCWSTR Section, BOOLEAN Delete)
|
||||||
HANDLE RootKeyHandle, KeyHandle;
|
HANDLE RootKeyHandle, KeyHandle;
|
||||||
BOOLEAN Ok;
|
BOOLEAN Ok;
|
||||||
|
|
||||||
Ok = SetupFindFirstLineW(hInf, Section, NULL, &Context);
|
Ok = SpInfFindFirstLine(hInf, Section, NULL, &Context);
|
||||||
if (!Ok)
|
if (!Ok)
|
||||||
return TRUE; /* Don't fail if the section isn't present */
|
return TRUE; /* Don't fail if the section isn't present */
|
||||||
|
|
||||||
for (;Ok; Ok = SetupFindNextLine(&Context, &Context))
|
for (;Ok; Ok = SpInfFindNextLine(&Context, &Context))
|
||||||
{
|
{
|
||||||
/* get root */
|
/* get root */
|
||||||
if (!SetupGetStringFieldW(&Context, 1, Buffer, sizeof(Buffer)/sizeof(WCHAR), NULL))
|
if (!SpInfGetStringField(&Context, 1, Buffer, sizeof(Buffer)/sizeof(WCHAR), NULL))
|
||||||
continue;
|
continue;
|
||||||
RootKeyHandle = GetRootKeyByName(Buffer, &RootKeyName);
|
RootKeyHandle = GetRootKeyByName(Buffer, &RootKeyName);
|
||||||
if (!RootKeyHandle)
|
if (!RootKeyHandle)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* get key */
|
/* get key */
|
||||||
if (!SetupGetStringFieldW(&Context, 2, Buffer, sizeof(Buffer)/sizeof(WCHAR), NULL))
|
if (!SpInfGetStringField(&Context, 2, Buffer, sizeof(Buffer)/sizeof(WCHAR), NULL))
|
||||||
*Buffer = 0;
|
*Buffer = 0;
|
||||||
|
|
||||||
DPRINT("KeyName: <%S\\%S>\n", RootKeyName, Buffer);
|
DPRINT("KeyName: <%S\\%S>\n", RootKeyName, Buffer);
|
||||||
|
|
||||||
/* get flags */
|
/* get flags */
|
||||||
if (!SetupGetIntField(&Context, 4, (PINT)&Flags))
|
if (!SpInfGetIntField(&Context, 4, (PINT)&Flags))
|
||||||
Flags = 0;
|
Flags = 0;
|
||||||
|
|
||||||
DPRINT("Flags: %lx\n", Flags);
|
DPRINT("Flags: %lx\n", Flags);
|
||||||
|
@ -492,7 +480,7 @@ registry_callback(HINF hInf, PCWSTR Section, BOOLEAN Delete)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get value name */
|
/* get value name */
|
||||||
if (SetupGetStringFieldW(&Context, 3, Buffer, sizeof(Buffer)/sizeof(WCHAR), NULL))
|
if (SpInfGetStringField(&Context, 3, Buffer, sizeof(Buffer)/sizeof(WCHAR), NULL))
|
||||||
{
|
{
|
||||||
RtlInitUnicodeString(&Value, Buffer);
|
RtlInitUnicodeString(&Value, Buffer);
|
||||||
ValuePtr = &Value;
|
ValuePtr = &Value;
|
||||||
|
@ -531,14 +519,14 @@ ImportRegistryFile(
|
||||||
CombinePaths(FileNameBuffer, ARRAYSIZE(FileNameBuffer), 2,
|
CombinePaths(FileNameBuffer, ARRAYSIZE(FileNameBuffer), 2,
|
||||||
SourcePath, FileName);
|
SourcePath, FileName);
|
||||||
|
|
||||||
hInf = SetupOpenInfFileExW(FileNameBuffer,
|
hInf = SpInfOpenInfFile(FileNameBuffer,
|
||||||
NULL,
|
NULL,
|
||||||
INF_STYLE_WIN4,
|
INF_STYLE_WIN4,
|
||||||
LocaleId,
|
LocaleId,
|
||||||
&ErrorLine);
|
&ErrorLine);
|
||||||
if (hInf == INVALID_HANDLE_VALUE)
|
if (hInf == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
DPRINT1("SetupOpenInfFileEx() failed\n");
|
DPRINT1("SpInfOpenInfFile() failed\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -546,7 +534,7 @@ ImportRegistryFile(
|
||||||
if (!registry_callback(hInf, L"DelReg", FALSE))
|
if (!registry_callback(hInf, L"DelReg", FALSE))
|
||||||
{
|
{
|
||||||
DPRINT1("registry_callback() failed\n");
|
DPRINT1("registry_callback() failed\n");
|
||||||
SetupCloseInfFile(hInf);
|
SpInfCloseInfFile(hInf);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -554,18 +542,18 @@ ImportRegistryFile(
|
||||||
if (!registry_callback(hInf, L"AddReg", FALSE))
|
if (!registry_callback(hInf, L"AddReg", FALSE))
|
||||||
{
|
{
|
||||||
DPRINT1("registry_callback() failed\n");
|
DPRINT1("registry_callback() failed\n");
|
||||||
SetupCloseInfFile(hInf);
|
SpInfCloseInfFile(hInf);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!registry_callback(hInf, L"AddReg.NT" Architecture, FALSE))
|
if (!registry_callback(hInf, L"AddReg.NT" INF_ARCH, FALSE))
|
||||||
{
|
{
|
||||||
DPRINT1("registry_callback() failed\n");
|
DPRINT1("registry_callback() failed\n");
|
||||||
SetupCloseInfFile(hInf);
|
SpInfCloseInfFile(hInf);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetupCloseInfFile(hInf);
|
SpInfCloseInfFile(hInf);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -337,13 +337,13 @@ AddEntriesFromInfSection(
|
||||||
IN PVOID Parameter OPTIONAL)
|
IN PVOID Parameter OPTIONAL)
|
||||||
{
|
{
|
||||||
LONG TotalCount = 0;
|
LONG TotalCount = 0;
|
||||||
PWCHAR KeyName;
|
PCWSTR KeyName;
|
||||||
PWCHAR KeyValue;
|
PCWSTR KeyValue;
|
||||||
PVOID UserData;
|
PVOID UserData;
|
||||||
BOOLEAN Current;
|
BOOLEAN Current;
|
||||||
UCHAR RetVal;
|
UCHAR RetVal;
|
||||||
|
|
||||||
if (!SetupFindFirstLineW(InfFile, SectionName, NULL, pContext))
|
if (!SpInfFindFirstLine(InfFile, SectionName, NULL, pContext))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
do
|
do
|
||||||
|
@ -389,7 +389,7 @@ AddEntriesFromInfSection(
|
||||||
}
|
}
|
||||||
// else if (RetVal == 2), skip the entry.
|
// else if (RetVal == 2), skip the entry.
|
||||||
|
|
||||||
} while (SetupFindNextLine(pContext, pContext));
|
} while (SpInfFindNextLine(pContext, pContext));
|
||||||
|
|
||||||
return TotalCount;
|
return TotalCount;
|
||||||
}
|
}
|
||||||
|
@ -439,8 +439,8 @@ CreateComputerTypeList(
|
||||||
{
|
{
|
||||||
PGENERIC_LIST List;
|
PGENERIC_LIST List;
|
||||||
INFCONTEXT Context;
|
INFCONTEXT Context;
|
||||||
PWCHAR KeyName;
|
PCWSTR KeyName;
|
||||||
PWCHAR KeyValue;
|
PCWSTR KeyValue;
|
||||||
WCHAR ComputerIdentifier[128];
|
WCHAR ComputerIdentifier[128];
|
||||||
WCHAR ComputerKey[32];
|
WCHAR ComputerKey[32];
|
||||||
|
|
||||||
|
@ -453,7 +453,7 @@ CreateComputerTypeList(
|
||||||
DPRINT("Computer identifier: '%S'\n", ComputerIdentifier);
|
DPRINT("Computer identifier: '%S'\n", ComputerIdentifier);
|
||||||
|
|
||||||
/* Search for matching device identifier */
|
/* Search for matching device identifier */
|
||||||
if (!SetupFindFirstLineW(InfFile, L"Map.Computer", NULL, &Context))
|
if (!SpInfFindFirstLine(InfFile, L"Map.Computer", NULL, &Context))
|
||||||
{
|
{
|
||||||
/* FIXME: error message */
|
/* FIXME: error message */
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -487,7 +487,7 @@ CreateComputerTypeList(
|
||||||
DPRINT("Computer key: %S\n", KeyName);
|
DPRINT("Computer key: %S\n", KeyName);
|
||||||
RtlStringCchCopyW(ComputerKey, ARRAYSIZE(ComputerKey), KeyName);
|
RtlStringCchCopyW(ComputerKey, ARRAYSIZE(ComputerKey), KeyName);
|
||||||
INF_FreeData(KeyName);
|
INF_FreeData(KeyName);
|
||||||
} while (SetupFindNextLine(&Context, &Context));
|
} while (SpInfFindNextLine(&Context, &Context));
|
||||||
|
|
||||||
List = CreateGenericList();
|
List = CreateGenericList();
|
||||||
if (List == NULL)
|
if (List == NULL)
|
||||||
|
@ -675,8 +675,8 @@ CreateDisplayDriverList(
|
||||||
{
|
{
|
||||||
PGENERIC_LIST List;
|
PGENERIC_LIST List;
|
||||||
INFCONTEXT Context;
|
INFCONTEXT Context;
|
||||||
PWCHAR KeyName;
|
PCWSTR KeyName;
|
||||||
PWCHAR KeyValue;
|
PCWSTR KeyValue;
|
||||||
WCHAR DisplayIdentifier[128];
|
WCHAR DisplayIdentifier[128];
|
||||||
WCHAR DisplayKey[32];
|
WCHAR DisplayKey[32];
|
||||||
|
|
||||||
|
@ -689,7 +689,7 @@ CreateDisplayDriverList(
|
||||||
DPRINT("Display identifier: '%S'\n", DisplayIdentifier);
|
DPRINT("Display identifier: '%S'\n", DisplayIdentifier);
|
||||||
|
|
||||||
/* Search for matching device identifier */
|
/* Search for matching device identifier */
|
||||||
if (!SetupFindFirstLineW(InfFile, L"Map.Display", NULL, &Context))
|
if (!SpInfFindFirstLine(InfFile, L"Map.Display", NULL, &Context))
|
||||||
{
|
{
|
||||||
/* FIXME: error message */
|
/* FIXME: error message */
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -723,7 +723,7 @@ CreateDisplayDriverList(
|
||||||
DPRINT("Display key: %S\n", KeyName);
|
DPRINT("Display key: %S\n", KeyName);
|
||||||
RtlStringCchCopyW(DisplayKey, ARRAYSIZE(DisplayKey), KeyName);
|
RtlStringCchCopyW(DisplayKey, ARRAYSIZE(DisplayKey), KeyName);
|
||||||
INF_FreeData(KeyName);
|
INF_FreeData(KeyName);
|
||||||
} while (SetupFindNextLine(&Context, &Context));
|
} while (SpInfFindNextLine(&Context, &Context));
|
||||||
|
|
||||||
List = CreateGenericList();
|
List = CreateGenericList();
|
||||||
if (List == NULL)
|
if (List == NULL)
|
||||||
|
@ -778,8 +778,8 @@ ProcessDisplayRegistry(
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PGENERIC_LIST_ENTRY Entry;
|
PGENERIC_LIST_ENTRY Entry;
|
||||||
INFCONTEXT Context;
|
INFCONTEXT Context;
|
||||||
PWCHAR Buffer;
|
PCWSTR Buffer;
|
||||||
PWCHAR ServiceName;
|
PCWSTR ServiceName;
|
||||||
ULONG StartValue;
|
ULONG StartValue;
|
||||||
ULONG Width, Height, Bpp;
|
ULONG Width, Height, Bpp;
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
|
@ -793,11 +793,11 @@ ProcessDisplayRegistry(
|
||||||
if (Entry == NULL)
|
if (Entry == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!SetupFindFirstLineW(InfFile, L"Display",
|
if (!SpInfFindFirstLine(InfFile, L"Display",
|
||||||
((PGENENTRY)GetListEntryData(Entry))->Id,
|
((PGENENTRY)GetListEntryData(Entry))->Id,
|
||||||
&Context))
|
&Context))
|
||||||
{
|
{
|
||||||
DPRINT1("SetupFindFirstLineW() failed\n");
|
DPRINT1("SpInfFindFirstLine() failed\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1137,7 +1137,7 @@ CreateLanguageList(
|
||||||
{
|
{
|
||||||
PGENERIC_LIST List;
|
PGENERIC_LIST List;
|
||||||
INFCONTEXT Context;
|
INFCONTEXT Context;
|
||||||
PWCHAR KeyValue;
|
PCWSTR KeyValue;
|
||||||
|
|
||||||
LANG_ENTRY_PARAM LangEntryParam;
|
LANG_ENTRY_PARAM LangEntryParam;
|
||||||
|
|
||||||
|
@ -1145,7 +1145,7 @@ CreateLanguageList(
|
||||||
LangEntryParam.DefaultLanguage = DefaultLanguage;
|
LangEntryParam.DefaultLanguage = DefaultLanguage;
|
||||||
|
|
||||||
/* Get default language id */
|
/* Get default language id */
|
||||||
if (!SetupFindFirstLineW(InfFile, L"NLS", L"DefaultLanguage", &Context))
|
if (!SpInfFindFirstLine(InfFile, L"NLS", L"DefaultLanguage", &Context))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!INF_GetData(&Context, NULL, &KeyValue))
|
if (!INF_GetData(&Context, NULL, &KeyValue))
|
||||||
|
@ -1188,12 +1188,12 @@ CreateKeyboardLayoutList(
|
||||||
{
|
{
|
||||||
PGENERIC_LIST List;
|
PGENERIC_LIST List;
|
||||||
INFCONTEXT Context;
|
INFCONTEXT Context;
|
||||||
PWCHAR KeyValue;
|
PCWSTR KeyValue;
|
||||||
const MUI_LAYOUTS* LayoutsList;
|
const MUI_LAYOUTS* LayoutsList;
|
||||||
ULONG uIndex = 0;
|
ULONG uIndex = 0;
|
||||||
|
|
||||||
/* Get default layout id */
|
/* Get default layout id */
|
||||||
if (!SetupFindFirstLineW(InfFile, L"NLS", L"DefaultLayout", &Context))
|
if (!SpInfFindFirstLine(InfFile, L"NLS", L"DefaultLayout", &Context))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!INF_GetData(&Context, NULL, &KeyValue))
|
if (!INF_GetData(&Context, NULL, &KeyValue))
|
||||||
|
|
|
@ -32,7 +32,7 @@ CheckUnattendedSetup(
|
||||||
HINF UnattendInf;
|
HINF UnattendInf;
|
||||||
UINT ErrorLine;
|
UINT ErrorLine;
|
||||||
INT IntValue;
|
INT IntValue;
|
||||||
PWCHAR Value;
|
PCWSTR Value;
|
||||||
WCHAR UnattendInfPath[MAX_PATH];
|
WCHAR UnattendInfPath[MAX_PATH];
|
||||||
|
|
||||||
CombinePaths(UnattendInfPath, ARRAYSIZE(UnattendInfPath), 2,
|
CombinePaths(UnattendInfPath, ARRAYSIZE(UnattendInfPath), 2,
|
||||||
|
@ -47,22 +47,21 @@ CheckUnattendedSetup(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load 'unattend.inf' from installation media */
|
/* Load 'unattend.inf' from installation media */
|
||||||
UnattendInf = SetupOpenInfFileExW(UnattendInfPath,
|
UnattendInf = SpInfOpenInfFile(UnattendInfPath,
|
||||||
NULL,
|
NULL,
|
||||||
INF_STYLE_OLDNT,
|
INF_STYLE_OLDNT,
|
||||||
pSetupData->LanguageId,
|
pSetupData->LanguageId,
|
||||||
&ErrorLine);
|
&ErrorLine);
|
||||||
|
|
||||||
if (UnattendInf == INVALID_HANDLE_VALUE)
|
if (UnattendInf == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
DPRINT("SetupOpenInfFileExW() failed\n");
|
DPRINT("SpInfOpenInfFile() failed\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Open 'Unattend' section */
|
/* Open 'Unattend' section */
|
||||||
if (!SetupFindFirstLineW(UnattendInf, L"Unattend", L"Signature", &Context))
|
if (!SpInfFindFirstLine(UnattendInf, L"Unattend", L"Signature", &Context))
|
||||||
{
|
{
|
||||||
DPRINT("SetupFindFirstLineW() failed for section 'Unattend'\n");
|
DPRINT("SpInfFindFirstLine() failed for section 'Unattend'\n");
|
||||||
goto Quit;
|
goto Quit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +83,7 @@ CheckUnattendedSetup(
|
||||||
INF_FreeData(Value);
|
INF_FreeData(Value);
|
||||||
|
|
||||||
/* Check if Unattend setup is enabled */
|
/* Check if Unattend setup is enabled */
|
||||||
if (!SetupFindFirstLineW(UnattendInf, L"Unattend", L"UnattendSetupEnabled", &Context))
|
if (!SpInfFindFirstLine(UnattendInf, L"Unattend", L"UnattendSetupEnabled", &Context))
|
||||||
{
|
{
|
||||||
DPRINT("Can't find key 'UnattendSetupEnabled'\n");
|
DPRINT("Can't find key 'UnattendSetupEnabled'\n");
|
||||||
goto Quit;
|
goto Quit;
|
||||||
|
@ -106,37 +105,37 @@ CheckUnattendedSetup(
|
||||||
INF_FreeData(Value);
|
INF_FreeData(Value);
|
||||||
|
|
||||||
/* Search for 'DestinationDiskNumber' in the 'Unattend' section */
|
/* Search for 'DestinationDiskNumber' in the 'Unattend' section */
|
||||||
if (!SetupFindFirstLineW(UnattendInf, L"Unattend", L"DestinationDiskNumber", &Context))
|
if (!SpInfFindFirstLine(UnattendInf, L"Unattend", L"DestinationDiskNumber", &Context))
|
||||||
{
|
{
|
||||||
DPRINT("SetupFindFirstLine() failed for key 'DestinationDiskNumber'\n");
|
DPRINT("SpInfFindFirstLine() failed for key 'DestinationDiskNumber'\n");
|
||||||
goto Quit;
|
goto Quit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SetupGetIntField(&Context, 1, &IntValue))
|
if (!SpInfGetIntField(&Context, 1, &IntValue))
|
||||||
{
|
{
|
||||||
DPRINT("SetupGetIntField() failed for key 'DestinationDiskNumber'\n");
|
DPRINT("SpInfGetIntField() failed for key 'DestinationDiskNumber'\n");
|
||||||
goto Quit;
|
goto Quit;
|
||||||
}
|
}
|
||||||
|
|
||||||
pSetupData->DestinationDiskNumber = (LONG)IntValue;
|
pSetupData->DestinationDiskNumber = (LONG)IntValue;
|
||||||
|
|
||||||
/* Search for 'DestinationPartitionNumber' in the 'Unattend' section */
|
/* Search for 'DestinationPartitionNumber' in the 'Unattend' section */
|
||||||
if (!SetupFindFirstLineW(UnattendInf, L"Unattend", L"DestinationPartitionNumber", &Context))
|
if (!SpInfFindFirstLine(UnattendInf, L"Unattend", L"DestinationPartitionNumber", &Context))
|
||||||
{
|
{
|
||||||
DPRINT("SetupFindFirstLine() failed for key 'DestinationPartitionNumber'\n");
|
DPRINT("SpInfFindFirstLine() failed for key 'DestinationPartitionNumber'\n");
|
||||||
goto Quit;
|
goto Quit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SetupGetIntField(&Context, 1, &IntValue))
|
if (!SpInfGetIntField(&Context, 1, &IntValue))
|
||||||
{
|
{
|
||||||
DPRINT("SetupGetIntField() failed for key 'DestinationPartitionNumber'\n");
|
DPRINT("SpInfGetIntField() failed for key 'DestinationPartitionNumber'\n");
|
||||||
goto Quit;
|
goto Quit;
|
||||||
}
|
}
|
||||||
|
|
||||||
pSetupData->DestinationPartitionNumber = (LONG)IntValue;
|
pSetupData->DestinationPartitionNumber = (LONG)IntValue;
|
||||||
|
|
||||||
/* Search for 'InstallationDirectory' in the 'Unattend' section (optional) */
|
/* Search for 'InstallationDirectory' in the 'Unattend' section (optional) */
|
||||||
if (SetupFindFirstLineW(UnattendInf, L"Unattend", L"InstallationDirectory", &Context))
|
if (SpInfFindFirstLine(UnattendInf, L"Unattend", L"InstallationDirectory", &Context))
|
||||||
{
|
{
|
||||||
/* Get pointer 'InstallationDirectory' key */
|
/* Get pointer 'InstallationDirectory' key */
|
||||||
if (!INF_GetData(&Context, NULL, &Value))
|
if (!INF_GetData(&Context, NULL, &Value))
|
||||||
|
@ -157,9 +156,9 @@ CheckUnattendedSetup(
|
||||||
|
|
||||||
/* Search for 'MBRInstallType' in the 'Unattend' section */
|
/* Search for 'MBRInstallType' in the 'Unattend' section */
|
||||||
pSetupData->MBRInstallType = -1;
|
pSetupData->MBRInstallType = -1;
|
||||||
if (SetupFindFirstLineW(UnattendInf, L"Unattend", L"MBRInstallType", &Context))
|
if (SpInfFindFirstLine(UnattendInf, L"Unattend", L"MBRInstallType", &Context))
|
||||||
{
|
{
|
||||||
if (SetupGetIntField(&Context, 1, &IntValue))
|
if (SpInfGetIntField(&Context, 1, &IntValue))
|
||||||
{
|
{
|
||||||
pSetupData->MBRInstallType = IntValue;
|
pSetupData->MBRInstallType = IntValue;
|
||||||
}
|
}
|
||||||
|
@ -167,25 +166,25 @@ CheckUnattendedSetup(
|
||||||
|
|
||||||
/* Search for 'FormatPartition' in the 'Unattend' section */
|
/* Search for 'FormatPartition' in the 'Unattend' section */
|
||||||
pSetupData->FormatPartition = 0;
|
pSetupData->FormatPartition = 0;
|
||||||
if (SetupFindFirstLineW(UnattendInf, L"Unattend", L"FormatPartition", &Context))
|
if (SpInfFindFirstLine(UnattendInf, L"Unattend", L"FormatPartition", &Context))
|
||||||
{
|
{
|
||||||
if (SetupGetIntField(&Context, 1, &IntValue))
|
if (SpInfGetIntField(&Context, 1, &IntValue))
|
||||||
{
|
{
|
||||||
pSetupData->FormatPartition = IntValue;
|
pSetupData->FormatPartition = IntValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pSetupData->AutoPartition = 0;
|
pSetupData->AutoPartition = 0;
|
||||||
if (SetupFindFirstLineW(UnattendInf, L"Unattend", L"AutoPartition", &Context))
|
if (SpInfFindFirstLine(UnattendInf, L"Unattend", L"AutoPartition", &Context))
|
||||||
{
|
{
|
||||||
if (SetupGetIntField(&Context, 1, &IntValue))
|
if (SpInfGetIntField(&Context, 1, &IntValue))
|
||||||
{
|
{
|
||||||
pSetupData->AutoPartition = IntValue;
|
pSetupData->AutoPartition = IntValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search for LocaleID in the 'Unattend' section */
|
/* Search for LocaleID in the 'Unattend' section */
|
||||||
if (SetupFindFirstLineW(UnattendInf, L"Unattend", L"LocaleID", &Context))
|
if (SpInfFindFirstLine(UnattendInf, L"Unattend", L"LocaleID", &Context))
|
||||||
{
|
{
|
||||||
if (INF_GetData(&Context, NULL, &Value))
|
if (INF_GetData(&Context, NULL, &Value))
|
||||||
{
|
{
|
||||||
|
@ -198,7 +197,7 @@ CheckUnattendedSetup(
|
||||||
}
|
}
|
||||||
|
|
||||||
Quit:
|
Quit:
|
||||||
SetupCloseInfFile(UnattendInf);
|
SpInfCloseInfFile(UnattendInf);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
@ -505,7 +504,7 @@ LoadSetupInf(
|
||||||
INFCONTEXT Context;
|
INFCONTEXT Context;
|
||||||
UINT ErrorLine;
|
UINT ErrorLine;
|
||||||
INT IntValue;
|
INT IntValue;
|
||||||
PWCHAR Value;
|
PCWSTR Value;
|
||||||
WCHAR FileNameBuffer[MAX_PATH];
|
WCHAR FileNameBuffer[MAX_PATH];
|
||||||
|
|
||||||
CombinePaths(FileNameBuffer, ARRAYSIZE(FileNameBuffer), 2,
|
CombinePaths(FileNameBuffer, ARRAYSIZE(FileNameBuffer), 2,
|
||||||
|
@ -514,17 +513,16 @@ LoadSetupInf(
|
||||||
DPRINT("SetupInf path: '%S'\n", FileNameBuffer);
|
DPRINT("SetupInf path: '%S'\n", FileNameBuffer);
|
||||||
|
|
||||||
pSetupData->SetupInf =
|
pSetupData->SetupInf =
|
||||||
SetupOpenInfFileExW(FileNameBuffer,
|
SpInfOpenInfFile(FileNameBuffer,
|
||||||
NULL,
|
NULL,
|
||||||
/* INF_STYLE_WIN4 | */ INF_STYLE_OLDNT,
|
/* INF_STYLE_WIN4 | */ INF_STYLE_OLDNT,
|
||||||
pSetupData->LanguageId,
|
pSetupData->LanguageId,
|
||||||
&ErrorLine);
|
&ErrorLine);
|
||||||
|
|
||||||
if (pSetupData->SetupInf == INVALID_HANDLE_VALUE)
|
if (pSetupData->SetupInf == INVALID_HANDLE_VALUE)
|
||||||
return ERROR_LOAD_TXTSETUPSIF;
|
return ERROR_LOAD_TXTSETUPSIF;
|
||||||
|
|
||||||
/* Open 'Version' section */
|
/* Open 'Version' section */
|
||||||
if (!SetupFindFirstLineW(pSetupData->SetupInf, L"Version", L"Signature", &Context))
|
if (!SpInfFindFirstLine(pSetupData->SetupInf, L"Version", L"Signature", &Context))
|
||||||
return ERROR_CORRUPT_TXTSETUPSIF;
|
return ERROR_CORRUPT_TXTSETUPSIF;
|
||||||
|
|
||||||
/* Get pointer 'Signature' key */
|
/* Get pointer 'Signature' key */
|
||||||
|
@ -541,13 +539,13 @@ LoadSetupInf(
|
||||||
INF_FreeData(Value);
|
INF_FreeData(Value);
|
||||||
|
|
||||||
/* Open 'DiskSpaceRequirements' section */
|
/* Open 'DiskSpaceRequirements' section */
|
||||||
if (!SetupFindFirstLineW(pSetupData->SetupInf, L"DiskSpaceRequirements", L"FreeSysPartDiskSpace", &Context))
|
if (!SpInfFindFirstLine(pSetupData->SetupInf, L"DiskSpaceRequirements", L"FreeSysPartDiskSpace", &Context))
|
||||||
return ERROR_CORRUPT_TXTSETUPSIF;
|
return ERROR_CORRUPT_TXTSETUPSIF;
|
||||||
|
|
||||||
pSetupData->RequiredPartitionDiskSpace = ~0;
|
pSetupData->RequiredPartitionDiskSpace = ~0;
|
||||||
|
|
||||||
/* Get the 'FreeSysPartDiskSpace' value */
|
/* Get the 'FreeSysPartDiskSpace' value */
|
||||||
if (!SetupGetIntField(&Context, 1, &IntValue))
|
if (!SpInfGetIntField(&Context, 1, &IntValue))
|
||||||
return ERROR_CORRUPT_TXTSETUPSIF;
|
return ERROR_CORRUPT_TXTSETUPSIF;
|
||||||
|
|
||||||
pSetupData->RequiredPartitionDiskSpace = (ULONG)IntValue;
|
pSetupData->RequiredPartitionDiskSpace = (ULONG)IntValue;
|
||||||
|
@ -559,7 +557,7 @@ LoadSetupInf(
|
||||||
//
|
//
|
||||||
|
|
||||||
/* Update the Setup Source paths */
|
/* Update the Setup Source paths */
|
||||||
if (SetupFindFirstLineW(pSetupData->SetupInf, L"SetupData", L"SetupSourceDevice", &Context))
|
if (SpInfFindFirstLine(pSetupData->SetupInf, L"SetupData", L"SetupSourceDevice", &Context))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Get optional pointer 'SetupSourceDevice' key, its presence
|
* Get optional pointer 'SetupSourceDevice' key, its presence
|
||||||
|
@ -572,7 +570,7 @@ LoadSetupInf(
|
||||||
RtlCreateUnicodeString(&pSetupData->SourceRootPath, Value);
|
RtlCreateUnicodeString(&pSetupData->SourceRootPath, Value);
|
||||||
INF_FreeData(Value);
|
INF_FreeData(Value);
|
||||||
|
|
||||||
if (!SetupFindFirstLineW(pSetupData->SetupInf, L"SetupData", L"SetupSourcePath", &Context))
|
if (!SpInfFindFirstLine(pSetupData->SetupInf, L"SetupData", L"SetupSourcePath", &Context))
|
||||||
{
|
{
|
||||||
/* The 'SetupSourcePath' value is mandatory! */
|
/* The 'SetupSourcePath' value is mandatory! */
|
||||||
return ERROR_CORRUPT_TXTSETUPSIF;
|
return ERROR_CORRUPT_TXTSETUPSIF;
|
||||||
|
@ -594,7 +592,7 @@ LoadSetupInf(
|
||||||
|
|
||||||
/* Search for 'DefaultPath' in the 'SetupData' section */
|
/* Search for 'DefaultPath' in the 'SetupData' section */
|
||||||
pSetupData->InstallationDirectory[0] = 0;
|
pSetupData->InstallationDirectory[0] = 0;
|
||||||
if (SetupFindFirstLineW(pSetupData->SetupInf, L"SetupData", L"DefaultPath", &Context))
|
if (SpInfFindFirstLine(pSetupData->SetupInf, L"SetupData", L"DefaultPath", &Context))
|
||||||
{
|
{
|
||||||
/* Get pointer 'DefaultPath' key */
|
/* Get pointer 'DefaultPath' key */
|
||||||
if (!INF_GetData(&Context, NULL, &Value))
|
if (!INF_GetData(&Context, NULL, &Value))
|
||||||
|
@ -632,6 +630,10 @@ InitDestinationPaths(
|
||||||
RtlCreateUnicodeString(&pSetupData->DestinationRootPath, PathBuffer);
|
RtlCreateUnicodeString(&pSetupData->DestinationRootPath, PathBuffer);
|
||||||
DPRINT("DestinationRootPath: %wZ\n", &pSetupData->DestinationRootPath);
|
DPRINT("DestinationRootPath: %wZ\n", &pSetupData->DestinationRootPath);
|
||||||
|
|
||||||
|
// FIXME! Which variable to choose?
|
||||||
|
if (!InstallationDir)
|
||||||
|
InstallationDir = pSetupData->InstallationDirectory;
|
||||||
|
|
||||||
/** Equivalent of 'NTOS_INSTALLATION::SystemArcPath' **/
|
/** Equivalent of 'NTOS_INSTALLATION::SystemArcPath' **/
|
||||||
/* Create 'pSetupData->DestinationArcPath' */
|
/* Create 'pSetupData->DestinationArcPath' */
|
||||||
RtlFreeUnicodeString(&pSetupData->DestinationArcPath);
|
RtlFreeUnicodeString(&pSetupData->DestinationArcPath);
|
||||||
|
@ -776,7 +778,7 @@ FinishSetup(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Close the Setup INF */
|
/* Close the Setup INF */
|
||||||
SetupCloseInfFile(pSetupData->SetupInf);
|
SpInfCloseInfFile(pSetupData->SetupInf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -802,9 +804,9 @@ UpdateRegistry(
|
||||||
ERROR_NUMBER ErrorNumber;
|
ERROR_NUMBER ErrorNumber;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
INFCONTEXT InfContext;
|
INFCONTEXT InfContext;
|
||||||
PWSTR Action;
|
PCWSTR Action;
|
||||||
PWSTR File;
|
PCWSTR File;
|
||||||
PWSTR Section;
|
PCWSTR Section;
|
||||||
BOOLEAN Success;
|
BOOLEAN Success;
|
||||||
BOOLEAN ShouldRepairRegistry = FALSE;
|
BOOLEAN ShouldRepairRegistry = FALSE;
|
||||||
BOOLEAN Delete;
|
BOOLEAN Delete;
|
||||||
|
@ -858,13 +860,13 @@ DoUpdate:
|
||||||
* "repair" (aka. recreate: ShouldRepairRegistry == TRUE).
|
* "repair" (aka. recreate: ShouldRepairRegistry == TRUE).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Success = SetupFindFirstLineW(SetupInf, L"HiveInfs.Fresh", NULL, &InfContext); // Windows-compatible
|
Success = SpInfFindFirstLine(SetupInf, L"HiveInfs.Fresh", NULL, &InfContext); // Windows-compatible
|
||||||
if (!Success)
|
if (!Success)
|
||||||
Success = SetupFindFirstLineW(SetupInf, L"HiveInfs.Install", NULL, &InfContext); // ReactOS-specific
|
Success = SpInfFindFirstLine(SetupInf, L"HiveInfs.Install", NULL, &InfContext); // ReactOS-specific
|
||||||
|
|
||||||
if (!Success)
|
if (!Success)
|
||||||
{
|
{
|
||||||
DPRINT1("SetupFindFirstLine() failed\n");
|
DPRINT1("SpInfFindFirstLine() failed\n");
|
||||||
ErrorNumber = ERROR_FIND_REGISTRY;
|
ErrorNumber = ERROR_FIND_REGISTRY;
|
||||||
goto Cleanup;
|
goto Cleanup;
|
||||||
}
|
}
|
||||||
|
@ -877,7 +879,7 @@ DoUpdate:
|
||||||
* we only update the hives.
|
* we only update the hives.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Success = SetupFindFirstLineW(SetupInf, L"HiveInfs.Upgrade", NULL, &InfContext);
|
Success = SpInfFindFirstLine(SetupInf, L"HiveInfs.Upgrade", NULL, &InfContext);
|
||||||
if (!Success)
|
if (!Success)
|
||||||
{
|
{
|
||||||
/* Nothing to do for update! */
|
/* Nothing to do for update! */
|
||||||
|
@ -929,7 +931,7 @@ DoUpdate:
|
||||||
ErrorNumber = ERROR_IMPORT_HIVE;
|
ErrorNumber = ERROR_IMPORT_HIVE;
|
||||||
goto Cleanup;
|
goto Cleanup;
|
||||||
}
|
}
|
||||||
} while (SetupFindNextLine(&InfContext, &InfContext));
|
} while (SpInfFindNextLine(&InfContext, &InfContext));
|
||||||
|
|
||||||
if (!RepairUpdateFlag || ShouldRepairRegistry)
|
if (!RepairUpdateFlag || ShouldRepairRegistry)
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
extern HANDLE ProcessHeap;
|
extern HANDLE ProcessHeap;
|
||||||
|
|
||||||
#include "errorcode.h"
|
#include "errorcode.h"
|
||||||
|
#include "spapisup/fileqsup.h"
|
||||||
|
#include "spapisup/infsupp.h"
|
||||||
#include "utils/linklist.h"
|
#include "utils/linklist.h"
|
||||||
#include "utils/ntverrsrc.h"
|
#include "utils/ntverrsrc.h"
|
||||||
// #include "utils/arcname.h"
|
// #include "utils/arcname.h"
|
||||||
|
@ -33,7 +35,6 @@ extern HANDLE ProcessHeap;
|
||||||
#include "utils/filesup.h"
|
#include "utils/filesup.h"
|
||||||
#include "fsutil.h"
|
#include "fsutil.h"
|
||||||
#include "utils/genlist.h"
|
#include "utils/genlist.h"
|
||||||
#include "utils/infsupp.h"
|
|
||||||
#include "utils/inicache.h"
|
#include "utils/inicache.h"
|
||||||
#include "utils/partlist.h"
|
#include "utils/partlist.h"
|
||||||
#include "utils/arcname.h"
|
#include "utils/arcname.h"
|
||||||
|
|
34
base/setup/lib/spapisup/fileqsup.c
Normal file
34
base/setup/lib/spapisup/fileqsup.c
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
|
* PROJECT: ReactOS Setup Library
|
||||||
|
* FILE: base/setup/lib/fileqsup.c
|
||||||
|
* PURPOSE: Interfacing with Setup* API File Queue support functions
|
||||||
|
* PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* INCLUDES *****************************************************************/
|
||||||
|
|
||||||
|
#include "precomp.h"
|
||||||
|
#include "fileqsup.h"
|
||||||
|
|
||||||
|
#define NDEBUG
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These externs should be defined by the user of this library.
|
||||||
|
* They are kept there for reference and ease of usage.
|
||||||
|
*/
|
||||||
|
#if 0
|
||||||
|
|
||||||
|
pSpFileQueueOpen SpFileQueueOpen = NULL;
|
||||||
|
pSpFileQueueClose SpFileQueueClose = NULL;
|
||||||
|
pSpFileQueueCopy SpFileQueueCopy = NULL;
|
||||||
|
pSpFileQueueDelete SpFileQueueDelete = NULL;
|
||||||
|
pSpFileQueueRename SpFileQueueRename = NULL;
|
||||||
|
pSpFileQueueCommit SpFileQueueCommit = NULL;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* EOF */
|
|
@ -1,31 +1,24 @@
|
||||||
/*
|
|
||||||
* ReactOS kernel
|
|
||||||
* Copyright (C) 2002 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.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*/
|
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS text-mode setup
|
* PROJECT: ReactOS Setup Library
|
||||||
* FILE: base/setup/usetup/filequeue.h
|
* FILE: base/setup/lib/fileqsup.h
|
||||||
* PURPOSE: File queue functions
|
* PURPOSE: Interfacing with Setup* API File Queue support functions
|
||||||
* PROGRAMMER:
|
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
||||||
|
* Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "spapisup.h"
|
||||||
|
|
||||||
|
// FIXME: Temporary measure until all the users of this header
|
||||||
|
// (usetup...) use or define SetupAPI-conforming APIs.
|
||||||
|
#if defined(_SETUPAPI_H_) || defined(_INC_SETUPAPI)
|
||||||
|
|
||||||
|
#include <setupapi.h>
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
#define SPFILENOTIFY_STARTQUEUE 0x00000001
|
#define SPFILENOTIFY_STARTQUEUE 0x00000001
|
||||||
#define SPFILENOTIFY_ENDQUEUE 0x00000002
|
#define SPFILENOTIFY_ENDQUEUE 0x00000002
|
||||||
#define SPFILENOTIFY_STARTSUBQUEUE 0x00000003
|
#define SPFILENOTIFY_STARTSUBQUEUE 0x00000003
|
||||||
|
@ -76,67 +69,68 @@ typedef UINT (CALLBACK* PSP_FILE_CALLBACK_W)(
|
||||||
IN UINT_PTR Param1,
|
IN UINT_PTR Param1,
|
||||||
IN UINT_PTR Param2);
|
IN UINT_PTR Param2);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* FUNCTIONS ****************************************************************/
|
/* FUNCTIONS ****************************************************************/
|
||||||
|
|
||||||
HSPFILEQ
|
// #define SetupOpenFileQueue
|
||||||
WINAPI
|
typedef HSPFILEQ
|
||||||
SetupOpenFileQueue(VOID);
|
(WINAPI* pSpFileQueueOpen)(VOID);
|
||||||
|
|
||||||
VOID
|
extern pSpFileQueueOpen SpFileQueueOpen;
|
||||||
WINAPI
|
|
||||||
SetupCloseFileQueue(
|
// #define SetupCloseFileQueue
|
||||||
|
typedef BOOL
|
||||||
|
(WINAPI* pSpFileQueueClose)(
|
||||||
IN HSPFILEQ QueueHandle);
|
IN HSPFILEQ QueueHandle);
|
||||||
|
|
||||||
#if 0 // This is the API that is declared in setupapi.h and exported by setupapi.dll
|
extern pSpFileQueueClose SpFileQueueClose;
|
||||||
BOOL
|
|
||||||
WINAPI
|
|
||||||
SetupQueueCopyWNew(
|
|
||||||
IN HSPFILEQ QueueHandle,
|
|
||||||
IN PCWSTR SourceRootPath,
|
|
||||||
IN PCWSTR SourcePath,
|
|
||||||
IN PCWSTR SourceFileName,
|
|
||||||
IN PCWSTR SourceDescription,
|
|
||||||
IN PCWSTR SourceTagFile,
|
|
||||||
IN PCWSTR TargetDirectory,
|
|
||||||
IN PCWSTR TargetFileName,
|
|
||||||
IN DWORD CopyStyle);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* A simplified version of SetupQueueCopyW that wraps Cabinet support around */
|
// #define SetupQueueCopyW
|
||||||
BOOL
|
typedef BOOL
|
||||||
WINAPI
|
(WINAPI* pSpFileQueueCopy)(
|
||||||
SetupQueueCopyWithCab( // SetupQueueCopyW
|
|
||||||
IN HSPFILEQ QueueHandle,
|
IN HSPFILEQ QueueHandle,
|
||||||
IN PCWSTR SourceCabinet OPTIONAL,
|
|
||||||
IN PCWSTR SourceRootPath,
|
IN PCWSTR SourceRootPath,
|
||||||
IN PCWSTR SourcePath OPTIONAL,
|
IN PCWSTR SourcePath OPTIONAL,
|
||||||
IN PCWSTR SourceFileName,
|
IN PCWSTR SourceFileName,
|
||||||
|
IN PCWSTR SourceDescription OPTIONAL,
|
||||||
|
IN PCWSTR SourceCabinet OPTIONAL,
|
||||||
|
IN PCWSTR SourceTagFile OPTIONAL,
|
||||||
IN PCWSTR TargetDirectory,
|
IN PCWSTR TargetDirectory,
|
||||||
IN PCWSTR TargetFileName OPTIONAL);
|
IN PCWSTR TargetFileName OPTIONAL,
|
||||||
|
IN ULONG CopyStyle);
|
||||||
|
|
||||||
BOOL
|
extern pSpFileQueueCopy SpFileQueueCopy;
|
||||||
WINAPI
|
|
||||||
SetupQueueDeleteW(
|
// #define SetupQueueDeleteW
|
||||||
|
typedef BOOL
|
||||||
|
(WINAPI* pSpFileQueueDelete)(
|
||||||
IN HSPFILEQ QueueHandle,
|
IN HSPFILEQ QueueHandle,
|
||||||
IN PCWSTR PathPart1,
|
IN PCWSTR PathPart1,
|
||||||
IN PCWSTR PathPart2 OPTIONAL);
|
IN PCWSTR PathPart2 OPTIONAL);
|
||||||
|
|
||||||
BOOL
|
extern pSpFileQueueDelete SpFileQueueDelete;
|
||||||
WINAPI
|
|
||||||
SetupQueueRenameW(
|
// #define SetupQueueRenameW
|
||||||
|
typedef BOOL
|
||||||
|
(WINAPI* pSpFileQueueRename)(
|
||||||
IN HSPFILEQ QueueHandle,
|
IN HSPFILEQ QueueHandle,
|
||||||
IN PCWSTR SourcePath,
|
IN PCWSTR SourcePath,
|
||||||
IN PCWSTR SourceFileName OPTIONAL,
|
IN PCWSTR SourceFileName OPTIONAL,
|
||||||
IN PCWSTR TargetPath OPTIONAL,
|
IN PCWSTR TargetPath OPTIONAL,
|
||||||
IN PCWSTR TargetFileName);
|
IN PCWSTR TargetFileName);
|
||||||
|
|
||||||
BOOL
|
extern pSpFileQueueRename SpFileQueueRename;
|
||||||
WINAPI
|
|
||||||
SetupCommitFileQueueW(
|
// #define SetupCommitFileQueueW
|
||||||
|
typedef BOOL
|
||||||
|
(WINAPI* pSpFileQueueCommit)(
|
||||||
IN HWND Owner,
|
IN HWND Owner,
|
||||||
IN HSPFILEQ QueueHandle,
|
IN HSPFILEQ QueueHandle,
|
||||||
IN PSP_FILE_CALLBACK_W MsgHandler,
|
IN PSP_FILE_CALLBACK_W MsgHandler,
|
||||||
IN PVOID Context OPTIONAL);
|
IN PVOID Context OPTIONAL);
|
||||||
|
|
||||||
|
extern pSpFileQueueCommit SpFileQueueCommit;
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
|
@ -2,7 +2,7 @@
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS Setup Library
|
* PROJECT: ReactOS Setup Library
|
||||||
* FILE: base/setup/lib/infsupp.c
|
* FILE: base/setup/lib/infsupp.c
|
||||||
* PURPOSE: Interfacing with Setup* API .inf files support functions
|
* PURPOSE: Interfacing with Setup* API .INF Files support functions
|
||||||
* PROGRAMMERS: Hervé Poussineau
|
* PROGRAMMERS: Hervé Poussineau
|
||||||
* Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
* Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
||||||
*/
|
*/
|
||||||
|
@ -15,13 +15,34 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These externs should be defined by the user of this library.
|
||||||
|
* They are kept there for reference and ease of usage.
|
||||||
|
*/
|
||||||
|
#if 0
|
||||||
|
|
||||||
|
pSpInfCloseInfFile SpInfCloseInfFile = NULL;
|
||||||
|
pSpInfFindFirstLine SpInfFindFirstLine = NULL;
|
||||||
|
pSpInfFindNextLine SpInfFindNextLine = NULL;
|
||||||
|
pSpInfGetFieldCount SpInfGetFieldCount = NULL;
|
||||||
|
pSpInfGetBinaryField SpInfGetBinaryField = NULL;
|
||||||
|
pSpInfGetIntField SpInfGetIntField = NULL;
|
||||||
|
pSpInfGetMultiSzField SpInfGetMultiSzField = NULL;
|
||||||
|
pSpInfGetStringField SpInfGetStringField = NULL;
|
||||||
|
pSpInfGetField SpInfGetField = NULL;
|
||||||
|
pSpInfOpenInfFile SpInfOpenInfFile = NULL;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/* HELPER FUNCTIONS **********************************************************/
|
/* HELPER FUNCTIONS **********************************************************/
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
INF_GetDataField(
|
INF_GetDataField(
|
||||||
IN PINFCONTEXT Context,
|
IN PINFCONTEXT Context,
|
||||||
IN ULONG FieldIndex,
|
IN ULONG FieldIndex,
|
||||||
OUT PWCHAR *Data)
|
OUT PCWSTR* Data)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
|
@ -31,11 +52,11 @@ INF_GetDataField(
|
||||||
|
|
||||||
*Data = NULL;
|
*Data = NULL;
|
||||||
|
|
||||||
Success = SetupGetStringFieldW(Context,
|
Success = SpInfGetStringField(Context,
|
||||||
FieldIndex,
|
FieldIndex,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
&dwSize);
|
&dwSize);
|
||||||
if (!Success)
|
if (!Success)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -43,11 +64,11 @@ INF_GetDataField(
|
||||||
if (!InfData)
|
if (!InfData)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
Success = SetupGetStringFieldW(Context,
|
Success = SpInfGetStringField(Context,
|
||||||
FieldIndex,
|
FieldIndex,
|
||||||
InfData,
|
InfData,
|
||||||
dwSize,
|
dwSize,
|
||||||
NULL);
|
NULL);
|
||||||
if (!Success)
|
if (!Success)
|
||||||
{
|
{
|
||||||
RtlFreeHeap(ProcessHeap, 0, InfData);
|
RtlFreeHeap(ProcessHeap, 0, InfData);
|
||||||
|
@ -59,7 +80,7 @@ INF_GetDataField(
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
*Data = (PWCHAR)pSetupGetField(Context, FieldIndex);
|
*Data = SpInfGetField(Context, FieldIndex);
|
||||||
return !!*Data;
|
return !!*Data;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -68,11 +89,11 @@ INF_GetDataField(
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
INF_GetData(
|
INF_GetData(
|
||||||
IN PINFCONTEXT Context,
|
IN PINFCONTEXT Context,
|
||||||
OUT PWCHAR *Key,
|
OUT PCWSTR* Key,
|
||||||
OUT PWCHAR *Data)
|
OUT PCWSTR* Data)
|
||||||
{
|
{
|
||||||
BOOL Success;
|
BOOL Success;
|
||||||
PWCHAR InfData[2] = {NULL, NULL};
|
PCWSTR InfData[2] = {NULL, NULL};
|
||||||
|
|
||||||
if (Key)
|
if (Key)
|
||||||
*Key = NULL;
|
*Key = NULL;
|
||||||
|
@ -82,11 +103,11 @@ INF_GetData(
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Verify that the INF file has only one value field, in addition to its key name.
|
* Verify that the INF file has only one value field, in addition to its key name.
|
||||||
* Note that SetupGetFieldCount() does not count the key name as a field.
|
* Note that SpInfGetFieldCount() does not count the key name as a field.
|
||||||
*/
|
*/
|
||||||
if (SetupGetFieldCount(Context) != 1)
|
if (SpInfGetFieldCount(Context) != 1)
|
||||||
{
|
{
|
||||||
DPRINT1("SetupGetFieldCount != 1\n");
|
DPRINT1("SpInfGetFieldCount != 1\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS Setup Library
|
* PROJECT: ReactOS Setup Library
|
||||||
* FILE: base/setup/lib/infsupp.h
|
* FILE: base/setup/lib/infsupp.h
|
||||||
* PURPOSE: Interfacing with Setup* API .inf files support functions
|
* PURPOSE: Interfacing with Setup* API .INF Files support functions
|
||||||
* PROGRAMMER: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
* PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/* Make setupapi.h to not define the API as exports to the DLL */
|
#include "spapisup.h"
|
||||||
#ifdef __REACTOS__
|
|
||||||
#define _SETUPAPI_
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// FIXME: Temporary measure until all the users of this header
|
// FIXME: Temporary measure until all the users of this header
|
||||||
// (usetup...) use or define SetupAPI-conforming APIs.
|
// (usetup...) use or define SetupAPI-conforming APIs.
|
||||||
|
@ -30,65 +27,6 @@ typedef struct _INFCONTEXT
|
||||||
UINT Line;
|
UINT Line;
|
||||||
} INFCONTEXT, *PINFCONTEXT;
|
} INFCONTEXT, *PINFCONTEXT;
|
||||||
|
|
||||||
// #define SetupCloseInfFile InfCloseFile
|
|
||||||
VOID
|
|
||||||
WINAPI
|
|
||||||
SetupCloseInfFile(HINF InfHandle);
|
|
||||||
|
|
||||||
// #define SetupFindFirstLineW InfpFindFirstLineW
|
|
||||||
BOOL
|
|
||||||
WINAPI
|
|
||||||
SetupFindFirstLineW(
|
|
||||||
IN HINF InfHandle,
|
|
||||||
IN PCWSTR Section,
|
|
||||||
IN PCWSTR Key,
|
|
||||||
IN OUT PINFCONTEXT Context);
|
|
||||||
|
|
||||||
// #define SetupFindNextLine InfFindNextLine
|
|
||||||
BOOL
|
|
||||||
WINAPI
|
|
||||||
SetupFindNextLine(PINFCONTEXT ContextIn,
|
|
||||||
PINFCONTEXT ContextOut);
|
|
||||||
|
|
||||||
// #define SetupGetFieldCount InfGetFieldCount
|
|
||||||
LONG
|
|
||||||
WINAPI
|
|
||||||
SetupGetFieldCount(PINFCONTEXT Context);
|
|
||||||
|
|
||||||
// #define SetupGetBinaryField InfGetBinaryField
|
|
||||||
BOOL
|
|
||||||
WINAPI
|
|
||||||
SetupGetBinaryField(PINFCONTEXT Context,
|
|
||||||
ULONG FieldIndex,
|
|
||||||
PUCHAR ReturnBuffer,
|
|
||||||
ULONG ReturnBufferSize,
|
|
||||||
PULONG RequiredSize);
|
|
||||||
|
|
||||||
// #define SetupGetIntField InfGetIntField
|
|
||||||
BOOL
|
|
||||||
WINAPI
|
|
||||||
SetupGetIntField(PINFCONTEXT Context,
|
|
||||||
ULONG FieldIndex,
|
|
||||||
INT *IntegerValue); // PINT
|
|
||||||
|
|
||||||
// #define SetupGetMultiSzFieldW InfGetMultiSzField
|
|
||||||
BOOL
|
|
||||||
WINAPI
|
|
||||||
SetupGetMultiSzFieldW(PINFCONTEXT Context,
|
|
||||||
ULONG FieldIndex,
|
|
||||||
PWSTR ReturnBuffer,
|
|
||||||
ULONG ReturnBufferSize,
|
|
||||||
PULONG RequiredSize);
|
|
||||||
|
|
||||||
// #define SetupGetStringFieldW InfGetStringField
|
|
||||||
BOOL
|
|
||||||
WINAPI
|
|
||||||
SetupGetStringFieldW(PINFCONTEXT Context,
|
|
||||||
ULONG FieldIndex,
|
|
||||||
PWSTR ReturnBuffer,
|
|
||||||
ULONG ReturnBufferSize,
|
|
||||||
PULONG RequiredSize);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Lower the MAX_INF_STRING_LENGTH value in order to avoid too much stack usage */
|
/* Lower the MAX_INF_STRING_LENGTH value in order to avoid too much stack usage */
|
||||||
|
@ -117,33 +55,107 @@ typedef struct _INFCONTEXT
|
||||||
C_ASSERT(sizeof(INFCONTEXT) == 2 * sizeof(HINF) + 2 * sizeof(UINT));
|
C_ASSERT(sizeof(INFCONTEXT) == 2 * sizeof(HINF) + 2 * sizeof(UINT));
|
||||||
|
|
||||||
|
|
||||||
/*
|
// #define SetupCloseInfFile InfCloseFile
|
||||||
* This function corresponds to an undocumented but exported SetupAPI function
|
typedef VOID
|
||||||
* that exists since WinNT4 and is still present in Win10.
|
(WINAPI* pSpInfCloseInfFile)(
|
||||||
* The returned string pointer is a read-only pointer to a string in the
|
IN HINF InfHandle);
|
||||||
* maintained INF cache, and is always in UNICODE (on NT systems).
|
|
||||||
*/
|
extern pSpInfCloseInfFile SpInfCloseInfFile;
|
||||||
PCWSTR
|
|
||||||
WINAPI
|
// #define SetupFindFirstLineW InfpFindFirstLineW
|
||||||
pSetupGetField(PINFCONTEXT Context,
|
typedef BOOL
|
||||||
ULONG FieldIndex);
|
(WINAPI* pSpInfFindFirstLine)(
|
||||||
|
IN HINF InfHandle,
|
||||||
|
IN PCWSTR Section,
|
||||||
|
IN PCWSTR Key,
|
||||||
|
IN OUT PINFCONTEXT Context);
|
||||||
|
|
||||||
|
extern pSpInfFindFirstLine SpInfFindFirstLine;
|
||||||
|
|
||||||
|
// #define SetupFindNextLine InfFindNextLine
|
||||||
|
typedef BOOL
|
||||||
|
(WINAPI* pSpInfFindNextLine)(
|
||||||
|
IN PINFCONTEXT ContextIn,
|
||||||
|
OUT PINFCONTEXT ContextOut);
|
||||||
|
|
||||||
|
extern pSpInfFindNextLine SpInfFindNextLine;
|
||||||
|
|
||||||
|
// #define SetupGetFieldCount InfGetFieldCount
|
||||||
|
typedef ULONG
|
||||||
|
(WINAPI* pSpInfGetFieldCount)(
|
||||||
|
IN PINFCONTEXT Context);
|
||||||
|
|
||||||
|
extern pSpInfGetFieldCount SpInfGetFieldCount;
|
||||||
|
|
||||||
|
// #define SetupGetBinaryField InfGetBinaryField
|
||||||
|
typedef BOOL
|
||||||
|
(WINAPI* pSpInfGetBinaryField)(
|
||||||
|
IN PINFCONTEXT Context,
|
||||||
|
IN ULONG FieldIndex,
|
||||||
|
OUT PUCHAR ReturnBuffer,
|
||||||
|
IN ULONG ReturnBufferSize,
|
||||||
|
OUT PULONG RequiredSize);
|
||||||
|
|
||||||
|
extern pSpInfGetBinaryField SpInfGetBinaryField;
|
||||||
|
|
||||||
|
// #define SetupGetIntField InfGetIntField
|
||||||
|
typedef BOOL
|
||||||
|
(WINAPI* pSpInfGetIntField)(
|
||||||
|
IN PINFCONTEXT Context,
|
||||||
|
IN ULONG FieldIndex,
|
||||||
|
OUT INT *IntegerValue); // PINT
|
||||||
|
|
||||||
|
extern pSpInfGetIntField SpInfGetIntField;
|
||||||
|
|
||||||
|
// #define SetupGetMultiSzFieldW InfGetMultiSzField
|
||||||
|
typedef BOOL
|
||||||
|
(WINAPI* pSpInfGetMultiSzField)(
|
||||||
|
IN PINFCONTEXT Context,
|
||||||
|
IN ULONG FieldIndex,
|
||||||
|
OUT PWSTR ReturnBuffer,
|
||||||
|
IN ULONG ReturnBufferSize,
|
||||||
|
OUT PULONG RequiredSize);
|
||||||
|
|
||||||
|
extern pSpInfGetMultiSzField SpInfGetMultiSzField;
|
||||||
|
|
||||||
|
// #define SetupGetStringFieldW InfGetStringField
|
||||||
|
typedef BOOL
|
||||||
|
(WINAPI* pSpInfGetStringField)(
|
||||||
|
IN PINFCONTEXT Context,
|
||||||
|
IN ULONG FieldIndex,
|
||||||
|
OUT PWSTR ReturnBuffer,
|
||||||
|
IN ULONG ReturnBufferSize,
|
||||||
|
OUT PULONG RequiredSize);
|
||||||
|
|
||||||
|
extern pSpInfGetStringField SpInfGetStringField;
|
||||||
|
|
||||||
|
// #define pSetupGetField
|
||||||
|
typedef PCWSTR
|
||||||
|
(WINAPI* pSpInfGetField)(
|
||||||
|
IN PINFCONTEXT Context,
|
||||||
|
IN ULONG FieldIndex);
|
||||||
|
|
||||||
|
extern pSpInfGetField SpInfGetField;
|
||||||
|
|
||||||
/* A version of SetupOpenInfFileW with support for a user-provided LCID */
|
/* A version of SetupOpenInfFileW with support for a user-provided LCID */
|
||||||
// #define SetupOpenInfFileExW InfpOpenInfFileW
|
// #define SetupOpenInfFileExW InfpOpenInfFileW
|
||||||
HINF
|
typedef HINF
|
||||||
WINAPI
|
(WINAPI* pSpInfOpenInfFile)(
|
||||||
SetupOpenInfFileExW(
|
|
||||||
IN PCWSTR FileName,
|
IN PCWSTR FileName,
|
||||||
IN PCWSTR InfClass,
|
IN PCWSTR InfClass,
|
||||||
IN DWORD InfStyle,
|
IN DWORD InfStyle,
|
||||||
IN LCID LocaleId,
|
IN LCID LocaleId,
|
||||||
OUT PUINT ErrorLine);
|
OUT PUINT ErrorLine);
|
||||||
|
|
||||||
|
extern pSpInfOpenInfFile SpInfOpenInfFile;
|
||||||
|
|
||||||
|
|
||||||
/* HELPER FUNCTIONS **********************************************************/
|
/* HELPER FUNCTIONS **********************************************************/
|
||||||
|
|
||||||
FORCEINLINE VOID
|
FORCEINLINE
|
||||||
INF_FreeData(IN PWCHAR InfData)
|
VOID
|
||||||
|
INF_FreeData(
|
||||||
|
IN PCWSTR InfData)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
if (InfData)
|
if (InfData)
|
||||||
|
@ -157,12 +169,12 @@ BOOLEAN
|
||||||
INF_GetDataField(
|
INF_GetDataField(
|
||||||
IN PINFCONTEXT Context,
|
IN PINFCONTEXT Context,
|
||||||
IN ULONG FieldIndex,
|
IN ULONG FieldIndex,
|
||||||
OUT PWCHAR *Data);
|
OUT PCWSTR* Data);
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
INF_GetData(
|
INF_GetData(
|
||||||
IN PINFCONTEXT Context,
|
IN PINFCONTEXT Context,
|
||||||
OUT PWCHAR *Key,
|
OUT PCWSTR* Key,
|
||||||
OUT PWCHAR *Data);
|
OUT PCWSTR* Data);
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
29
base/setup/lib/spapisup/spapisup.h
Normal file
29
base/setup/lib/spapisup/spapisup.h
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
|
* PROJECT: ReactOS Setup Library
|
||||||
|
* FILE: base/setup/lib/spapisup.h
|
||||||
|
* PURPOSE: Interfacing with Setup* API support functions
|
||||||
|
* PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
/* Make setupapi.h to not define the API as exports to the DLL */
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
#define _SETUPAPI_
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Architecture names to be used for architecture-specific INF sections */
|
||||||
|
#ifdef _M_IX86
|
||||||
|
#define INF_ARCH L"x86"
|
||||||
|
#elif defined(_M_AMD64)
|
||||||
|
#define INF_ARCH L"amd64"
|
||||||
|
#elif defined(_M_IA64)
|
||||||
|
#define INF_ARCH L"ia64"
|
||||||
|
#elif defined(_M_ARM)
|
||||||
|
#define INF_ARCH L"arm"
|
||||||
|
#elif defined(_M_PPC)
|
||||||
|
#define INF_ARCH L"ppc"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* EOF */
|
|
@ -7,8 +7,9 @@ include_directories(
|
||||||
${REACTOS_SOURCE_DIR}/sdk/include/reactos/drivers)
|
${REACTOS_SOURCE_DIR}/sdk/include/reactos/drivers)
|
||||||
|
|
||||||
list(APPEND SOURCE
|
list(APPEND SOURCE
|
||||||
|
spapisup/fileqsup.c
|
||||||
|
spapisup/infsupp.c
|
||||||
drivepage.c
|
drivepage.c
|
||||||
inffile.c
|
|
||||||
reactos.c
|
reactos.c
|
||||||
reactos.h)
|
reactos.h)
|
||||||
|
|
||||||
|
|
155
base/setup/reactos/spapisup/fileqsup.c
Normal file
155
base/setup/reactos/spapisup/fileqsup.c
Normal file
|
@ -0,0 +1,155 @@
|
||||||
|
/*
|
||||||
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
|
* PROJECT: ReactOS GUI first stage setup application
|
||||||
|
* FILE: base/setup/lib/fileqsup.c
|
||||||
|
* PURPOSE: Interfacing with Setup* API File Queue support functions
|
||||||
|
* PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* INCLUDES *****************************************************************/
|
||||||
|
|
||||||
|
#include "precomp.h"
|
||||||
|
|
||||||
|
#define NDEBUG
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
/* SETUP* API COMPATIBILITY FUNCTIONS ****************************************/
|
||||||
|
|
||||||
|
/* A simplified version of SetupQueueCopyW that wraps Cabinet support around */
|
||||||
|
BOOL
|
||||||
|
WINAPI
|
||||||
|
SpFileQueueCopy_NtToWin32(
|
||||||
|
IN HSPFILEQ QueueHandle,
|
||||||
|
IN PCWSTR SourceRootPath,
|
||||||
|
IN PCWSTR SourcePath OPTIONAL,
|
||||||
|
IN PCWSTR SourceFileName,
|
||||||
|
IN PCWSTR SourceDescription OPTIONAL,
|
||||||
|
IN PCWSTR SourceCabinet OPTIONAL,
|
||||||
|
IN PCWSTR SourceTagFile OPTIONAL,
|
||||||
|
IN PCWSTR TargetDirectory,
|
||||||
|
IN PCWSTR TargetFileName OPTIONAL,
|
||||||
|
IN ULONG CopyStyle)
|
||||||
|
{
|
||||||
|
WCHAR Win32SourceRootPath[MAX_PATH];
|
||||||
|
WCHAR Win32TargetDirectory[MAX_PATH];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SpFileQueueCopy is called within setuplib with NT paths, however
|
||||||
|
* the Win32 SetupQueueCopyW API only takes Win32 paths. We therefore
|
||||||
|
* map the NT path to Win32 path and then call the Win32 API.
|
||||||
|
*/
|
||||||
|
if (!ConvertNtPathToWin32Path(Win32SourceRootPath,
|
||||||
|
_countof(Win32SourceRootPath),
|
||||||
|
SourceRootPath))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
/* SourcePath, SourceFileName and SourceCabinet are appended to SourceRootPath by the SetupApi function */
|
||||||
|
|
||||||
|
if (!ConvertNtPathToWin32Path(Win32TargetDirectory,
|
||||||
|
_countof(Win32TargetDirectory),
|
||||||
|
TargetDirectory))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
/* TargetFileName is appended to TargetDirectory by the SetupApi function */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Use the undocumented way of copying files from within a given cabinet file
|
||||||
|
* *ONLY IF* the files do not already exist in the same directory where
|
||||||
|
* the cabinet file resides!!
|
||||||
|
*/
|
||||||
|
return SetupQueueCopyW(QueueHandle,
|
||||||
|
Win32SourceRootPath,
|
||||||
|
SourcePath,
|
||||||
|
SourceFileName,
|
||||||
|
// Undocumented on MSDN is the fact that this parameter is mandatory *IF* one wants to take the TagFile into account!
|
||||||
|
L"foobar",
|
||||||
|
// SourceTagFile -- Special behaviour: use cabinet file present in ArchiveDir path! The API does not check for a ".cab" extension.
|
||||||
|
SourceCabinet,
|
||||||
|
Win32TargetDirectory,
|
||||||
|
TargetFileName,
|
||||||
|
// We choose to decompress the archive, so do NOT specify SP_COPY_NODECOMP !
|
||||||
|
SP_COPY_NOOVERWRITE /* | SP_COPY_SOURCE_ABSOLUTE | SP_COPY_SOURCEPATH_ABSOLUTE */
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
WINAPI
|
||||||
|
SpFileQueueDelete_NtToWin32(
|
||||||
|
IN HSPFILEQ QueueHandle,
|
||||||
|
IN PCWSTR PathPart1,
|
||||||
|
IN PCWSTR PathPart2 OPTIONAL)
|
||||||
|
{
|
||||||
|
WCHAR Win32PathPart1[MAX_PATH];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SpFileQueueDelete is called within setuplib with NT paths, however
|
||||||
|
* the Win32 SetupQueueDeleteW API only takes Win32 paths. We therefore
|
||||||
|
* map the NT path to Win32 path and then call the Win32 API.
|
||||||
|
*/
|
||||||
|
if (!ConvertNtPathToWin32Path(Win32PathPart1,
|
||||||
|
_countof(Win32PathPart1),
|
||||||
|
PathPart1))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
/* PathPart2 is appended to PathPart1 by the SetupApi function */
|
||||||
|
|
||||||
|
return SetupQueueDeleteW(QueueHandle, Win32PathPart1, PathPart2);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
WINAPI
|
||||||
|
SpFileQueueRename_NtToWin32(
|
||||||
|
IN HSPFILEQ QueueHandle,
|
||||||
|
IN PCWSTR SourcePath,
|
||||||
|
IN PCWSTR SourceFileName OPTIONAL,
|
||||||
|
IN PCWSTR TargetPath OPTIONAL,
|
||||||
|
IN PCWSTR TargetFileName)
|
||||||
|
{
|
||||||
|
WCHAR Win32SourcePath[MAX_PATH];
|
||||||
|
WCHAR Win32TargetPath[MAX_PATH];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SpFileQueueRename is called within setuplib with NT paths, however
|
||||||
|
* the Win32 SetupQueueRenameW API only takes Win32 paths. We therefore
|
||||||
|
* map the NT path to Win32 path and then call the Win32 API.
|
||||||
|
*/
|
||||||
|
if (!ConvertNtPathToWin32Path(Win32SourcePath,
|
||||||
|
_countof(Win32SourcePath),
|
||||||
|
SourcePath))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
/* SourceFileName is appended to SourcePath by the SetupApi function */
|
||||||
|
|
||||||
|
if (TargetPath)
|
||||||
|
{
|
||||||
|
if (!ConvertNtPathToWin32Path(Win32TargetPath,
|
||||||
|
_countof(Win32TargetPath),
|
||||||
|
TargetPath))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* TargetFileName is appended to TargetPath by the SetupApi function */
|
||||||
|
|
||||||
|
return SetupQueueRenameW(QueueHandle,
|
||||||
|
Win32SourcePath,
|
||||||
|
SourceFileName,
|
||||||
|
TargetPath ? Win32TargetPath : NULL,
|
||||||
|
TargetFileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
|
pSpFileQueueOpen SpFileQueueOpen = SetupOpenFileQueue;
|
||||||
|
pSpFileQueueClose SpFileQueueClose = SetupCloseFileQueue;
|
||||||
|
pSpFileQueueCopy SpFileQueueCopy = SpFileQueueCopy_NtToWin32;
|
||||||
|
pSpFileQueueDelete SpFileQueueDelete = SpFileQueueDelete_NtToWin32;
|
||||||
|
pSpFileQueueRename SpFileQueueRename = SpFileQueueRename_NtToWin32;
|
||||||
|
pSpFileQueueCommit SpFileQueueCommit = SetupCommitFileQueueW;
|
||||||
|
|
||||||
|
/* EOF */
|
|
@ -1,9 +1,9 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS text-mode setup
|
* PROJECT: ReactOS GUI first stage setup application
|
||||||
* FILE: base/setup/usetup/inffile.c
|
* FILE: base/setup/lib/infsupp.c
|
||||||
* PURPOSE: .inf files support functions
|
* PURPOSE: Interfacing with Setup* API .INF Files support functions
|
||||||
* PROGRAMMERS: Hervé Poussineau
|
* PROGRAMMERS: Hervé Poussineau
|
||||||
* Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
* Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -16,7 +16,17 @@
|
||||||
|
|
||||||
/* SETUP* API COMPATIBILITY FUNCTIONS ****************************************/
|
/* SETUP* API COMPATIBILITY FUNCTIONS ****************************************/
|
||||||
|
|
||||||
/* Functions from the INFLIB library */
|
/*
|
||||||
|
* This function corresponds to an undocumented but exported SetupAPI function
|
||||||
|
* that exists since WinNT4 and is still present in Win10.
|
||||||
|
* The returned string pointer is a read-only pointer to a string in the
|
||||||
|
* maintained INF cache, and is always in UNICODE (on NT systems).
|
||||||
|
*/
|
||||||
|
PCWSTR
|
||||||
|
WINAPI
|
||||||
|
pSetupGetField(
|
||||||
|
IN PINFCONTEXT Context,
|
||||||
|
IN ULONG FieldIndex);
|
||||||
|
|
||||||
/* SetupOpenInfFileW with support for a user-provided LCID */
|
/* SetupOpenInfFileW with support for a user-provided LCID */
|
||||||
HINF
|
HINF
|
||||||
|
@ -51,6 +61,20 @@ SetupOpenInfFileExW(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
|
pSpInfCloseInfFile SpInfCloseInfFile = SetupCloseInfFile;
|
||||||
|
pSpInfFindFirstLine SpInfFindFirstLine = SetupFindFirstLineW;
|
||||||
|
pSpInfFindNextLine SpInfFindNextLine = SetupFindNextLine;
|
||||||
|
pSpInfGetFieldCount SpInfGetFieldCount = SetupGetFieldCount;
|
||||||
|
pSpInfGetBinaryField SpInfGetBinaryField = SetupGetBinaryField;
|
||||||
|
pSpInfGetIntField SpInfGetIntField = SetupGetIntField;
|
||||||
|
pSpInfGetMultiSzField SpInfGetMultiSzField = SetupGetMultiSzFieldW;
|
||||||
|
pSpInfGetStringField SpInfGetStringField = SetupGetStringFieldW;
|
||||||
|
pSpInfGetField SpInfGetField = pSetupGetField;
|
||||||
|
pSpInfOpenInfFile SpInfOpenInfFile = SetupOpenInfFileExW;
|
||||||
|
|
||||||
|
|
||||||
/* HELPER FUNCTIONS **********************************************************/
|
/* HELPER FUNCTIONS **********************************************************/
|
||||||
|
|
||||||
#if 0
|
#if 0
|
|
@ -10,17 +10,17 @@ include_directories(
|
||||||
${REACTOS_SOURCE_DIR}/sdk/include/reactos/drivers)
|
${REACTOS_SOURCE_DIR}/sdk/include/reactos/drivers)
|
||||||
|
|
||||||
list(APPEND SOURCE
|
list(APPEND SOURCE
|
||||||
cabinet.c
|
spapisup/cabinet.c
|
||||||
|
spapisup/fileqsup.c
|
||||||
|
spapisup/infsupp.c
|
||||||
chkdsk.c
|
chkdsk.c
|
||||||
cmdcons.c
|
cmdcons.c
|
||||||
console.c
|
console.c
|
||||||
consup.c
|
consup.c
|
||||||
devinst.c
|
devinst.c
|
||||||
filequeue.c
|
|
||||||
format.c
|
format.c
|
||||||
fslist.c
|
fslist.c
|
||||||
genlist.c
|
genlist.c
|
||||||
inffile.c
|
|
||||||
keytrans.c
|
keytrans.c
|
||||||
mui.c
|
mui.c
|
||||||
partlist.c
|
partlist.c
|
||||||
|
|
|
@ -53,14 +53,15 @@ InstallDriver(
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
HANDLE hService;
|
HANDLE hService;
|
||||||
INFCONTEXT Context;
|
INFCONTEXT Context;
|
||||||
PWSTR Driver, ClassGuid, ImagePath, FullImagePath;
|
PCWSTR Driver, ClassGuid, ImagePath;
|
||||||
|
PWSTR FullImagePath;
|
||||||
ULONG dwValue;
|
ULONG dwValue;
|
||||||
ULONG Disposition;
|
ULONG Disposition;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
BOOLEAN deviceInstalled = FALSE;
|
BOOLEAN deviceInstalled = FALSE;
|
||||||
|
|
||||||
/* Check if we know the hardware */
|
/* Check if we know the hardware */
|
||||||
if (!SetupFindFirstLineW(hInf, L"HardwareIdsDatabase", HardwareId, &Context))
|
if (!SpInfFindFirstLine(hInf, L"HardwareIdsDatabase", HardwareId, &Context))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!INF_GetDataField(&Context, 1, &Driver))
|
if (!INF_GetDataField(&Context, 1, &Driver))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -71,11 +72,11 @@ InstallDriver(
|
||||||
|
|
||||||
/* Find associated driver name */
|
/* Find associated driver name */
|
||||||
/* FIXME: check in other sections too! */
|
/* FIXME: check in other sections too! */
|
||||||
if (!SetupFindFirstLineW(hInf, L"BootBusExtenders.Load", Driver, &Context)
|
if (!SpInfFindFirstLine(hInf, L"BootBusExtenders.Load", Driver, &Context)
|
||||||
&& !SetupFindFirstLineW(hInf, L"BusExtenders.Load", Driver, &Context)
|
&& !SpInfFindFirstLine(hInf, L"BusExtenders.Load", Driver, &Context)
|
||||||
&& !SetupFindFirstLineW(hInf, L"SCSI.Load", Driver, &Context)
|
&& !SpInfFindFirstLine(hInf, L"SCSI.Load", Driver, &Context)
|
||||||
&& !SetupFindFirstLineW(hInf, L"InputDevicesSupport.Load", Driver, &Context)
|
&& !SpInfFindFirstLine(hInf, L"InputDevicesSupport.Load", Driver, &Context)
|
||||||
&& !SetupFindFirstLineW(hInf, L"Keyboard.Load", Driver, &Context))
|
&& !SpInfFindFirstLine(hInf, L"Keyboard.Load", Driver, &Context))
|
||||||
{
|
{
|
||||||
INF_FreeData(ClassGuid);
|
INF_FreeData(ClassGuid);
|
||||||
INF_FreeData(Driver);
|
INF_FreeData(Driver);
|
||||||
|
@ -151,7 +152,7 @@ InstallDriver(
|
||||||
&ImagePathU,
|
&ImagePathU,
|
||||||
0,
|
0,
|
||||||
REG_SZ,
|
REG_SZ,
|
||||||
ImagePath,
|
(PVOID)ImagePath,
|
||||||
(wcslen(ImagePath) + 1) * sizeof(WCHAR));
|
(wcslen(ImagePath) + 1) * sizeof(WCHAR));
|
||||||
|
|
||||||
INF_FreeData(ImagePath);
|
INF_FreeData(ImagePath);
|
||||||
|
@ -174,7 +175,7 @@ InstallDriver(
|
||||||
&ServiceU,
|
&ServiceU,
|
||||||
0,
|
0,
|
||||||
REG_SZ,
|
REG_SZ,
|
||||||
Driver,
|
(PVOID)Driver,
|
||||||
(wcslen(Driver) + 1) * sizeof(WCHAR));
|
(wcslen(Driver) + 1) * sizeof(WCHAR));
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,11 +16,13 @@
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
/* COPYRIGHT: See COPYING in the top level directory
|
/*
|
||||||
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS text-mode setup
|
* PROJECT: ReactOS text-mode setup
|
||||||
* FILE: base/setup/usetup/filequeue.c
|
* FILE: base/setup/lib/fileqsup.c
|
||||||
* PURPOSE: File queue functions
|
* PURPOSE: Interfacing with Setup* API File Queue support functions
|
||||||
* PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
||||||
|
* Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* INCLUDES *****************************************************************/
|
/* INCLUDES *****************************************************************/
|
||||||
|
@ -30,7 +32,7 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
/* INCLUDES *****************************************************************/
|
/* DEFINITIONS **************************************************************/
|
||||||
|
|
||||||
typedef struct _QUEUEENTRY
|
typedef struct _QUEUEENTRY
|
||||||
{
|
{
|
||||||
|
@ -210,7 +212,7 @@ SetupDeleteQueueEntry(
|
||||||
RtlFreeHeap(ProcessHeap, 0, Entry);
|
RtlFreeHeap(ProcessHeap, 0, Entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
BOOL
|
||||||
WINAPI
|
WINAPI
|
||||||
SetupCloseFileQueue(
|
SetupCloseFileQueue(
|
||||||
IN HSPFILEQ QueueHandle)
|
IN HSPFILEQ QueueHandle)
|
||||||
|
@ -220,7 +222,7 @@ SetupCloseFileQueue(
|
||||||
PQUEUEENTRY Entry;
|
PQUEUEENTRY Entry;
|
||||||
|
|
||||||
if (QueueHandle == NULL)
|
if (QueueHandle == NULL)
|
||||||
return;
|
return FALSE;
|
||||||
|
|
||||||
QueueHeader = (PFILEQUEUEHEADER)QueueHandle;
|
QueueHeader = (PFILEQUEUEHEADER)QueueHandle;
|
||||||
|
|
||||||
|
@ -250,19 +252,24 @@ SetupCloseFileQueue(
|
||||||
|
|
||||||
/* Delete queue header */
|
/* Delete queue header */
|
||||||
RtlFreeHeap(ProcessHeap, 0, QueueHeader);
|
RtlFreeHeap(ProcessHeap, 0, QueueHeader);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A simplified version of SetupQueueCopyW that wraps Cabinet support around */
|
/* A simplified version of SetupQueueCopyW that wraps Cabinet support around */
|
||||||
BOOL
|
BOOL
|
||||||
WINAPI
|
WINAPI
|
||||||
SetupQueueCopyWithCab( // SetupQueueCopyW
|
SetupQueueCopyWithCab(
|
||||||
IN HSPFILEQ QueueHandle,
|
IN HSPFILEQ QueueHandle,
|
||||||
IN PCWSTR SourceCabinet OPTIONAL,
|
|
||||||
IN PCWSTR SourceRootPath,
|
IN PCWSTR SourceRootPath,
|
||||||
IN PCWSTR SourcePath OPTIONAL,
|
IN PCWSTR SourcePath OPTIONAL,
|
||||||
IN PCWSTR SourceFileName,
|
IN PCWSTR SourceFileName,
|
||||||
|
IN PCWSTR SourceDescription OPTIONAL,
|
||||||
|
IN PCWSTR SourceCabinet OPTIONAL,
|
||||||
|
IN PCWSTR SourceTagFile OPTIONAL,
|
||||||
IN PCWSTR TargetDirectory,
|
IN PCWSTR TargetDirectory,
|
||||||
IN PCWSTR TargetFileName OPTIONAL)
|
IN PCWSTR TargetFileName OPTIONAL,
|
||||||
|
IN ULONG CopyStyle)
|
||||||
{
|
{
|
||||||
PFILEQUEUEHEADER QueueHeader;
|
PFILEQUEUEHEADER QueueHeader;
|
||||||
PQUEUEENTRY Entry;
|
PQUEUEENTRY Entry;
|
||||||
|
@ -868,4 +875,14 @@ SetupCommitFileQueueW(
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
|
pSpFileQueueOpen SpFileQueueOpen = SetupOpenFileQueue;
|
||||||
|
pSpFileQueueClose SpFileQueueClose = SetupCloseFileQueue;
|
||||||
|
pSpFileQueueCopy SpFileQueueCopy = SetupQueueCopyWithCab;
|
||||||
|
pSpFileQueueDelete SpFileQueueDelete = SetupQueueDeleteW;
|
||||||
|
pSpFileQueueRename SpFileQueueRename = SetupQueueRenameW;
|
||||||
|
pSpFileQueueCommit SpFileQueueCommit = SetupCommitFileQueueW;
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
|
@ -20,8 +20,8 @@
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS text-mode setup
|
* PROJECT: ReactOS text-mode setup
|
||||||
* FILE: base/setup/usetup/inffile.h
|
* FILE: base/setup/usetup/inffile.h
|
||||||
* PURPOSE: .inf files support functions
|
* PURPOSE: Interfacing with Setup* API .INF Files support functions
|
||||||
* PROGRAMMERS: Hervé Poussineau
|
* PROGRAMMERS: Hervé Poussineau
|
||||||
* Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
* Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -50,11 +50,11 @@ extern VOID InfSetHeap(PVOID Heap);
|
||||||
|
|
||||||
HINF WINAPI
|
HINF WINAPI
|
||||||
INF_OpenBufferedFileA(
|
INF_OpenBufferedFileA(
|
||||||
IN PSTR FileBuffer,
|
IN PSTR FileBuffer,
|
||||||
IN ULONG FileSize,
|
IN ULONG FileSize,
|
||||||
IN PCSTR InfClass,
|
IN PCSTR InfClass,
|
||||||
IN DWORD InfStyle,
|
IN DWORD InfStyle,
|
||||||
IN LCID LocaleId,
|
IN LCID LocaleId,
|
||||||
OUT PUINT ErrorLine);
|
OUT PUINT ErrorLine);
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
|
@ -19,9 +19,9 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS text-mode setup
|
* PROJECT: ReactOS text-mode setup
|
||||||
* FILE: base/setup/usetup/inffile.c
|
* FILE: base/setup/lib/infsupp.c
|
||||||
* PURPOSE: .inf files support functions
|
* PURPOSE: Interfacing with Setup* API .INF Files support functions
|
||||||
* PROGRAMMERS: Hervé Poussineau
|
* PROGRAMMERS: Hervé Poussineau
|
||||||
* Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
* Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -40,7 +40,8 @@ extern VOID InfCloseFile(HINF InfHandle);
|
||||||
// #define SetupCloseInfFile InfCloseFile
|
// #define SetupCloseInfFile InfCloseFile
|
||||||
VOID
|
VOID
|
||||||
WINAPI
|
WINAPI
|
||||||
SetupCloseInfFile(HINF InfHandle)
|
SetupCloseInfFile(
|
||||||
|
IN HINF InfHandle)
|
||||||
{
|
{
|
||||||
InfCloseFile(InfHandle);
|
InfCloseFile(InfHandle);
|
||||||
}
|
}
|
||||||
|
@ -71,23 +72,25 @@ extern BOOLEAN InfFindNextLine(PINFCONTEXT ContextIn,
|
||||||
// #define SetupFindNextLine InfFindNextLine
|
// #define SetupFindNextLine InfFindNextLine
|
||||||
BOOL
|
BOOL
|
||||||
WINAPI
|
WINAPI
|
||||||
SetupFindNextLine(PINFCONTEXT ContextIn,
|
SetupFindNextLine(
|
||||||
PINFCONTEXT ContextOut)
|
IN PINFCONTEXT ContextIn,
|
||||||
|
OUT PINFCONTEXT ContextOut)
|
||||||
{
|
{
|
||||||
return !!InfFindNextLine(ContextIn, ContextOut);
|
return !!InfFindNextLine(ContextIn, ContextOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern LONG InfGetFieldCount(PINFCONTEXT Context);
|
extern LONG InfGetFieldCount(PINFCONTEXT Context);
|
||||||
// #define SetupGetFieldCount InfGetFieldCount
|
// #define SetupGetFieldCount InfGetFieldCount
|
||||||
LONG
|
ULONG
|
||||||
WINAPI
|
WINAPI
|
||||||
SetupGetFieldCount(PINFCONTEXT Context)
|
SetupGetFieldCount(
|
||||||
|
IN PINFCONTEXT Context)
|
||||||
{
|
{
|
||||||
return InfGetFieldCount(Context);
|
return (ULONG)InfGetFieldCount(Context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function corresponds to an undocumented but exported setupapi API
|
* This function corresponds to an undocumented but exported SetupAPI function
|
||||||
* that exists since WinNT4 and is still present in Win10.
|
* that exists since WinNT4 and is still present in Win10.
|
||||||
* The returned string pointer is a read-only pointer to a string in the
|
* The returned string pointer is a read-only pointer to a string in the
|
||||||
* maintained INF cache, and is always in UNICODE (on NT systems).
|
* maintained INF cache, and is always in UNICODE (on NT systems).
|
||||||
|
@ -97,8 +100,9 @@ extern BOOLEAN InfGetDataField(PINFCONTEXT Context,
|
||||||
PWCHAR *Data);
|
PWCHAR *Data);
|
||||||
PCWSTR
|
PCWSTR
|
||||||
WINAPI
|
WINAPI
|
||||||
pSetupGetField(PINFCONTEXT Context,
|
pSetupGetField(
|
||||||
ULONG FieldIndex)
|
IN PINFCONTEXT Context,
|
||||||
|
IN ULONG FieldIndex)
|
||||||
{
|
{
|
||||||
PWCHAR Data = NULL;
|
PWCHAR Data = NULL;
|
||||||
if (!InfGetDataField(Context, FieldIndex, &Data))
|
if (!InfGetDataField(Context, FieldIndex, &Data))
|
||||||
|
@ -114,11 +118,12 @@ extern BOOLEAN InfGetBinaryField(PINFCONTEXT Context,
|
||||||
// #define SetupGetBinaryField InfGetBinaryField
|
// #define SetupGetBinaryField InfGetBinaryField
|
||||||
BOOL
|
BOOL
|
||||||
WINAPI
|
WINAPI
|
||||||
SetupGetBinaryField(PINFCONTEXT Context,
|
SetupGetBinaryField(
|
||||||
ULONG FieldIndex,
|
IN PINFCONTEXT Context,
|
||||||
PUCHAR ReturnBuffer,
|
IN ULONG FieldIndex,
|
||||||
ULONG ReturnBufferSize,
|
OUT PUCHAR ReturnBuffer,
|
||||||
PULONG RequiredSize)
|
IN ULONG ReturnBufferSize,
|
||||||
|
OUT PULONG RequiredSize)
|
||||||
{
|
{
|
||||||
return !!InfGetBinaryField(Context,
|
return !!InfGetBinaryField(Context,
|
||||||
FieldIndex,
|
FieldIndex,
|
||||||
|
@ -133,9 +138,10 @@ extern BOOLEAN InfGetIntField(PINFCONTEXT Context,
|
||||||
// #define SetupGetIntField InfGetIntField
|
// #define SetupGetIntField InfGetIntField
|
||||||
BOOL
|
BOOL
|
||||||
WINAPI
|
WINAPI
|
||||||
SetupGetIntField(PINFCONTEXT Context,
|
SetupGetIntField(
|
||||||
ULONG FieldIndex,
|
IN PINFCONTEXT Context,
|
||||||
INT *IntegerValue) // PINT
|
IN ULONG FieldIndex,
|
||||||
|
OUT INT *IntegerValue) // PINT
|
||||||
{
|
{
|
||||||
return !!InfGetIntField(Context, FieldIndex, IntegerValue);
|
return !!InfGetIntField(Context, FieldIndex, IntegerValue);
|
||||||
}
|
}
|
||||||
|
@ -148,11 +154,12 @@ extern BOOLEAN InfGetMultiSzField(PINFCONTEXT Context,
|
||||||
// #define SetupGetMultiSzFieldW InfGetMultiSzField
|
// #define SetupGetMultiSzFieldW InfGetMultiSzField
|
||||||
BOOL
|
BOOL
|
||||||
WINAPI
|
WINAPI
|
||||||
SetupGetMultiSzFieldW(PINFCONTEXT Context,
|
SetupGetMultiSzFieldW(
|
||||||
ULONG FieldIndex,
|
IN PINFCONTEXT Context,
|
||||||
PWSTR ReturnBuffer,
|
IN ULONG FieldIndex,
|
||||||
ULONG ReturnBufferSize,
|
OUT PWSTR ReturnBuffer,
|
||||||
PULONG RequiredSize)
|
IN ULONG ReturnBufferSize,
|
||||||
|
OUT PULONG RequiredSize)
|
||||||
{
|
{
|
||||||
return !!InfGetMultiSzField(Context,
|
return !!InfGetMultiSzField(Context,
|
||||||
FieldIndex,
|
FieldIndex,
|
||||||
|
@ -169,11 +176,12 @@ extern BOOLEAN InfGetStringField(PINFCONTEXT Context,
|
||||||
// #define SetupGetStringFieldW InfGetStringField
|
// #define SetupGetStringFieldW InfGetStringField
|
||||||
BOOL
|
BOOL
|
||||||
WINAPI
|
WINAPI
|
||||||
SetupGetStringFieldW(PINFCONTEXT Context,
|
SetupGetStringFieldW(
|
||||||
ULONG FieldIndex,
|
IN PINFCONTEXT Context,
|
||||||
PWSTR ReturnBuffer,
|
IN ULONG FieldIndex,
|
||||||
ULONG ReturnBufferSize,
|
OUT PWSTR ReturnBuffer,
|
||||||
PULONG RequiredSize)
|
IN ULONG ReturnBufferSize,
|
||||||
|
OUT PULONG RequiredSize)
|
||||||
{
|
{
|
||||||
return !!InfGetStringField(Context,
|
return !!InfGetStringField(Context,
|
||||||
FieldIndex,
|
FieldIndex,
|
||||||
|
@ -182,7 +190,6 @@ SetupGetStringFieldW(PINFCONTEXT Context,
|
||||||
RequiredSize);
|
RequiredSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* SetupOpenInfFileW with support for a user-provided LCID */
|
/* SetupOpenInfFileW with support for a user-provided LCID */
|
||||||
// #define SetupOpenInfFileExW InfpOpenInfFileW
|
// #define SetupOpenInfFileExW InfpOpenInfFileW
|
||||||
HINF
|
HINF
|
||||||
|
@ -212,15 +219,29 @@ SetupOpenInfFileExW(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
|
pSpInfCloseInfFile SpInfCloseInfFile = SetupCloseInfFile;
|
||||||
|
pSpInfFindFirstLine SpInfFindFirstLine = SetupFindFirstLineW;
|
||||||
|
pSpInfFindNextLine SpInfFindNextLine = SetupFindNextLine;
|
||||||
|
pSpInfGetFieldCount SpInfGetFieldCount = SetupGetFieldCount;
|
||||||
|
pSpInfGetBinaryField SpInfGetBinaryField = SetupGetBinaryField;
|
||||||
|
pSpInfGetIntField SpInfGetIntField = SetupGetIntField;
|
||||||
|
pSpInfGetMultiSzField SpInfGetMultiSzField = SetupGetMultiSzFieldW;
|
||||||
|
pSpInfGetStringField SpInfGetStringField = SetupGetStringFieldW;
|
||||||
|
pSpInfGetField SpInfGetField = pSetupGetField;
|
||||||
|
pSpInfOpenInfFile SpInfOpenInfFile = SetupOpenInfFileExW;
|
||||||
|
|
||||||
|
|
||||||
/* HELPER FUNCTIONS **********************************************************/
|
/* HELPER FUNCTIONS **********************************************************/
|
||||||
|
|
||||||
HINF WINAPI
|
HINF WINAPI
|
||||||
INF_OpenBufferedFileA(
|
INF_OpenBufferedFileA(
|
||||||
IN PSTR FileBuffer,
|
IN PSTR FileBuffer,
|
||||||
IN ULONG FileSize,
|
IN ULONG FileSize,
|
||||||
IN PCSTR InfClass,
|
IN PCSTR InfClass,
|
||||||
IN DWORD InfStyle,
|
IN DWORD InfStyle,
|
||||||
IN LCID LocaleId,
|
IN LCID LocaleId,
|
||||||
OUT PUINT ErrorLine)
|
OUT PUINT ErrorLine)
|
||||||
{
|
{
|
||||||
HINF hInf = NULL;
|
HINF hInf = NULL;
|
|
@ -71,8 +71,6 @@ static PGENERIC_LIST NtOsInstallsList = NULL;
|
||||||
|
|
||||||
// HACK: Temporary compatibility code.
|
// HACK: Temporary compatibility code.
|
||||||
#if 1
|
#if 1
|
||||||
#define SetupQueueCopy SetupQueueCopyWithCab
|
|
||||||
|
|
||||||
static CABINET_CONTEXT CabinetContext;
|
static CABINET_CONTEXT CabinetContext;
|
||||||
#define CabinetInitialize() (CabinetInitialize(&CabinetContext))
|
#define CabinetInitialize() (CabinetInitialize(&CabinetContext))
|
||||||
#define CabinetSetEventHandlers(a,b,c) (CabinetSetEventHandlers(&CabinetContext,(a),(b),(c)))
|
#define CabinetSetEventHandlers(a,b,c) (CabinetSetEventHandlers(&CabinetContext,(a),(b),(c)))
|
||||||
|
@ -3485,17 +3483,17 @@ InstallDirectoryPage(PINPUT_RECORD Ir)
|
||||||
|
|
||||||
static BOOLEAN
|
static BOOLEAN
|
||||||
AddSectionToCopyQueueCab(HINF InfFile,
|
AddSectionToCopyQueueCab(HINF InfFile,
|
||||||
PWCHAR SectionName,
|
PCWSTR SectionName,
|
||||||
PWCHAR SourceCabinet,
|
PCWSTR SourceCabinet,
|
||||||
PCUNICODE_STRING DestinationPath,
|
PCUNICODE_STRING DestinationPath,
|
||||||
PINPUT_RECORD Ir)
|
PINPUT_RECORD Ir)
|
||||||
{
|
{
|
||||||
INFCONTEXT FilesContext;
|
INFCONTEXT FilesContext;
|
||||||
INFCONTEXT DirContext;
|
INFCONTEXT DirContext;
|
||||||
PWCHAR FileKeyName;
|
PCWSTR FileKeyName;
|
||||||
PWCHAR FileKeyValue;
|
PCWSTR FileKeyValue;
|
||||||
PWCHAR DirKeyValue;
|
PCWSTR DirKeyValue;
|
||||||
PWCHAR TargetFileName;
|
PCWSTR TargetFileName;
|
||||||
WCHAR FileDstPath[MAX_PATH];
|
WCHAR FileDstPath[MAX_PATH];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -3505,7 +3503,7 @@ AddSectionToCopyQueueCab(HINF InfFile,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Search for the SectionName section */
|
/* Search for the SectionName section */
|
||||||
if (!SetupFindFirstLineW(InfFile, SectionName, NULL, &FilesContext))
|
if (!SpInfFindFirstLine(InfFile, SectionName, NULL, &FilesContext))
|
||||||
{
|
{
|
||||||
MUIDisplayError(ERROR_TXTSETUP_SECTION, Ir, POPUP_WAIT_ENTER, SectionName);
|
MUIDisplayError(ERROR_TXTSETUP_SECTION, Ir, POPUP_WAIT_ENTER, SectionName);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -3531,7 +3529,7 @@ AddSectionToCopyQueueCab(HINF InfFile,
|
||||||
DPRINT("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName, FileKeyValue);
|
DPRINT("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName, FileKeyValue);
|
||||||
|
|
||||||
/* Lookup target directory */
|
/* Lookup target directory */
|
||||||
if (!SetupFindFirstLineW(InfFile, L"Directories", FileKeyValue, &DirContext))
|
if (!SpInfFindFirstLine(InfFile, L"Directories", FileKeyValue, &DirContext))
|
||||||
{
|
{
|
||||||
/* FIXME: Handle error! */
|
/* FIXME: Handle error! */
|
||||||
DPRINT1("SetupFindFirstLine() failed\n");
|
DPRINT1("SetupFindFirstLine() failed\n");
|
||||||
|
@ -3557,7 +3555,7 @@ AddSectionToCopyQueueCab(HINF InfFile,
|
||||||
ULONG Length = wcslen(DirKeyValue);
|
ULONG Length = wcslen(DirKeyValue);
|
||||||
if ((Length > 0) && (DirKeyValue[Length - 1] == L'\\'))
|
if ((Length > 0) && (DirKeyValue[Length - 1] == L'\\'))
|
||||||
Length--;
|
Length--;
|
||||||
DirKeyValue[Length] = UNICODE_NULL;
|
*((PWSTR)DirKeyValue + Length) = UNICODE_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build the full target path */
|
/* Build the full target path */
|
||||||
|
@ -3586,22 +3584,25 @@ AddSectionToCopyQueueCab(HINF InfFile,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!SetupQueueCopy(USetupData.SetupFileQueue,
|
if (!SpFileQueueCopy((HSPFILEQ)USetupData.SetupFileQueue,
|
||||||
SourceCabinet,
|
USetupData.SourceRootPath.Buffer,
|
||||||
USetupData.SourceRootPath.Buffer,
|
USetupData.SourceRootDir.Buffer,
|
||||||
USetupData.SourceRootDir.Buffer,
|
FileKeyName,
|
||||||
FileKeyName,
|
NULL,
|
||||||
FileDstPath,
|
SourceCabinet,
|
||||||
TargetFileName))
|
NULL,
|
||||||
|
FileDstPath,
|
||||||
|
TargetFileName,
|
||||||
|
0 /* FIXME */))
|
||||||
{
|
{
|
||||||
/* FIXME: Handle error! */
|
/* FIXME: Handle error! */
|
||||||
DPRINT1("SetupQueueCopy() failed\n");
|
DPRINT1("SpFileQueueCopy() failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
INF_FreeData(FileKeyName);
|
INF_FreeData(FileKeyName);
|
||||||
INF_FreeData(TargetFileName);
|
INF_FreeData(TargetFileName);
|
||||||
INF_FreeData(DirKeyValue);
|
INF_FreeData(DirKeyValue);
|
||||||
} while (SetupFindNextLine(&FilesContext, &FilesContext));
|
} while (SpInfFindNextLine(&FilesContext, &FilesContext));
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -3609,17 +3610,17 @@ AddSectionToCopyQueueCab(HINF InfFile,
|
||||||
|
|
||||||
static BOOLEAN
|
static BOOLEAN
|
||||||
AddSectionToCopyQueue(HINF InfFile,
|
AddSectionToCopyQueue(HINF InfFile,
|
||||||
PWCHAR SectionName,
|
PCWSTR SectionName,
|
||||||
PWCHAR SourceCabinet,
|
PCWSTR SourceCabinet,
|
||||||
PCUNICODE_STRING DestinationPath,
|
PCUNICODE_STRING DestinationPath,
|
||||||
PINPUT_RECORD Ir)
|
PINPUT_RECORD Ir)
|
||||||
{
|
{
|
||||||
INFCONTEXT FilesContext;
|
INFCONTEXT FilesContext;
|
||||||
INFCONTEXT DirContext;
|
INFCONTEXT DirContext;
|
||||||
PWCHAR FileKeyName;
|
PCWSTR FileKeyName;
|
||||||
PWCHAR FileKeyValue;
|
PCWSTR FileKeyValue;
|
||||||
PWCHAR DirKeyValue;
|
PCWSTR DirKeyValue;
|
||||||
PWCHAR TargetFileName;
|
PCWSTR TargetFileName;
|
||||||
WCHAR CompleteOrigDirName[512]; // FIXME: MAX_PATH is not enough?
|
WCHAR CompleteOrigDirName[512]; // FIXME: MAX_PATH is not enough?
|
||||||
WCHAR FileDstPath[MAX_PATH];
|
WCHAR FileDstPath[MAX_PATH];
|
||||||
|
|
||||||
|
@ -3632,7 +3633,7 @@ AddSectionToCopyQueue(HINF InfFile,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Search for the SectionName section */
|
/* Search for the SectionName section */
|
||||||
if (!SetupFindFirstLineW(InfFile, SectionName, NULL, &FilesContext))
|
if (!SpInfFindFirstLine(InfFile, SectionName, NULL, &FilesContext))
|
||||||
{
|
{
|
||||||
MUIDisplayError(ERROR_TXTSETUP_SECTION, Ir, POPUP_WAIT_ENTER, SectionName);
|
MUIDisplayError(ERROR_TXTSETUP_SECTION, Ir, POPUP_WAIT_ENTER, SectionName);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -3669,7 +3670,7 @@ AddSectionToCopyQueue(HINF InfFile,
|
||||||
DPRINT("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName, FileKeyValue);
|
DPRINT("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName, FileKeyValue);
|
||||||
|
|
||||||
/* Lookup target directory */
|
/* Lookup target directory */
|
||||||
if (!SetupFindFirstLineW(InfFile, L"Directories", FileKeyValue, &DirContext))
|
if (!SpInfFindFirstLine(InfFile, L"Directories", FileKeyValue, &DirContext))
|
||||||
{
|
{
|
||||||
/* FIXME: Handle error! */
|
/* FIXME: Handle error! */
|
||||||
DPRINT1("SetupFindFirstLine() failed\n");
|
DPRINT1("SetupFindFirstLine() failed\n");
|
||||||
|
@ -3726,7 +3727,7 @@ AddSectionToCopyQueue(HINF InfFile,
|
||||||
ULONG Length = wcslen(DirKeyValue);
|
ULONG Length = wcslen(DirKeyValue);
|
||||||
if ((Length > 0) && (DirKeyValue[Length - 1] == L'\\'))
|
if ((Length > 0) && (DirKeyValue[Length - 1] == L'\\'))
|
||||||
Length--;
|
Length--;
|
||||||
DirKeyValue[Length] = UNICODE_NULL;
|
*((PWSTR)DirKeyValue + Length) = UNICODE_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build the full target path */
|
/* Build the full target path */
|
||||||
|
@ -3755,22 +3756,25 @@ AddSectionToCopyQueue(HINF InfFile,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!SetupQueueCopy(USetupData.SetupFileQueue,
|
if (!SpFileQueueCopy((HSPFILEQ)USetupData.SetupFileQueue,
|
||||||
SourceCabinet,
|
USetupData.SourceRootPath.Buffer,
|
||||||
USetupData.SourceRootPath.Buffer,
|
CompleteOrigDirName,
|
||||||
CompleteOrigDirName,
|
FileKeyName,
|
||||||
FileKeyName,
|
NULL,
|
||||||
FileDstPath,
|
SourceCabinet,
|
||||||
TargetFileName))
|
NULL,
|
||||||
|
FileDstPath,
|
||||||
|
TargetFileName,
|
||||||
|
0 /* FIXME */))
|
||||||
{
|
{
|
||||||
/* FIXME: Handle error! */
|
/* FIXME: Handle error! */
|
||||||
DPRINT1("SetupQueueCopy() failed\n");
|
DPRINT1("SpFileQueueCopy() failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
INF_FreeData(FileKeyName);
|
INF_FreeData(FileKeyName);
|
||||||
INF_FreeData(TargetFileName);
|
INF_FreeData(TargetFileName);
|
||||||
INF_FreeData(DirKeyValue);
|
INF_FreeData(DirKeyValue);
|
||||||
} while (SetupFindNextLine(&FilesContext, &FilesContext));
|
} while (SpInfFindNextLine(&FilesContext, &FilesContext));
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -3778,13 +3782,13 @@ AddSectionToCopyQueue(HINF InfFile,
|
||||||
|
|
||||||
static BOOLEAN
|
static BOOLEAN
|
||||||
PrepareCopyPageInfFile(HINF InfFile,
|
PrepareCopyPageInfFile(HINF InfFile,
|
||||||
PWCHAR SourceCabinet,
|
PCWSTR SourceCabinet,
|
||||||
PINPUT_RECORD Ir)
|
PINPUT_RECORD Ir)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
INFCONTEXT DirContext;
|
INFCONTEXT DirContext;
|
||||||
PWCHAR AdditionalSectionName = NULL;
|
PWCHAR AdditionalSectionName = NULL;
|
||||||
PWCHAR DirKeyValue;
|
PCWSTR DirKeyValue;
|
||||||
WCHAR PathBuffer[MAX_PATH];
|
WCHAR PathBuffer[MAX_PATH];
|
||||||
|
|
||||||
/* Add common files */
|
/* Add common files */
|
||||||
|
@ -3829,7 +3833,7 @@ PrepareCopyPageInfFile(HINF InfFile,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search for the 'Directories' section */
|
/* Search for the 'Directories' section */
|
||||||
if (!SetupFindFirstLineW(InfFile, L"Directories", NULL, &DirContext))
|
if (!SpInfFindFirstLine(InfFile, L"Directories", NULL, &DirContext))
|
||||||
{
|
{
|
||||||
if (SourceCabinet)
|
if (SourceCabinet)
|
||||||
MUIDisplayError(ERROR_CABINET_SECTION, Ir, POPUP_WAIT_ENTER, L"Directories");
|
MUIDisplayError(ERROR_CABINET_SECTION, Ir, POPUP_WAIT_ENTER, L"Directories");
|
||||||
|
@ -3898,7 +3902,7 @@ PrepareCopyPageInfFile(HINF InfFile,
|
||||||
}
|
}
|
||||||
|
|
||||||
INF_FreeData(DirKeyValue);
|
INF_FreeData(DirKeyValue);
|
||||||
} while (SetupFindNextLine(&DirContext, &DirContext));
|
} while (SpInfFindNextLine(&DirContext, &DirContext));
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -3925,14 +3929,14 @@ PrepareCopyPage(PINPUT_RECORD Ir)
|
||||||
WCHAR PathBuffer[MAX_PATH];
|
WCHAR PathBuffer[MAX_PATH];
|
||||||
INFCONTEXT CabinetsContext;
|
INFCONTEXT CabinetsContext;
|
||||||
ULONG InfFileSize;
|
ULONG InfFileSize;
|
||||||
PWCHAR KeyValue;
|
PCWSTR KeyValue;
|
||||||
UINT ErrorLine;
|
UINT ErrorLine;
|
||||||
PVOID InfFileData;
|
PVOID InfFileData;
|
||||||
|
|
||||||
MUIDisplayPage(PREPARE_COPY_PAGE);
|
MUIDisplayPage(PREPARE_COPY_PAGE);
|
||||||
|
|
||||||
/* Create the file queue */
|
/* Create the file queue */
|
||||||
USetupData.SetupFileQueue = SetupOpenFileQueue();
|
USetupData.SetupFileQueue = SpFileQueueOpen();
|
||||||
if (USetupData.SetupFileQueue == NULL)
|
if (USetupData.SetupFileQueue == NULL)
|
||||||
{
|
{
|
||||||
MUIDisplayError(ERROR_COPY_QUEUE, Ir, POPUP_WAIT_ENTER);
|
MUIDisplayError(ERROR_COPY_QUEUE, Ir, POPUP_WAIT_ENTER);
|
||||||
|
@ -3946,7 +3950,7 @@ PrepareCopyPage(PINPUT_RECORD Ir)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search for the 'Cabinets' section */
|
/* Search for the 'Cabinets' section */
|
||||||
if (!SetupFindFirstLineW(USetupData.SetupInf, L"Cabinets", NULL, &CabinetsContext))
|
if (!SpInfFindFirstLine(USetupData.SetupInf, L"Cabinets", NULL, &CabinetsContext))
|
||||||
{
|
{
|
||||||
return FILE_COPY_PAGE;
|
return FILE_COPY_PAGE;
|
||||||
}
|
}
|
||||||
|
@ -4005,7 +4009,7 @@ PrepareCopyPage(PINPUT_RECORD Ir)
|
||||||
/* FIXME: show an error dialog */
|
/* FIXME: show an error dialog */
|
||||||
return QUIT_PAGE;
|
return QUIT_PAGE;
|
||||||
}
|
}
|
||||||
} while (SetupFindNextLine(&CabinetsContext, &CabinetsContext));
|
} while (SpInfFindNextLine(&CabinetsContext, &CabinetsContext));
|
||||||
|
|
||||||
return FILE_COPY_PAGE;
|
return FILE_COPY_PAGE;
|
||||||
}
|
}
|
||||||
|
@ -4148,7 +4152,7 @@ FileCopyCallback(PVOID Context,
|
||||||
*
|
*
|
||||||
* SIDEEFFECTS
|
* SIDEEFFECTS
|
||||||
* Calls SetupCommitFileQueueW
|
* Calls SetupCommitFileQueueW
|
||||||
* Calls SetupCloseFileQueue
|
* Calls SpFileQueueClose
|
||||||
*
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* Number of the next page.
|
* Number of the next page.
|
||||||
|
@ -4210,13 +4214,13 @@ FileCopyPage(PINPUT_RECORD Ir)
|
||||||
"Free Memory");
|
"Free Memory");
|
||||||
|
|
||||||
/* Do the file copying */
|
/* Do the file copying */
|
||||||
SetupCommitFileQueueW(NULL,
|
SpFileQueueCommit(NULL,
|
||||||
USetupData.SetupFileQueue,
|
USetupData.SetupFileQueue,
|
||||||
FileCopyCallback,
|
FileCopyCallback,
|
||||||
&CopyContext);
|
&CopyContext);
|
||||||
|
|
||||||
/* If we get here, we're done, so cleanup the queue and progress bar */
|
/* If we get here, we're done, so cleanup the queue and progress bar */
|
||||||
SetupCloseFileQueue(USetupData.SetupFileQueue);
|
SpFileQueueClose(USetupData.SetupFileQueue);
|
||||||
DestroyProgressBar(CopyContext.ProgressBar);
|
DestroyProgressBar(CopyContext.ProgressBar);
|
||||||
DestroyProgressBar(CopyContext.MemoryBars[0]);
|
DestroyProgressBar(CopyContext.MemoryBars[0]);
|
||||||
DestroyProgressBar(CopyContext.MemoryBars[1]);
|
DestroyProgressBar(CopyContext.MemoryBars[1]);
|
||||||
|
|
|
@ -59,15 +59,16 @@
|
||||||
|
|
||||||
/* Internal Headers */
|
/* Internal Headers */
|
||||||
#include "consup.h"
|
#include "consup.h"
|
||||||
#include "inffile.h"
|
|
||||||
#include "progress.h"
|
#include "progress.h"
|
||||||
#include "filequeue.h"
|
|
||||||
#include "fslist.h"
|
#include "fslist.h"
|
||||||
#include "partlist.h"
|
#include "partlist.h"
|
||||||
#include "cabinet.h"
|
|
||||||
#include "genlist.h"
|
#include "genlist.h"
|
||||||
#include "mui.h"
|
#include "mui.h"
|
||||||
|
|
||||||
|
#include "spapisup/inffile.h"
|
||||||
|
#include "spapisup/cabinet.h"
|
||||||
|
|
||||||
|
|
||||||
extern HANDLE ProcessHeap;
|
extern HANDLE ProcessHeap;
|
||||||
extern BOOLEAN IsUnattendedSetup;
|
extern BOOLEAN IsUnattendedSetup;
|
||||||
extern PCWSTR SelectedLanguageId;
|
extern PCWSTR SelectedLanguageId;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue