From bf347a92d8f780b567972c87776f1cbb445bcf7d Mon Sep 17 00:00:00 2001 From: neil Date: Sat, 7 Mar 2009 16:28:13 +0000 Subject: [PATCH] Check if volumes are bootable by checking whether C/Shell is compatible with kernel. git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@30789 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- rom/dosboot/dosboot_init.c | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/rom/dosboot/dosboot_init.c b/rom/dosboot/dosboot_init.c index fd9c07850..fc167ee49 100644 --- a/rom/dosboot/dosboot_init.c +++ b/rom/dosboot/dosboot_init.c @@ -1,12 +1,12 @@ /* - Copyright 1995-2008, The AROS Development Team. All rights reserved. + Copyright � 1995-2009, The AROS Development Team. All rights reserved. $Id: dosboot_init.c 30220 2009-01-04 22:38:44Z schulz $ Desc: Start up the ol' Dos boot process. Lang: english */ -#define AROS_BOOT_CHECKSIG +//#define AROS_BOOT_CHECKSIG #define DOSBOOT_DISCINSERT_SCREENPRINT # define DEBUG 0 @@ -136,7 +136,7 @@ static BOOL __dosboot_Mount(struct DeviceNode *dn, struct DosLibrary * DOSBase) static BOOL __dosboot_IsBootable(CONST_STRPTR deviceName, struct DosLibrary * DOSBase) { BOOL result = FALSE; - BPTR lock; + BPTR lock, seglist; STRPTR buffer; LONG bufferLength; struct InfoData info; @@ -197,41 +197,34 @@ static BOOL __dosboot_IsBootable(CONST_STRPTR deviceName, struct DosLibrary * DO lock = NULL; #else -#define STARTUP_SEQUENCE_FILE ":C/Shell" +#define SHELL_FILE ":C/Shell" - bufferLength = strlen(deviceName) + sizeof(STARTUP_SEQUENCE_FILE) + 1; + bufferLength = strlen(deviceName) + sizeof(SHELL_FILE) + 1; - if ((buffer = AllocMem(bufferLength, MEMF_ANY)) == NULL) + if ((buffer = AllocMem(bufferLength, MEMF_PUBLIC)) == NULL) { Alert(AT_DeadEnd | AG_NoMemory | AN_DOSLib); } strcpy(buffer, deviceName); - strcat(buffer, STARTUP_SEQUENCE_FILE); - - D(bug("[DOSBoot] __dosboot_IsBootable: Trying to get a lock on '%s'\n", buffer)); + strcat(buffer, SHELL_FILE); - if ((lock = Lock(buffer, SHARED_LOCK)) == 0) - { - D(bug("[DOSBoot] __dosboot_IsBootable: could not lock '%s'\n", buffer)); - goto cleanup; - } + D(bug("[DOSBoot] __dosboot_IsBootable: " + "Trying to load '%s' as an executable\n", buffer)); - if (!Info(lock, &info)) + if ((seglist = LoadSeg(buffer)) == (BPTR)NULL) { - D(bug("[DOSBoot] __dosboot_IsBootable: could not get info on '%s'\n", buffer)); - goto cleanup; + D(bug("[DOSBoot] __dosboot_IsBootable: could not load '%s'\n", buffer)); } - - if (info.id_DiskType != ID_NO_DISK_PRESENT) + else { + UnLoadSeg(seglist); result = TRUE; } #endif cleanup: if (buffer != NULL ) FreeMem(buffer, bufferLength); - if (lock != 0 ) UnLock(lock); return result; } -- 2.11.4.GIT