Ejemplo n.º 1
0
        internal long OffsetToAbsolutePos(long offset)
        {
            if (_record.IsNonResident)
            {
                return(_record.OffsetToAbsolutePos(offset, 0, _file.Context.BiosParameterBlock.BytesPerCluster));
            }
            else
            {
                long attrStart = _file.GetAttributeOffset(new AttributeReference(_containingFile, _record.AttributeId));
                long attrPos   = _file.Context.GetFileByIndex(MasterFileTable.MftIndex).GetAttribute(AttributeType.Data, null).OffsetToAbsolutePos(attrStart);

                return(_record.OffsetToAbsolutePos(offset, attrPos, 0));
            }
        }
        public long MapPosition(long pos)
        {
            if (_attribute.IsNonResident)
            {
                return(((IMappedBuffer)_attribute.RawBuffer).MapPosition(pos));
            }
            else
            {
                AttributeReference      attrRef    = new AttributeReference(_file.MftReference, _attribute.PrimaryRecord.AttributeId);
                ResidentAttributeRecord attrRecord = (ResidentAttributeRecord)_file.GetAttribute(attrRef).PrimaryRecord;

                long attrStart = _file.GetAttributeOffset(attrRef);
                long mftPos    = attrStart + attrRecord.DataOffset + pos;

                return(_file.Context.GetFileByIndex(MasterFileTable.MftIndex).GetAttribute(AttributeType.Data, null).OffsetToAbsolutePos(mftPos));
            }
        }