public void Setup(ATABlockDevice hd, byte *aMBR)
 {
     partitions = new List <ATAPartition>(4);
     ParsePartition(0, hd, aMBR, 446);
     ParsePartition(1, hd, aMBR, 462);
     ParsePartition(2, hd, aMBR, 478);
     ParsePartition(3, hd, aMBR, 494);
 }
Exemple #2
0
        public static void DetectDrive(ControllerIdEnum aControllerID, BusPositionEnum aBusPosition)
        {
            var dev = new ATABlockDevice(aControllerID == ControllerIdEnum.Primary, aControllerID, aBusPosition);

            if (dev.Exists)
            {
                ATABlockDevices.Add(dev);
            }
        }
            public void ParsePartition(uint no, ATABlockDevice hd, byte *aMBR, uint aLoc)
            {
                var  info      = (PartitionTableEntry *)(uint)aMBR;
                byte xSystemID = aMBR[aLoc + 4];

                EBRLocation = 0;
                if (xSystemID == 0x5 || xSystemID == 0xF || xSystemID == 0x85)
                {
                    EBRLocation = Utils.ToUInt32(aMBR, aLoc + 8);
                }
                else if (xSystemID != 0)
                {
                    uint xStartSector = Utils.ToUInt32(aMBR, aLoc + 8);
                    uint xSectorCount = Utils.ToUInt32(aMBR, aLoc + 12);

                    ATAPartition xPartInfo = new ATAPartition(hd, xStartSector, xSectorCount, no);
                    partitions.Add(xPartInfo);
                }
            }