From 22152878f883cb7d1e9ac56a5f59329afd26302b Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sat, 12 Sep 2015 23:46:56 +0200 Subject: [PATCH] Windows Bootloader: pass correct compressed data size to decompressor and use shorter string to keep a valid memory layout for boot sector. --- src/Boot/Windows/BootSector.asm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Boot/Windows/BootSector.asm b/src/Boot/Windows/BootSector.asm index eb4418fa..1e0df327 100644 --- a/src/Boot/Windows/BootSector.asm +++ b/src/Boot/Windows/BootSector.asm @@ -106,7 +106,7 @@ non_backup: call checksum ; Verify checksum - cmp ebx, dword ptr [start + TC_BOOT_SECTOR_LOADER_CHECKSUM_OFFSET] + cmp ebx, dword ptr [start + TC_BOOT_SECTOR_LOADER_CHECKSUM_OFFSET] je checksum_ok ; Checksum incorrect - try using backup if available @@ -139,6 +139,7 @@ checksum_ok: ; Decompress boot loader mov cx, word ptr [start + TC_BOOT_SECTOR_LOADER_LENGTH_OFFSET] + sub cx, TC_GZIP_HEADER_SIZE push cx ; Compressed data size push TC_BOOT_LOADER_COMPRESSED_BUFFER_OFFSET + TC_GZIP_HEADER_SIZE ; Compressed data push TC_MAX_BOOT_LOADER_DECOMPRESSED_SIZE ; Output buffer size @@ -234,7 +235,7 @@ checksum: backup_loader_used db 0 disk_error_msg db 'Disk error', 13, 10, 7, 0 -loader_damaged_msg db 7, 'Loader damaged! Use Rescue Disk: Repair Options > Restore', 0 +loader_damaged_msg db 7, 'Loader damaged! Repair with Rescue Disk', 0 ORG 7C00h + 510 dw 0AA55h ; Boot sector signature