From 6abc59acd204ce59f53b218cafc01ced955695cd Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Wed, 19 Dec 2018 00:34:31 +0100 Subject: Windows MBR Bootloader: workaround for issue affecting creation of hidden OS on some SSD drives (Error 128 while writing MBR). This commit replace the 512 bytes write operations by a 4096 bytes write operation. --- src/Boot/Windows/BootConfig.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Boot/Windows/BootConfig.cpp b/src/Boot/Windows/BootConfig.cpp index 6b28794d..0412d082 100644 --- a/src/Boot/Windows/BootConfig.cpp +++ b/src/Boot/Windows/BootConfig.cpp @@ -85,14 +85,29 @@ ret: BiosResult UpdateBootSectorConfiguration (byte drive) { - AcquireSectorBuffer(); + uint64 mbrSector; + mbrSector.HighPart = 0; + mbrSector.LowPart = 0; + AcquireSectorBuffer(); +/* BiosResult result = ReadWriteMBR (false, drive); if (result != BiosResultSuccess) goto ret; SectorBuffer[TC_BOOT_SECTOR_CONFIG_OFFSET] = BootSectorFlags; result = ReadWriteMBR (true, drive); +*/ + + BiosResult result = ReadWriteSectors (false, TC_BOOT_LOADER_BUFFER_SEGMENT, 0, drive, mbrSector, 8, false); + if (result != BiosResultSuccess) + goto ret; + + CopyMemory (TC_BOOT_LOADER_BUFFER_SEGMENT, 0, SectorBuffer, TC_LB_SIZE); + SectorBuffer[TC_BOOT_SECTOR_CONFIG_OFFSET] = BootSectorFlags; + CopyMemory (SectorBuffer, TC_BOOT_LOADER_BUFFER_SEGMENT,0, TC_LB_SIZE); + + result = ReadWriteSectors (true, TC_BOOT_LOADER_BUFFER_SEGMENT, 0, drive, mbrSector, 8, false); ret: ReleaseSectorBuffer(); -- cgit v1.2.3