public SecurityDescriptors(File file) { _file = file; _hashIndex = new IndexView <HashIndexKey, HashIndexData>(file.GetIndex("$SDH")); _idIndex = new IndexView <IdIndexKey, IdIndexData>(file.GetIndex("$SII")); foreach (var entry in _idIndex.Entries) { if (entry.Key.Id > _nextId) { _nextId = entry.Key.Id; } long end = entry.Value.SdsOffset + entry.Value.SdsLength; if (end > _nextSpace) { _nextSpace = end; } } if (_nextId == 0) { _nextId = 256; } else { _nextId++; } _nextSpace = Utilities.RoundUp(_nextSpace, 16); }
public static Quotas Initialize(File file) { Index ownerIndex = file.CreateIndex("$O", (AttributeType)0, AttributeCollationRule.Sid); Index quotaIndox = file.CreateIndex("$Q", (AttributeType)0, AttributeCollationRule.UnsignedLong); IndexView <OwnerKey, OwnerRecord> ownerIndexView = new IndexView <OwnerKey, OwnerRecord>(ownerIndex); IndexView <OwnerRecord, QuotaRecord> quotaIndexView = new IndexView <OwnerRecord, QuotaRecord>(quotaIndox); OwnerKey adminSid = new OwnerKey(new SecurityIdentifier(WellKnownSidType.BuiltinAdministratorsSid, null)); OwnerRecord adminOwnerId = new OwnerRecord(256); ownerIndexView[adminSid] = adminOwnerId; quotaIndexView[new OwnerRecord(1)] = new QuotaRecord(null); quotaIndexView[adminOwnerId] = new QuotaRecord(adminSid.Sid); return(new Quotas(file)); }
private void VerifyDirectories() { foreach (FileRecord fr in _context.Mft.Records) { if (fr.BaseFile.Value != 0) { continue; } File f = new File(_context, fr); foreach (var stream in f.AllStreams) { if (stream.AttributeType == AttributeType.IndexRoot && stream.Name == "$I30") { IndexView <FileNameRecord, FileRecordReference> dir = new IndexView <FileNameRecord, FileRecordReference>(f.GetIndex("$I30")); foreach (var entry in dir.Entries) { FileRecord refFile = _context.Mft.GetRecord(entry.Value); // Make sure each referenced file actually exists... if (refFile == null) { ReportError("Directory {0} references non-existent file {1}", f, entry.Key); } File referencedFile = new File(_context, refFile); StandardInformation si = referencedFile.StandardInformation; if (si.CreationTime != entry.Key.CreationTime || si.MftChangedTime != entry.Key.MftChangedTime || si.ModificationTime != entry.Key.ModificationTime) { ReportInfo("Directory entry {0} in {1} is out of date", entry.Key, f); } } } } } }
public ObjectIds(File file) { _file = file; _index = new IndexView <IndexKey, ObjectIdRecord>(file.GetIndex("$O")); }
public Quotas(File file) { _ownerIndex = new IndexView <OwnerKey, OwnerRecord>(file.GetIndex("$O")); _quotaIndex = new IndexView <OwnerRecord, QuotaRecord>(file.GetIndex("$Q")); }
public ReparsePoints(File file) { _file = file; _index = new IndexView <Key, Data>(file.GetIndex("$R")); }