internal static byte[] GetBytes(string volume, FatVolumeBootRecord vbr)
        {
            long DirectoryEntryOffset = vbr.ReservedSectors * vbr.BytesPerSector;

            //return Helper.readDrive(volume, DirectoryEntryOffset, (vbr.SectorsPerFat * vbr.BytesPerSector));
            return(null);
        }
예제 #2
0
        public static FileAllocationTableEntry Get(string volume, int sector)
        {
            FatVolumeBootRecord vbr = VolumeBootRecord.Get(volume) as FatVolumeBootRecord;

            byte[] bytes = FileAllocationTable.GetBytes(volume, vbr);

            int endSector = 0;

            switch (vbr.FatType)
            {
            case "FAT12":
                endSector = parseFat12(bytes, sector);
                break;

            case "FAT16":
                endSector = parseFat16(bytes, sector);
                break;

            case "FAT32":
                endSector = parseFat32(bytes, sector);
                break;
            }

            return(new FileAllocationTableEntry(sector, endSector));
        }
예제 #3
0
        private static DirectoryEntry[] GetRootDirectory(string volume)
        {
            string volLetter = Helper.GetVolumeLetter(volume);

            FatVolumeBootRecord vbr = VolumeBootRecord.Get(volume) as FatVolumeBootRecord;

            uint FirstRootDirSecNum = vbr.ReservedSectors + (vbr.BPB_NumberOfFATs * vbr.BPB_FatSize32);

            byte[] bytes = DD.Get(volume, vbr.BytesPerSector * FirstRootDirSecNum, vbr.BytesPerSector, 2);

            return(GetInstances(bytes, volume, volLetter));
        }
예제 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public byte[] GetContent()
        {
            FatVolumeBootRecord vbr = VolumeBootRecord.Get(this.Volume) as FatVolumeBootRecord;

            int RootDirSectors = ((vbr.BPB_RootEntryCount * 32) + (vbr.BytesPerSector - 1)) / vbr.BytesPerSector;

            uint FatSize = 0;

            if (vbr.BPB_FatSize16 != 0)
            {
                FatSize = vbr.BPB_FatSize16;
            }
            else
            {
                FatSize = vbr.BPB_FatSize32;
            }

            uint FirstDataSector = (uint)(vbr.ReservedSectors + (vbr.BPB_NumberOfFATs * FatSize) + RootDirSectors);

            uint FirstSectorofCluster = ((this.FirstCluster - 2) * vbr.SectorsPerCluster) + FirstDataSector;

            byte[] bytes = DD.Get(this.Volume, (long)FirstSectorofCluster * (long)vbr.BytesPerSector, vbr.BytesPerSector, 1);

            if (this.Directory)
            {
                return(bytes);
            }
            else
            {
                if (this.FileSize <= bytes.Length)
                {
                    return(Helper.GetSubArray(bytes, 0, this.FileSize));
                }
                else
                {
                    // Need to do more...
                    return(bytes);
                }
            }
        }
예제 #5
0
        public static FileSystemInformation Get(string volume)
        {
            FatVolumeBootRecord vbr = VolumeBootRecord.Get(volume) as FatVolumeBootRecord;

            return(new FileSystemInformation(DD.Get(volume, (vbr.BytesPerSector * vbr.BPB_FileSytemInfo), vbr.BytesPerSector, 1)));
        }