[USETUP]: Fix some problems with extra-backslashes in paths, and fix the support for the setup directory "\" which means "the install directory" (i.e. C:\ReactOS usually).

[BOOTDATA/VGAFONTS]: Install the vga fonts needed for the Blue driver. Better fix for r57755 and r59547.

svn path=/trunk/; revision=66604
This commit is contained in:
Hermès Bélusca-Maïto
2015-03-08 04:09:23 +00:00
parent 9c9b3171f8
commit 97bb83fcd9
5 changed files with 122 additions and 30 deletions

View File

@@ -38,7 +38,7 @@ typedef struct _QUEUEENTRY
struct _QUEUEENTRY *Prev; struct _QUEUEENTRY *Prev;
struct _QUEUEENTRY *Next; struct _QUEUEENTRY *Next;
PWSTR SourceCabinet; /* May be NULL if file is not in a cabinet */ PWSTR SourceCabinet; /* May be NULL if the file is not in a cabinet */
PWSTR SourceRootPath; PWSTR SourceRootPath;
PWSTR SourcePath; PWSTR SourcePath;
PWSTR SourceFilename; PWSTR SourceFilename;
@@ -215,6 +215,8 @@ SetupQueueCopy(
if (SourcePath != NULL) if (SourcePath != NULL)
{ {
Length = wcslen(SourcePath); Length = wcslen(SourcePath);
if ((Length > 0) && (SourcePath[Length - 1] == L'\\'))
Length--;
Entry->SourcePath = (WCHAR*)RtlAllocateHeap(ProcessHeap, Entry->SourcePath = (WCHAR*)RtlAllocateHeap(ProcessHeap,
0, 0,
(Length + 1) * sizeof(WCHAR)); (Length + 1) * sizeof(WCHAR));
@@ -257,7 +259,7 @@ SetupQueueCopy(
/* Copy target directory */ /* Copy target directory */
Length = wcslen(TargetDirectory); Length = wcslen(TargetDirectory);
if (TargetDirectory[Length] == '\\') if ((Length > 0) && (TargetDirectory[Length - 1] == L'\\'))
Length--; Length--;
Entry->TargetDirectory = (WCHAR*)RtlAllocateHeap(ProcessHeap, Entry->TargetDirectory = (WCHAR*)RtlAllocateHeap(ProcessHeap,
0, 0,
@@ -366,6 +368,7 @@ SetupCommitFileQueueW(
Entry = QueueHeader->CopyHead; Entry = QueueHeader->CopyHead;
while (Entry != NULL) while (Entry != NULL)
{ {
/* Build the full source path */
wcscpy(FileSrcPath, Entry->SourceRootPath); wcscpy(FileSrcPath, Entry->SourceRootPath);
if (Entry->SourcePath != NULL) if (Entry->SourcePath != NULL)
wcscat(FileSrcPath, Entry->SourcePath); wcscat(FileSrcPath, Entry->SourcePath);
@@ -374,12 +377,29 @@ SetupCommitFileQueueW(
/* Build the full target path */ /* Build the full target path */
wcscpy(FileDstPath, TargetRootPath); wcscpy(FileDstPath, TargetRootPath);
if (Entry->TargetDirectory[0] == L'\\') if (Entry->TargetDirectory[0] == 0)
{ {
wcscat(FileDstPath, Entry->TargetDirectory); /* Installation path */
/* Add the installation path */
if (TargetPath != NULL)
{
if (TargetPath[0] != L'\\')
wcscat(FileDstPath, L"\\");
wcscat(FileDstPath, TargetPath);
}
} }
else else if (Entry->TargetDirectory[0] == L'\\')
{ {
/* Absolute path */
if (Entry->TargetDirectory[1] != 0)
wcscat(FileDstPath, Entry->TargetDirectory);
}
else // if (Entry->TargetDirectory[0] != L'\\')
{
/* Path relative to the installation path */
/* Add the installation path */
if (TargetPath != NULL) if (TargetPath != NULL)
{ {
if (TargetPath[0] != L'\\') if (TargetPath[0] != L'\\')
@@ -391,7 +411,10 @@ SetupCommitFileQueueW(
wcscat(FileDstPath, Entry->TargetDirectory); wcscat(FileDstPath, Entry->TargetDirectory);
} }
/* Use only the destination path if the file is in a cabinet */ /*
* If the file is in a cabinet, use only the destination path.
* Otherwise possibly use a different target name.
*/
if (Entry->SourceCabinet == NULL) if (Entry->SourceCabinet == NULL)
{ {
wcscat(FileDstPath, L"\\"); wcscat(FileDstPath, L"\\");
@@ -402,7 +425,7 @@ SetupCommitFileQueueW(
} }
/* FIXME: Do it! */ /* FIXME: Do it! */
DPRINT("'%S' ==> '%S'\n", FileSrcPath, FileDstPath); DPRINT("Copy: '%S' ==> '%S'\n", FileSrcPath, FileDstPath);
MsgHandler(Context, MsgHandler(Context,
SPFILENOTIFY_STARTCOPY, SPFILENOTIFY_STARTCOPY,

View File

@@ -327,7 +327,7 @@ SetupCopyFile(
0); 0);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("NtCreateFile failed: %x\n", Status); DPRINT1("NtCreateFile failed: %x, %wZ\n", Status, &FileName);
goto unmapsrcsec; goto unmapsrcsec;
} }

View File

@@ -3121,7 +3121,8 @@ AddSectionToCopyQueue(HINF InfFile,
PWCHAR FileKeyValue; PWCHAR FileKeyValue;
PWCHAR DirKeyValue; PWCHAR DirKeyValue;
PWCHAR TargetFileName; PWCHAR TargetFileName;
WCHAR CompleteOrigFileName[512]; ULONG Length;
WCHAR CompleteOrigDirName[512];
if (SourceCabinet) if (SourceCabinet)
return AddSectionToCopyQueueCab(InfFile, L"SourceFiles", SourceCabinet, DestinationPath, Ir); return AddSectionToCopyQueueCab(InfFile, L"SourceFiles", SourceCabinet, DestinationPath, Ir);
@@ -3180,14 +3181,35 @@ AddSectionToCopyQueue(HINF InfFile,
break; break;
} }
wcscpy(CompleteOrigFileName, SourceRootDir.Buffer); if ((DirKeyValue[0] == 0) || (DirKeyValue[0] == L'\\' && DirKeyValue[1] == 0))
wcscat(CompleteOrigFileName, L"\\"); {
wcscat(CompleteOrigFileName, DirKeyValue); /* Installation path */
wcscpy(CompleteOrigDirName, SourceRootDir.Buffer);
}
else if (DirKeyValue[0] == L'\\')
{
/* Absolute path */
wcscpy(CompleteOrigDirName, DirKeyValue);
}
else // if (DirKeyValue[0] != L'\\')
{
/* Path relative to the installation path */
wcscpy(CompleteOrigDirName, SourceRootDir.Buffer);
wcscat(CompleteOrigDirName, L"\\");
wcscat(CompleteOrigDirName, DirKeyValue);
}
/* Remove trailing backslash */
Length = wcslen(CompleteOrigDirName);
if ((Length > 0) && (CompleteOrigDirName[Length - 1] == L'\\'))
{
CompleteOrigDirName[Length - 1] = 0;
}
if (!SetupQueueCopy(SetupFileQueue, if (!SetupQueueCopy(SetupFileQueue,
SourceCabinet, SourceCabinet,
SourceRootPath.Buffer, SourceRootPath.Buffer,
CompleteOrigFileName, CompleteOrigDirName,
FileKeyName, FileKeyName,
DirKeyValue, DirKeyValue,
TargetFileName)) TargetFileName))
@@ -3209,7 +3231,7 @@ PrepareCopyPageInfFile(HINF InfFile,
WCHAR PathBuffer[MAX_PATH]; WCHAR PathBuffer[MAX_PATH];
INFCONTEXT DirContext; INFCONTEXT DirContext;
PWCHAR AdditionalSectionName = NULL; PWCHAR AdditionalSectionName = NULL;
PWCHAR KeyValue; PWCHAR DirKeyValue;
ULONG Length; ULONG Length;
NTSTATUS Status; NTSTATUS Status;
@@ -3233,16 +3255,20 @@ PrepareCopyPageInfFile(HINF InfFile,
/* Create directories */ /* Create directories */
/* /*
* FIXME: * FIXME:
* Install directories like '\reactos\test' are not handled yet. * - Install directories like '\reactos\test' are not handled yet.
*/ * - 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 */ /* Get destination path */
wcscpy(PathBuffer, DestinationPath.Buffer); wcscpy(PathBuffer, DestinationPath.Buffer);
/* Remove trailing backslash */ /* Remove trailing backslash */
Length = wcslen(PathBuffer); Length = wcslen(PathBuffer);
if ((Length > 0) && (PathBuffer[Length - 1] == '\\')) if ((Length > 0) && (PathBuffer[Length - 1] == L'\\'))
{ {
PathBuffer[Length - 1] = 0; PathBuffer[Length - 1] = 0;
} }
@@ -3274,27 +3300,35 @@ PrepareCopyPageInfFile(HINF InfFile,
/* Enumerate the directory values and create the subdirectories */ /* Enumerate the directory values and create the subdirectories */
do do
{ {
if (!INF_GetData(&DirContext, NULL, &KeyValue)) if (!INF_GetData(&DirContext, NULL, &DirKeyValue))
{ {
DPRINT1("break\n"); DPRINT1("break\n");
break; break;
} }
if (KeyValue[0] == L'\\' && KeyValue[1] != 0) if ((DirKeyValue[0] == 0) || (DirKeyValue[0] == L'\\' && DirKeyValue[1] == 0))
{ {
DPRINT("Absolute Path: '%S'\n", KeyValue); /* Installation path */
DPRINT("InstallationPath: '%S'\n", DirKeyValue);
wcscpy(PathBuffer, DestinationRootPath.Buffer); wcscpy(PathBuffer, DestinationPath.Buffer);
wcscat(PathBuffer, KeyValue);
DPRINT("FullPath: '%S'\n", PathBuffer); DPRINT("FullPath: '%S'\n", PathBuffer);
} }
else if (KeyValue[0] != L'\\') else if (DirKeyValue[0] == L'\\')
{ {
DPRINT("RelativePath: '%S'\n", KeyValue); /* Absolute path */
wcscpy(PathBuffer, DestinationPath.Buffer); DPRINT("Absolute Path: '%S'\n", DirKeyValue);
wcscat(PathBuffer, L"\\");
wcscat(PathBuffer, KeyValue); wcscpy(PathBuffer, DestinationRootPath.Buffer);
wcscat(PathBuffer, DirKeyValue);
/* Remove trailing backslash */
Length = wcslen(PathBuffer);
if ((Length > 0) && (PathBuffer[Length - 1] == L'\\'))
{
PathBuffer[Length - 1] = 0;
}
DPRINT("FullPath: '%S'\n", PathBuffer); DPRINT("FullPath: '%S'\n", PathBuffer);
@@ -3306,7 +3340,33 @@ PrepareCopyPageInfFile(HINF InfFile,
return FALSE; return FALSE;
} }
} }
} while (SetupFindNextLine (&DirContext, &DirContext)); else // if (DirKeyValue[0] != L'\\')
{
/* Path relative to the installation path */
DPRINT("RelativePath: '%S'\n", DirKeyValue);
wcscpy(PathBuffer, DestinationPath.Buffer);
wcscat(PathBuffer, L"\\");
wcscat(PathBuffer, DirKeyValue);
/* Remove trailing backslash */
Length = wcslen(PathBuffer);
if ((Length > 0) && (PathBuffer[Length - 1] == L'\\'))
{
PathBuffer[Length - 1] = 0;
}
DPRINT("FullPath: '%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; return TRUE;
} }

View File

@@ -13,11 +13,14 @@
[Version] [Version]
Signature = "$ReactOS$" Signature = "$ReactOS$"
; Directories relative to the installation directory.
; For specifying absolute directories, use the SystemPartitionFiles section,
; or use names starting with \.
[Directories] [Directories]
1 = system32 1 = system32
2 = system32\drivers 2 = system32\drivers
3 = Fonts 3 = Fonts
4 = 4 = "\"
5 = system32\drivers\etc 5 = system32\drivers\etc
6 = inf 6 = inf
7 = bin 7 = bin

View File

@@ -1,6 +1,9 @@
[Version] [Version]
Signature = "$ReactOS$" Signature = "$ReactOS$"
; Directories relative to the installation directory.
; For specifying absolute directories, use the SystemPartitionFiles section,
; or use names starting with \.
[Directories] [Directories]
; <directory_id> = <path> ; <directory_id> = <path>
1 = "\" 1 = "\"
@@ -22,6 +25,7 @@ sacdrv.sys=,,,,,,x,,,,,,4
uniata.sys=,,,,,,x,,,,,,4 uniata.sys=,,,,,,x,,,,,,4
buslogic.sys=,,,,,,x,,,,,,4 buslogic.sys=,,,,,,x,,,,,,4
blue.sys=,,,,,,x,,,,,,4 blue.sys=,,,,,,x,,,,,,4
vgafonts.cab=,,,,,,,,,,,,1
bootvid.dll=,,,,,,,,,,,,2 bootvid.dll=,,,,,,,,,,,,2
c_437.nls=,,,,,,,,,,,,2 c_437.nls=,,,,,,,,,,,,2
c_1252.nls=,,,,,,,,,,,,2 c_1252.nls=,,,,,,,,,,,,2
@@ -64,6 +68,8 @@ wmilib.sys=,,,,,,,,,,,,4
ksecdd.sys=,,,,,,,,,,,,4 ksecdd.sys=,,,,,,,,,,,,4
mountmgr.sys=,,,,,,x,,,,,,4 mountmgr.sys=,,,,,,x,,,,,,4
[SystemPartitionFiles]
[HardwareIdsDatabase] [HardwareIdsDatabase]
;*PNP0A00 = isapnp ;*PNP0A00 = isapnp
*PNP0A03 = pci *PNP0A03 = pci