-
-static BOOLEAN
-PrepareCopyPageInfFile(HINF InfFile,
- PWCHAR SourceCabinet,
- PINPUT_RECORD Ir)
-{
- NTSTATUS Status;
- INFCONTEXT DirContext;
- PWCHAR AdditionalSectionName = NULL;
- PWCHAR DirKeyValue;
- WCHAR PathBuffer[MAX_PATH];
-
- /* Add common files */
- if (!AddSectionToCopyQueue(InfFile, L"SourceDisksFiles", SourceCabinet, &DestinationPath, Ir))
- return FALSE;
-
- /* Add specific files depending of computer type */
- if (SourceCabinet == NULL)
- {
- if (!ProcessComputerFiles(InfFile, ComputerList, &AdditionalSectionName))
- return FALSE;
-
- if (AdditionalSectionName)
- {
- if (!AddSectionToCopyQueue(InfFile, AdditionalSectionName, SourceCabinet, &DestinationPath, Ir))
- return FALSE;
- }
- }
-
- /* Create directories */
-
- /*
- * FIXME:
- * Copying files to DestinationRootPath should be done from within
- * the SystemPartitionFiles section.
- * At the moment we check whether we specify paths like '\foo' or '\\' for that.
- * For installing to DestinationPath specify just '\' .
- */
-
- /* Get destination path */
- StringCchCopyW(PathBuffer, ARRAYSIZE(PathBuffer), DestinationPath.Buffer);
-
- DPRINT("FullPath(1): '%S'\n", PathBuffer);
-
- /* Create the install directory */
- Status = SetupCreateDirectory(PathBuffer);
- if (!NT_SUCCESS(Status) && Status != STATUS_OBJECT_NAME_COLLISION)
- {
- DPRINT1("Creating directory '%S' failed: Status = 0x%08lx\n", PathBuffer, Status);
- MUIDisplayError(ERROR_CREATE_INSTALL_DIR, Ir, POPUP_WAIT_ENTER);
- return FALSE;
- }
-
- /* Search for the 'Directories' section */
- if (!SetupFindFirstLineW(InfFile, L"Directories", NULL, &DirContext))
- {
- if (SourceCabinet)
- {
- MUIDisplayError(ERROR_CABINET_SECTION, Ir, POPUP_WAIT_ENTER);
- }
- else
- {
- MUIDisplayError(ERROR_TXTSETUP_SECTION, Ir, POPUP_WAIT_ENTER);
- }
-
- return FALSE;
- }
-
- /* Enumerate the directory values and create the subdirectories */
- do
- {
- if (!INF_GetData(&DirContext, NULL, &DirKeyValue))
- {
- DPRINT1("break\n");
- break;
- }
-
- if ((DirKeyValue[0] == UNICODE_NULL) || (DirKeyValue[0] == L'\\' && DirKeyValue[1] == UNICODE_NULL))
- {
- /* Installation path */
- DPRINT("InstallationPath: '%S'\n", DirKeyValue);
-
- StringCchCopyW(PathBuffer, ARRAYSIZE(PathBuffer),
- DestinationPath.Buffer);
-
- DPRINT("InstallationPath(2): '%S'\n", PathBuffer);
- }
- else if (DirKeyValue[0] == L'\\')
- {
- /* Absolute path */
- DPRINT("AbsolutePath: '%S'\n", DirKeyValue);
-
- CombinePaths(PathBuffer, ARRAYSIZE(PathBuffer), 2,
- DestinationRootPath.Buffer, DirKeyValue);
-
- DPRINT("AbsolutePath(2): '%S'\n", PathBuffer);
-
- Status = SetupCreateDirectory(PathBuffer);
- if (!NT_SUCCESS(Status) && Status != STATUS_OBJECT_NAME_COLLISION)
- {
- DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer, Status);
- MUIDisplayError(ERROR_CREATE_DIR, Ir, POPUP_WAIT_ENTER);
- return FALSE;
- }
- }
- else // if (DirKeyValue[0] != L'\\')
- {
- /* Path relative to the installation path */
- DPRINT("RelativePath: '%S'\n", DirKeyValue);
-
- CombinePaths(PathBuffer, ARRAYSIZE(PathBuffer), 2,
- DestinationPath.Buffer, DirKeyValue);
-
- DPRINT("RelativePath(2): '%S'\n", PathBuffer);
-
- Status = SetupCreateDirectory(PathBuffer);
- if (!NT_SUCCESS(Status) && Status != STATUS_OBJECT_NAME_COLLISION)
- {
- DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer, Status);
- MUIDisplayError(ERROR_CREATE_DIR, Ir, POPUP_WAIT_ENTER);
- return FALSE;
- }
- }
- } while (SetupFindNextLine(&DirContext, &DirContext));
-
- return TRUE;
-}
-
-