private void ReadSecurityDescriptors() { LittleEndianDataReader reader = new LittleEndianDataReader(_metaDataStream); long startPos = reader.Position; uint totalLength = reader.ReadUInt32(); uint numEntries = reader.ReadUInt32(); ulong[] sdLengths = new ulong[numEntries]; for (uint i = 0; i < numEntries; ++i) { sdLengths[i] = reader.ReadUInt64(); } _securityDescriptors = new List <RawSecurityDescriptor>((int)numEntries); for (uint i = 0; i < numEntries; ++i) { _securityDescriptors.Add(new RawSecurityDescriptor(reader.ReadBytes((int)sdLengths[i]), 0)); } if (reader.Position < startPos + totalLength) { reader.Skip((int)(startPos + totalLength - reader.Position)); } _rootDirPos = Utilities.RoundUp(startPos + totalLength, 8); }
private void ReadMetaData(Stream stream) { LittleEndianDataReader reader = new LittleEndianDataReader(stream); ReadSecurityDescriptors(reader); ReadDirectories(reader); }
private void ReadDirectories(LittleEndianDataReader reader) { _directories = new Dictionary <long, List <DirectoryEntry> >(); long dirId = 0; while (reader.Position < reader.Length) { List <DirectoryEntry> dir = new List <DirectoryEntry>(); DirectoryEntry entry = DirectoryEntry.ReadFrom(reader); while (entry != null) { dir.Add(entry); entry = DirectoryEntry.ReadFrom(reader); } _directories.Add(dirId, dir); dirId = reader.Position; } }
private List <DirectoryEntry> GetDirectory(long id) { List <DirectoryEntry> dir = _dirCache[id]; if (dir == null) { _metaDataStream.Position = (id == 0) ? _rootDirPos : id; LittleEndianDataReader reader = new LittleEndianDataReader(_metaDataStream); dir = new List <DirectoryEntry>(); DirectoryEntry entry = DirectoryEntry.ReadFrom(reader); while (entry != null) { dir.Add(entry); entry = DirectoryEntry.ReadFrom(reader); } _dirCache[id] = dir; } return(dir); }
private void ReadSecurityDescriptors(LittleEndianDataReader reader) { long startPos = reader.Position; uint totalLength = reader.ReadUInt32(); uint numEntries = reader.ReadUInt32(); ulong[] sdLengths = new ulong[numEntries]; for (uint i = 0; i < numEntries; ++i) { sdLengths[i] = reader.ReadUInt64(); } _securityDescriptors = new List<RawSecurityDescriptor>((int)numEntries); for (uint i = 0; i < numEntries; ++i) { _securityDescriptors.Add(new RawSecurityDescriptor(reader.ReadBytes((int)sdLengths[i]), 0)); } if (reader.Position < startPos + totalLength) { reader.Skip((int)(startPos + totalLength - reader.Position)); } }
private void ReadDirectories(LittleEndianDataReader reader) { _directories = new Dictionary<long, List<DirectoryEntry>>(); long dirId = 0; while (reader.Position < reader.Length) { List<DirectoryEntry> dir = new List<DirectoryEntry>(); DirectoryEntry entry = DirectoryEntry.ReadFrom(reader); while (entry != null) { dir.Add(entry); entry = DirectoryEntry.ReadFrom(reader); } _directories.Add(dirId, dir); dirId = reader.Position; } }
private List<DirectoryEntry> GetDirectory(long id) { List<DirectoryEntry> dir = _dirCache[id]; if (dir == null) { _metaDataStream.Position = (id == 0) ? _rootDirPos : id; LittleEndianDataReader reader = new LittleEndianDataReader(_metaDataStream); dir = new List<DirectoryEntry>(); DirectoryEntry entry = DirectoryEntry.ReadFrom(reader); while (entry != null) { dir.Add(entry); entry = DirectoryEntry.ReadFrom(reader); } _dirCache[id] = dir; } return dir; }