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.

This commit is contained in:
Mounir IDRASSI 2018-12-19 00:34:31 +01:00
parent 7ef3d5e369
commit 6abc59acd2
No known key found for this signature in database
GPG Key ID: 02C30AE90FAE4A6F

View File

@ -85,14 +85,29 @@ void ReadBootSectorUserConfiguration ()
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();