-static BOOLEAN
-AddSectionToCopyQueueCab(HINF InfFile,
- PWCHAR SectionName,
- PWCHAR SourceCabinet,
- PCUNICODE_STRING DestinationPath,
- PINPUT_RECORD Ir)
-{
- INFCONTEXT FilesContext;
- INFCONTEXT DirContext;
- PWCHAR FileKeyName;
- PWCHAR FileKeyValue;
- PWCHAR DirKeyValue;
- PWCHAR TargetFileName;
-
- /*
- * This code enumerates the list of files in reactos.dff / reactos.inf
- * that need to be extracted from reactos.cab and be installed in their
- * respective directories.
- */
-
- /* Search for the SectionName section */
- if (!SetupFindFirstLineW(InfFile, SectionName, NULL, &FilesContext))
- {
- CHAR Buffer[128];
- sprintf(Buffer, MUIGetString(STRING_TXTSETUPFAILED), SectionName);
- PopupError(Buffer, MUIGetString(STRING_REBOOTCOMPUTER), Ir, POPUP_WAIT_ENTER);
- return FALSE;
- }
-
- /*
- * Enumerate the files in the section and add them to the file queue.
- */
- do
- {
- /* Get source file name and target directory id */
- if (!INF_GetData(&FilesContext, &FileKeyName, &FileKeyValue))
- {
- /* FIXME: Handle error! */
- DPRINT1("INF_GetData() failed\n");
- break;
- }
-
- /* Get optional target file name */
- if (!INF_GetDataField(&FilesContext, 2, &TargetFileName))
- TargetFileName = NULL;
-
- DPRINT("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName, FileKeyValue);
-
- /* Lookup target directory */
- if (!SetupFindFirstLineW(InfFile, L"Directories", FileKeyValue, &DirContext))
- {
- /* FIXME: Handle error! */
- DPRINT1("SetupFindFirstLine() failed\n");
- break;
- }
-
- if (!INF_GetData(&DirContext, NULL, &DirKeyValue))
- {
- /* FIXME: Handle error! */
- DPRINT1("INF_GetData() failed\n");
- break;
- }
-
- if (!SetupQueueCopy(SetupFileQueue,
- SourceCabinet,
- SourceRootPath.Buffer,
- SourceRootDir.Buffer,
- FileKeyName,
- DirKeyValue,
- TargetFileName))
- {
- /* FIXME: Handle error! */
- DPRINT1("SetupQueueCopy() failed\n");
- }
- } while (SetupFindNextLine(&FilesContext, &FilesContext));
-
- return TRUE;
-}
-
-
-static BOOLEAN
-AddSectionToCopyQueue(HINF InfFile,
- PWCHAR SectionName,
- PWCHAR SourceCabinet,
- PCUNICODE_STRING DestinationPath,
- PINPUT_RECORD Ir)
-{
- INFCONTEXT FilesContext;
- INFCONTEXT DirContext;
- PWCHAR FileKeyName;
- PWCHAR FileKeyValue;
- PWCHAR DirKeyValue;
- PWCHAR TargetFileName;
- WCHAR CompleteOrigDirName[512]; // FIXME: MAX_PATH is not enough?
-
- if (SourceCabinet)
- return AddSectionToCopyQueueCab(InfFile, L"SourceFiles", SourceCabinet, DestinationPath, Ir);
-
- /*
- * This code enumerates the list of files in txtsetup.sif
- * that need to be installed in their respective directories.
- */
-
- /* Search for the SectionName section */
- if (!SetupFindFirstLineW(InfFile, SectionName, NULL, &FilesContext))
- {
- CHAR Buffer[128];
- sprintf(Buffer, MUIGetString(STRING_TXTSETUPFAILED), SectionName);
- PopupError(Buffer, MUIGetString(STRING_REBOOTCOMPUTER), Ir, POPUP_WAIT_ENTER);
- return FALSE;
- }
-
- /*
- * Enumerate the files in the section and add them to the file queue.
- */
- do
- {
- /* Get source file name and target directory id */
- if (!INF_GetData(&FilesContext, &FileKeyName, &FileKeyValue))
- {
- /* FIXME: Handle error! */
- DPRINT1("INF_GetData() failed\n");
- break;
- }
-
- /* Get target directory id */
- if (!INF_GetDataField(&FilesContext, 13, &FileKeyValue))
- {
- /* FIXME: Handle error! */
- DPRINT1("INF_GetData() failed\n");
- break;
- }
-
- /* Get optional target file name */
- if (!INF_GetDataField(&FilesContext, 11, &TargetFileName))
- TargetFileName = NULL;
- else if (!*TargetFileName)
- TargetFileName = NULL;
-
- DPRINT("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName, FileKeyValue);
-
- /* Lookup target directory */
- if (!SetupFindFirstLineW(InfFile, L"Directories", FileKeyValue, &DirContext))
- {
- /* FIXME: Handle error! */
- DPRINT1("SetupFindFirstLine() failed\n");
- break;
- }
-
- if (!INF_GetData(&DirContext, NULL, &DirKeyValue))
- {
- /* FIXME: Handle error! */
- DPRINT1("INF_GetData() failed\n");
- break;
- }
-
- if ((DirKeyValue[0] == UNICODE_NULL) || (DirKeyValue[0] == L'\\' && DirKeyValue[1] == UNICODE_NULL))
- {
- /* Installation path */
- DPRINT("InstallationPath: '%S'\n", DirKeyValue);
-
- StringCchCopyW(CompleteOrigDirName, ARRAYSIZE(CompleteOrigDirName),
- SourceRootDir.Buffer);
-
- DPRINT("InstallationPath(2): '%S'\n", CompleteOrigDirName);
- }
- else if (DirKeyValue[0] == L'\\')
- {
- /* Absolute path */
- DPRINT("AbsolutePath: '%S'\n", DirKeyValue);
-
- StringCchCopyW(CompleteOrigDirName, ARRAYSIZE(CompleteOrigDirName),
- DirKeyValue);
-
- DPRINT("AbsolutePath(2): '%S'\n", CompleteOrigDirName);
- }
- else // if (DirKeyValue[0] != L'\\')
- {
- /* Path relative to the installation path */
- DPRINT("RelativePath: '%S'\n", DirKeyValue);
-
- CombinePaths(CompleteOrigDirName, ARRAYSIZE(CompleteOrigDirName), 2,
- SourceRootDir.Buffer, DirKeyValue);
-
- DPRINT("RelativePath(2): '%S'\n", CompleteOrigDirName);
- }
-
- if (!SetupQueueCopy(SetupFileQueue,
- SourceCabinet,
- SourceRootPath.Buffer,
- CompleteOrigDirName,
- FileKeyName,
- DirKeyValue,
- TargetFileName))
- {
- /* FIXME: Handle error! */
- DPRINT1("SetupQueueCopy() failed\n");
- }
- } while (SetupFindNextLine(&FilesContext, &FilesContext));
-
- return TRUE;
-}
-
-
-static BOOLEAN
-PrepareCopyPageInfFile(HINF InfFile,
- PWCHAR SourceCabinet,
- PINPUT_RECORD Ir)