Encapsulates an NTFS filesystem.
Inheritance: FileSystem
Esempio n. 1
0
        private MFTRecord(ulong recordNum, FileSystemNTFS fileSystem, byte[] data,
                          MFTLoadDepth loadDepth, string path)
        {
            this.RecordNum         = recordNum;
            this.FileSystem        = fileSystem;
            this.BytesPerSector    = fileSystem.BytesPerSector;
            this.SectorsPerCluster = fileSystem.SectorsPerCluster;
            this.PartitionStream   = fileSystem.Store;

            Valid = true;

            _data = data;
            _path = path;

            Flags = (RecordFlags)BitConverter.ToUInt16(_data, 22);

            if (loadDepth != MFTLoadDepth.None)
            {
                LoadData(loadDepth);
            }
        }
Esempio n. 2
0
        public static MFTRecord Load(ulong recordNum, FileSystemNTFS fileSystem, MFTLoadDepth loadDepth = MFTLoadDepth.Full, string path = "")
        {
            ulong startOffset = recordNum * (ulong)fileSystem.SectorsPerMFTRecord * (ulong)fileSystem.BytesPerSector;

            IDataStream stream;

            //Special case for MFT - can't read itself
            if (recordNum == 0)
            {
                stream = new SubStream(fileSystem.Store, fileSystem.MFTSector * (ulong)fileSystem.BytesPerSector, (ulong)(fileSystem.SectorsPerMFTRecord * fileSystem.BytesPerSector));
            }
            else
            {
                stream = new SubStream(fileSystem.MFT, startOffset, (ulong)(fileSystem.SectorsPerMFTRecord * fileSystem.BytesPerSector));
            }

            // Read the whole record into memory
            byte[] data = stream.GetBytes(0, stream.StreamLength);

            return(new MFTRecord(recordNum, fileSystem, data, loadDepth, path));
        }
		public InvalidFileRecordException(FileSystemNTFS fileSystem, ulong errorOffset, string error)
			: base(fileSystem, errorOffset, string.Format("Error parsing file record at {0}. {1}", errorOffset, error)) {

		}
		public InvalidFileRecordException(FileSystemNTFS fileSystem, ulong errorOffset, string expected, string found)
			: base(fileSystem, errorOffset, string.Format("Error parsing file record at {0}. Expected {1}, found {2}", errorOffset, expected, found)) {

		}
		public NTFSException(FileSystemNTFS fileSystem, ulong errorOffset, string errorMessage)
			: base(errorMessage) {
			_fileSystem = fileSystem;
			_errorOffset = errorOffset;
		}
		private MFTRecord(ulong recordNum, FileSystemNTFS fileSystem, byte[] data,
				MFTLoadDepth loadDepth, string path) {
			this.RecordNum = recordNum;
			this.FileSystem = fileSystem;
			this.BytesPerSector = fileSystem.BytesPerSector;
			this.SectorsPerCluster = fileSystem.SectorsPerCluster;
			this.PartitionStream = fileSystem.Store;

			Valid = true;

			_data = data;
			_path = path;

			Flags = (RecordFlags)BitConverter.ToUInt16(_data, 22);

			if (loadDepth != MFTLoadDepth.None) {
				LoadData(loadDepth);
			}
		}
		public static MFTRecord Load(ulong recordNum, FileSystemNTFS fileSystem, MFTLoadDepth loadDepth = MFTLoadDepth.Full, string path = "") {
			ulong startOffset = recordNum * (ulong)fileSystem.SectorsPerMFTRecord * (ulong)fileSystem.BytesPerSector;

			IDataStream stream;

			//Special case for MFT - can't read itself
			if (recordNum == 0) {
				stream = new SubStream(fileSystem.Store, fileSystem.MFTSector * (ulong)fileSystem.BytesPerSector, (ulong)(fileSystem.SectorsPerMFTRecord * fileSystem.BytesPerSector));
			} else {
				stream = new SubStream(fileSystem.MFT, startOffset, (ulong)(fileSystem.SectorsPerMFTRecord * fileSystem.BytesPerSector));
			}

			// Read the whole record into memory
			byte[] data = stream.GetBytes(0, stream.StreamLength);

			return new MFTRecord(recordNum, fileSystem, data, loadDepth, path);
		}