Index: branches/rewrite/i386/modules/Disk/include/FDiskPartition.hpp =================================================================== --- branches/rewrite/i386/modules/Disk/include/FDiskPartition.hpp (revision 1090) +++ branches/rewrite/i386/modules/Disk/include/FDiskPartition.hpp (revision 1091) @@ -16,6 +16,10 @@ ~FDiskPartition(); protected: + bool isMBRDisk(); + + struct disk_blk0 mLBA0; + struct fdisk_part* mFdiskEntry; private: }; Index: branches/rewrite/i386/modules/Disk/FDiskPartition.cpp =================================================================== --- branches/rewrite/i386/modules/Disk/FDiskPartition.cpp (revision 1090) +++ branches/rewrite/i386/modules/Disk/FDiskPartition.cpp (revision 1091) @@ -4,7 +4,7 @@ */ #include - + FDiskPartition::FDiskPartition(Disk* disk, UInt8 partitionNumber) : Partition(disk, partitionNumber) { mDisk = disk; @@ -12,9 +12,42 @@ mBeginSector = 0; mPartitionNumber = partitionNumber; mNumPartitions = 0; + mFdiskEntry = NULL; + + if(mDisk) + { + // read in lba0, this contains the partition map if it's FDisk / MBR + mDisk->Read(0, 1, (UInt8*)&mLBA0); + + if(isMBRDisk()) + { + // Determine number of partition. TODO: Extended partitions + UInt8 i = 0; + for(i = 0; i < DISK_NPART; i++) + { + if(mLBA0.parts[i].systid != 0) + { + if(mPartitionNumber == mNumPartitions) mFdiskEntry = &mLBA0.parts[i]; + mNumPartitions++; + } + + } + + if(mFdiskEntry) + { + mNumSectors = mFdiskEntry->numsect; + mBeginSector = mFdiskEntry->relsect; + } + } + } } FDiskPartition::~FDiskPartition() { + +} -} \ No newline at end of file +bool FDiskPartition::isMBRDisk() +{ + return mLBA0.signature == DISK_SIGNATURE; +}