示例#1
0
    public void Format(Partition p)
    {
      byte[] aData = p.NewBlockArray(1);
      p.ReadBlock(0, 1U, aData);

      aData[510] = 0xAA;
      aData[511] = 0x55;

      //The number of Bytes per sector (remember, all numbers are in the little-endian format).
      aData[11] = 0x01;
      aData[12] = 0xCA;
      aData[13] = 0x08; //Number of sectors per cluster.
      aData[14] = 0x01;
      aData[15] = 0xFF; //Number of reserved sectors. The boot record sectors are included in this value
      aData[16] = 0x02; //Number of File Allocation Tables (FAT's) on the storage media. Often this value is 2.
      aData[17] = 0x00;
      aData[18] = 0x0f; //Number of directory entries (must be set so that the root directory occupies entire sectors).
      aData[19] = 0xFF;
      aData[20] = 0xFF; //The total sectors in the logical volume. If this value is 0, it means there are more than 65535 sectors in the volume, and the actual count is stored in "Large Sectors (bytes 32-35).
      aData[22] = 0x0F;
      aData[23] = 0xFF; //Number of sectors per FAT. FAT12/FAT16 only.
      p.WriteBlock(0, 1U, aData);
    }
示例#2
0
        public static bool IsDeviceFat(Partition aDevice)
        {
            if (aDevice == null)
            {
                throw new ArgumentNullException(nameof(aDevice));
            }

            var xBPB = aDevice.NewBlockArray(1);
            aDevice.ReadBlock(0UL, 1U, xBPB);
            ushort xSig = xBPB.ToUInt16(510);
            if (xSig != 0xAA55)
            {
                return false;
            }
            return true;
        }
示例#3
0
 public static bool IsDeviceFAT(Partition aDevice)
 {
     byte[] xBPB = aDevice.NewBlockArray(1);
     aDevice.ReadBlock(0UL, 1U, xBPB);
     UInt16 xSig = xBPB.ToUInt16(510);
     if (xSig != 0xAA55)
     {
         return false;
     }
     return true;
 }