From e9084a75c4be45e2beb4cf7dad0d08c7f9d18ab5 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sun, 16 Nov 2003 13:45:42 +0000 Subject: [PATCH] Support boot images larger than one sector (2048 bytes). svn path=/trunk/; revision=6660 --- reactos/tools/cdmake/cdmake.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/reactos/tools/cdmake/cdmake.c b/reactos/tools/cdmake/cdmake.c index 6e9119a9575..cc7d30a8217 100644 --- a/reactos/tools/cdmake/cdmake.c +++ b/reactos/tools/cdmake/cdmake.c @@ -1,4 +1,4 @@ -/* $Id: cdmake.c,v 1.6 2003/07/30 14:08:16 royce Exp $ */ +/* $Id: cdmake.c,v 1.7 2003/11/16 13:45:42 ekohl Exp $ */ /* CD-ROM Maker by Philip J. Erdelsky pje@acm.org @@ -147,6 +147,8 @@ char bootimage[512]; BOOL eltorito; DWORD boot_catalog_sector; DWORD boot_image_sector; +WORD boot_image_size; // counted in 512 byte sectors + /*----------------------------------------------------------------------------- This function edits a 32-bit unsigned number into a comma-delimited form, such @@ -1064,8 +1066,8 @@ static void pass(void) write_big_endian_word(0); // load segment = default (0x07c0) write_byte(0); // partition type write_byte(0); // unused - write_little_endian_word(4); // sector count - write_little_endian_dword(boot_image_sector); // sector count + write_little_endian_word(boot_image_size); // sector count + write_little_endian_dword(boot_image_sector); // sector fill_sector(); } @@ -1081,6 +1083,9 @@ static void pass(void) fseek(file, 0, SEEK_END); size = ftell(file); fseek(file, 0, SEEK_SET); + if (size == 0 || (size % 2048)) + error_exit("Invalid boot image size (%lu bytes)\n", size); + boot_image_size = size / 512; while (size > 0) { n = BUFFER_SIZE - cd.count;