diff options
-rw-r--r-- | com32/modules/chain.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/com32/modules/chain.c b/com32/modules/chain.c index 1ae20d4a..c5154888 100644 --- a/com32/modules/chain.c +++ b/com32/modules/chain.c @@ -455,6 +455,7 @@ static void do_boot(void *boot_sector, size_t boot_size, uint8_t swapdrive = driveno & 0x80; int i; addr_t loadbase = opt.seg ? (opt.seg << 4) : 0x7c00; + static const char cmldr_signature[8] = "cmdcons"; mmap = syslinux_memory_map(); @@ -470,10 +471,21 @@ static void do_boot(void *boot_sector, size_t boot_size, endimage = loadbase + boot_size; - if (syslinux_add_movelist - (&mlist, loadbase, (addr_t) boot_sector, boot_size)) + if (syslinux_add_movelist(&mlist, loadbase, + (addr_t) boot_sector, boot_size)) goto enomem; + /* + * To boot the Recovery Console of Windows NT/2K/XP we need to write + * the string "cmdcons\0" to memory location 0000:7C03. + * Memory location 0000:7C00 contains the bootsector of the partition. + */ + if (opt.cmldr) { + if (syslinux_add_movelist(&mlist, 0x7c03, (addr_t)cmldr_signature, + sizeof cmldr_signature)) + goto enomem; + } + if (opt.swap && driveno != swapdrive) { static const uint8_t swapstub_master[] = { /* The actual swap code */ @@ -886,13 +898,6 @@ int main(int argc, char *argv[]) } } - /* To boot the Recovery Console of Windows NT/2K/XP we need to write - the string "cmdcons\0" to memory location 0000:7C03. - Memory location 0000:7C00 contains the bootsector of the partition. - */ - if (opt.cmldr) - strcpy((char *) 0x7c03, "cmdcons"); - } else if (partinfo) { /* Actually read the boot sector */ /* Pick the first buffer that isn't already in use */ |