https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bd9fa3d701bc11a5a59d07...
commit bd9fa3d701bc11a5a59d07c7be4f879565209312 Author: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org AuthorDate: Thu Oct 18 22:58:48 2018 +0200 Commit: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org CommitDate: Thu Oct 18 23:11:58 2018 +0200
[USETUP] Add a couple of missing TrimTrailingPathSeparators_UStr() calls.
Fixes in particular a regression brought by 57402ee (thanks George Bisoc for having noticed this), where the BTRFS bootsector code could not be installed anymore.
CORE-15192 --- base/setup/usetup/bootsup.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/base/setup/usetup/bootsup.c b/base/setup/usetup/bootsup.c index 7969e8bae9..7fd723c33a 100644 --- a/base/setup/usetup/bootsup.c +++ b/base/setup/usetup/bootsup.c @@ -811,8 +811,9 @@ InstallMbrBootCodeToDisk( /* Free the original boot sector */ RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
- /* Write new bootsector to RootPath */ + /* Open the root partition - Remove any trailing backslash if needed */ RtlInitUnicodeString(&Name, RootPath); + TrimTrailingPathSeparators_UStr(&Name);
InitializeObjectAttributes(&ObjectAttributes, &Name, @@ -833,6 +834,7 @@ InstallMbrBootCodeToDisk( return Status; }
+ /* Write new bootsector to RootPath */ FileOffset.QuadPart = 0ULL; Status = NtWriteFile(FileHandle, NULL, @@ -970,8 +972,9 @@ InstallFat12BootCodeToFloppy( /* Free the original boot sector */ RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
- /* Write new bootsector to RootPath */ + /* Open the root partition - Remove any trailing backslash if needed */ RtlInitUnicodeString(&Name, RootPath); + TrimTrailingPathSeparators_UStr(&Name);
InitializeObjectAttributes(&ObjectAttributes, &Name, @@ -992,6 +995,7 @@ InstallFat12BootCodeToFloppy( return Status; }
+ /* Write new bootsector to RootPath */ FileOffset.QuadPart = 0ULL; Status = NtWriteFile(FileHandle, NULL, @@ -1529,8 +1533,8 @@ InstallFat32BootCodeToDisk( static NTSTATUS InstallBtrfsBootCodeToDisk( - PWSTR SrcPath, - PWSTR RootPath) + IN PCWSTR SrcPath, + IN PCWSTR RootPath) { NTSTATUS Status; UNICODE_STRING Name; @@ -1651,8 +1655,9 @@ InstallBtrfsBootCodeToDisk( // RtlFreeHeap(ProcessHeap, 0, OrigBootSector); #endif
- /* Write new bootsector to RootPath */ + /* Open the root partition - Remove any trailing backslash if needed */ RtlInitUnicodeString(&Name, RootPath); + TrimTrailingPathSeparators_UStr(&Name);
InitializeObjectAttributes(&ObjectAttributes, &Name, @@ -1684,7 +1689,6 @@ InstallBtrfsBootCodeToDisk( 0, &PartInfo, sizeof(PartInfo)); - if (!NT_SUCCESS(Status)) { DPRINT1("IOCTL_DISK_GET_PARTITION_INFO_EX failed (Status %lx)\n", Status); @@ -1693,6 +1697,8 @@ InstallBtrfsBootCodeToDisk( return Status; }
+ /* Write new bootsector to RootPath */ + NewBootSector->PartitionStartLBA = PartInfo.StartingOffset.QuadPart / SECTORSIZE;
/* Write sector 0 */