diff --git a/freeldr/freeldr/CHANGELOG b/freeldr/freeldr/CHANGELOG index dfd92706eb1..c8bd44e9c5a 100644 --- a/freeldr/freeldr/CHANGELOG +++ b/freeldr/freeldr/CHANGELOG @@ -1,3 +1,8 @@ +Changes in v1.8.1 (1/20/2003) (ekohl) + +- Fixed the ISO filesystem detection code. +- Removed IsSetupLdr. + Changes in v1.8 (1/18/2003) (brianp) - Added F8 options menu diff --git a/freeldr/freeldr/arch/i386/i386disk.c b/freeldr/freeldr/arch/i386/i386disk.c index 9f05a9cf038..0fb78581ad9 100644 --- a/freeldr/freeldr/arch/i386/i386disk.c +++ b/freeldr/freeldr/arch/i386/i386disk.c @@ -53,7 +53,7 @@ BOOL DiskReadLogicalSectors(U32 DriveNumber, U64 SectorNumber, U32 SectorCount, // If so then check to see if Int13 extensions work // If they do then use them, otherwise default back to BIOS calls // - if ((DriveNumber >= 0x80) && (IsSetupLdr || DiskInt13ExtensionsSupported(DriveNumber))) + if ((DriveNumber >= 0x80) && DiskInt13ExtensionsSupported(DriveNumber)) { DbgPrint((DPRINT_DISK, "Using Int 13 Extensions for read. DiskInt13ExtensionsSupported(%d) = %s\n", DriveNumber, DiskInt13ExtensionsSupported(DriveNumber) ? "TRUE" : "FALSE")); @@ -336,11 +336,13 @@ BOOL DiskInt13ExtensionsSupported(U32 DriveNumber) // CF set on error (extensions not supported) return FALSE; } + if (RegsOut.w.bx != 0xAA55) { // BX = AA55h if installed return FALSE; } + if (!(RegsOut.w.cx & 0x01)) { // CX = API subset support bitmap diff --git a/freeldr/freeldr/bootmgr.c b/freeldr/freeldr/bootmgr.c index b654897daa0..7ccd8ece0f4 100644 --- a/freeldr/freeldr/bootmgr.c +++ b/freeldr/freeldr/bootmgr.c @@ -35,7 +35,6 @@ #include #include -BOOL IsSetupLdr = FALSE; VOID RunLoader(VOID) { diff --git a/freeldr/freeldr/disk/disk.c b/freeldr/freeldr/disk/disk.c index ff5281f3b85..c2e3a9f66c2 100644 --- a/freeldr/freeldr/disk/disk.c +++ b/freeldr/freeldr/disk/disk.c @@ -95,52 +95,6 @@ BOOL DiskIsDriveRemovable(U32 DriveNumber) return TRUE; } - -BOOL DiskIsDriveCdRom(U32 DriveNumber) -{ - PUCHAR Sector = (PUCHAR)DISKREADBUFFER; - - // FIXME: - // I need to move this code to somewhere else - // probably in the file system code. - // I don't like the fact that the disk code - // reads the on-disk structures to determine - // if it's a CD-ROM drive. Only the file system - // should interpret on-disk data. - // The disk code should use some other method - // to determine if it's a CD-ROM drive. - - // Hard disks use drive numbers >= 0x80 - // So if the drive number indicates a hard disk - // then return FALSE - // - // We first check if we are running as a SetupLoader - // If so then we are probably booting from a CD-ROM - // So we shouldn't call i386DiskInt13ExtensionsSupported() - // because apparently it screws up some BIOSes - if ((DriveNumber >= 0x80) && (IsSetupLdr || DiskInt13ExtensionsSupported(DriveNumber))) - { - - // We are a CD-ROM drive so we should only - // use the extended Int13 disk functions - if (!DiskReadLogicalSectorsLBA(DriveNumber, 16, 1, Sector)) - { - DiskError("Disk read error.", 0); - return FALSE; - } - - return (Sector[0] == 1 && - Sector[1] == 'C' && - Sector[2] == 'D' && - Sector[3] == '0' && - Sector[4] == '0' && - Sector[5] == '1'); - } - - // Drive is not CdRom so return FALSE - return FALSE; -} - // This function is in arch/i386/i386disk.c //VOID DiskStopFloppyMotor(VOID) diff --git a/freeldr/freeldr/fs/fs.c b/freeldr/freeldr/fs/fs.c index 5bfe4314ff2..18ff19cdd02 100644 --- a/freeldr/freeldr/fs/fs.c +++ b/freeldr/freeldr/fs/fs.c @@ -78,9 +78,8 @@ BOOL FsOpenVolume(U32 DriveNumber, U32 PartitionNumber) return FatOpenVolume(DriveNumber, 0); } - // Check and see if it is a cdrom drive - // If so then just assume ISO9660 file system type - if (DiskIsDriveCdRom(DriveNumber)) + // Check for ISO9660 file system type + if (DriveNumber > 0x80 && IsIsoFs(DriveNumber)) { DbgPrint((DPRINT_FILESYSTEM, "Drive is a cdrom drive. Assuming ISO-9660 file system.\n")); diff --git a/freeldr/freeldr/fs/iso.c b/freeldr/freeldr/fs/iso.c index 2c31212effa..c9c4be62dfb 100644 --- a/freeldr/freeldr/fs/iso.c +++ b/freeldr/freeldr/fs/iso.c @@ -37,6 +37,25 @@ static U32 IsoRootLength; // Length of the root directory U32 IsoDriveNumber = 0; +BOOL IsIsoFs(U32 DriveNumber) +{ + PUCHAR Sector = (PUCHAR)DISKREADBUFFER; + + if (!DiskReadLogicalSectorsLBA(DriveNumber, 16, 1, Sector)) + { + FileSystemError("Failed to read the PVD."); + return FALSE; + } + + return (Sector[0] == 1 && + Sector[1] == 'C' && + Sector[2] == 'D' && + Sector[3] == '0' && + Sector[4] == '0' && + Sector[5] == '1'); +} + + BOOL IsoOpenVolume(U32 DriveNumber) { PPVD Pvd = (PPVD)DISKREADBUFFER; @@ -49,7 +68,7 @@ BOOL IsoOpenVolume(U32 DriveNumber) IsoRootSector = 0; IsoRootLength = 0; - if (!DiskReadLogicalSectors(DriveNumber, 16, 1, Pvd)) + if (!DiskReadLogicalSectorsLBA(DriveNumber, 16, 1, Pvd)) { FileSystemError("Failed to read the PVD."); return FALSE; @@ -160,7 +179,7 @@ static PVOID IsoBufferDirectory(U32 DirectoryStartSector, U32 DirectoryLength) // for (i = 0, Ptr = DirectoryBuffer; i < SectorCount; i++, Ptr += SECTORSIZE) { - if (!DiskReadLogicalSectors(IsoDriveNumber, DirectoryStartSector + i, 1, (PVOID)DISKREADBUFFER)) + if (!DiskReadLogicalSectorsLBA(IsoDriveNumber, DirectoryStartSector + i, 1, (PVOID)DISKREADBUFFER)) { MmFreeMemory(DirectoryBuffer); return NULL; @@ -372,7 +391,7 @@ BOOL IsoReadFile(FILE *FileHandle, U32 BytesToRead, U32* BytesRead, PVOID Buffer // // Now do the read and update BytesRead, BytesToRead, FilePointer, & Buffer // - if (!DiskReadLogicalSectors(IsoDriveNumber, SectorNumber, 1, (PVOID)DISKREADBUFFER)) + if (!DiskReadLogicalSectorsLBA(IsoDriveNumber, SectorNumber, 1, (PVOID)DISKREADBUFFER)) { return FALSE; } @@ -403,7 +422,7 @@ BOOL IsoReadFile(FILE *FileHandle, U32 BytesToRead, U32* BytesRead, PVOID Buffer // // Now do the read and update BytesRead, BytesToRead, FilePointer, & Buffer // - if (!DiskReadLogicalSectors(IsoDriveNumber, SectorNumber, 1, (PVOID)DISKREADBUFFER)) + if (!DiskReadLogicalSectorsLBA(IsoDriveNumber, SectorNumber, 1, (PVOID)DISKREADBUFFER)) { return FALSE; } @@ -430,7 +449,7 @@ BOOL IsoReadFile(FILE *FileHandle, U32 BytesToRead, U32* BytesRead, PVOID Buffer // // Now do the read and update BytesRead, BytesToRead, FilePointer, & Buffer // - if (!DiskReadLogicalSectors(IsoDriveNumber, SectorNumber, 1, (PVOID)DISKREADBUFFER)) + if (!DiskReadLogicalSectorsLBA(IsoDriveNumber, SectorNumber, 1, (PVOID)DISKREADBUFFER)) { return FALSE; } diff --git a/freeldr/freeldr/fs/iso.h b/freeldr/freeldr/fs/iso.h index feaa1b57896..c6538288c23 100644 --- a/freeldr/freeldr/fs/iso.h +++ b/freeldr/freeldr/fs/iso.h @@ -105,6 +105,7 @@ typedef struct } ISO_FILE_INFO, * PISO_FILE_INFO; +BOOL IsIsoFs(U32 DriveNumber); BOOL IsoOpenVolume(U32 DriveNumber); FILE* IsoOpenFile(PUCHAR FileName); BOOL IsoReadFile(FILE *FileHandle, U32 BytesToRead, U32* BytesRead, PVOID Buffer); diff --git a/freeldr/freeldr/include/disk.h b/freeldr/freeldr/include/disk.h index 8cf9e3f9161..7f104f50a69 100644 --- a/freeldr/freeldr/include/disk.h +++ b/freeldr/freeldr/include/disk.h @@ -109,7 +109,6 @@ PUCHAR DiskGetErrorCodeString(U32 ErrorCode); BOOL DiskGetDriveGeometry(U32 DriveNumber, PGEOMETRY DriveGeometry); BOOL DiskReadLogicalSectors(U32 DriveNumber, U64 SectorNumber, U32 SectorCount, PVOID Buffer); // Implemented in i386disk.c BOOL DiskIsDriveRemovable(U32 DriveNumber); -BOOL DiskIsDriveCdRom(U32 DriveNumber); VOID DiskStopFloppyMotor(VOID); // Implemented in i386disk.c U32 DiskGetCacheableBlockCount(U32 DriveNumber); // Implemented in i386disk.c diff --git a/freeldr/freeldr/include/freeldr.h b/freeldr/freeldr/include/freeldr.h index 40303cd3c65..76ca59fcb88 100644 --- a/freeldr/freeldr/include/freeldr.h +++ b/freeldr/freeldr/include/freeldr.h @@ -68,7 +68,6 @@ typedef S64 __s64; extern U32 BootDrive; // BIOS boot drive, 0-A:, 1-B:, 0x80-C:, 0x81-D:, etc. extern U32 BootPartition; // Boot Partition, 1-4 extern BOOL UserInterfaceUp; // Tells us if the user interface is displayed -extern BOOL IsSetupLdr; void BootMain(void); VOID RunLoader(VOID); diff --git a/freeldr/freeldr/include/version.h b/freeldr/freeldr/include/version.h index 1956b579df0..5b13e8cc04b 100644 --- a/freeldr/freeldr/include/version.h +++ b/freeldr/freeldr/include/version.h @@ -22,7 +22,7 @@ /* just some stuff */ -#define VERSION "FreeLoader v1.8" +#define VERSION "FreeLoader v1.8.1" #define COPYRIGHT "Copyright (C) 1998-2003 Brian Palmer " #define AUTHOR_EMAIL "" #define BY_AUTHOR "by Brian Palmer" @@ -36,7 +36,7 @@ // #define FREELOADER_MAJOR_VERSION 1 #define FREELOADER_MINOR_VERSION 8 -#define FREELOADER_PATCH_VERSION 0 +#define FREELOADER_PATCH_VERSION 1 PUCHAR GetFreeLoaderVersionString(VOID); diff --git a/freeldr/freeldr/reactos/setupldr.c b/freeldr/freeldr/reactos/setupldr.c index 7e3cc5faca7..43a5c0b0b22 100644 --- a/freeldr/freeldr/reactos/setupldr.c +++ b/freeldr/freeldr/reactos/setupldr.c @@ -31,7 +31,6 @@ #include "registry.h" #include "hwdetect.h" -BOOL IsSetupLdr = TRUE; static BOOL LoadKernel(PCHAR szFileName)