Пример #1
0
 public static void SaveBFSTOC(string drive)
 {
     //write  BFSTOC
     llda.WriteSector(drive, 5, 4096, bfsTOC.ToByteArray());
     //write mirror BFSTOC
     llda.WriteSector(drive, 6 + (Int64)bfsTOC.diskspace, 4096, bfsTOC.ToByteArray());
 }
Пример #2
0
        public static void FormatDriveGPT(string drive, UInt64 totalSectors, UInt32 bytesPerSector, UInt64 id)
        {
            //create GPT
            GPT gpt = new GPT(totalSectors, bytesPerSector);

            byte[] test = gpt.ToByteArray();
            //create BFSTOC
            BFSTOC bfsTOC = BFSTOC.emptyToc(totalSectors, bytesPerSector, true);

            bfsTOC.id = id;
            //write GPT
            llda.WriteSector(drive, 0, 4096, gpt.ToByteArray());
            //write MirrorGPT
            gpt.ToggleMirror();
            llda.WriteSector(drive, (Int64)totalSectors - 40, 512, gpt.ToGPTMirrorByteArray());
            //write  BFSTOC
            llda.WriteSector(drive, 5, 4096, bfsTOC.ToByteArray());
            //write mirror BFSTOC
            llda.WriteSector(drive, 6 + (Int64)bfsTOC.diskspace, 4096, bfsTOC.ToByteArray());
            //trigger OS partition table re-read
            llda.refreshDrive(drive);
        }