Exemple #1
0
 public BTENTRY(byte[] bytes)
 {
     this._btkey = BitConverter.ToUInt64(bytes, 0);
     this.BREF = new BREF(bytes.Skip(8).Take(16).ToArray());
     /*this.BREF = new BREF_UNICODE
                     {BID_raw = BitConverter.ToUInt64(bytes, 8), ByteIndex = BitConverter.ToUInt64(bytes, 16)};*/
 }
Exemple #2
0
 public BBTENTRY(bool unicode, byte[] bytes)
 {
     BREF           = new BREF(unicode, bytes);
     Internal       = BREF.IsInternal;
     BlockByteCount = unicode ? BitConverter.ToUInt16(bytes, 16) : BitConverter.ToUInt16(bytes, 8);
     RefCount       = unicode ? BitConverter.ToUInt16(bytes, 18) : BitConverter.ToUInt16(bytes, 10);
 }
Exemple #3
0
        public PSTHeader(PSTFile pst)
        {
            using(var mmfView = pst.PSTMMF.CreateViewAccessor(0, 684))
            {
                var temp = new byte[4];
                mmfView.ReadArray(0, temp, 0, 4);
                this.DWMagic = Encoding.Default.GetString(temp);

                var ver = mmfView.ReadInt16(10);

                this.IsANSI = ver == 14 || ver == 15 ? true : (ver == 23 ? (bool?)false : null);

                if (this.IsANSI != null && this.IsANSI.Value)
                {

                } else if (this.IsUNICODE != null && this.IsUNICODE.Value)
                {
                    //root.PSTSize = ByteReverse.ReverseULong(root.PSTSize);
                    var sentinel = mmfView.ReadByte(512);
                    var cryptMethod = (uint) mmfView.ReadByte(513);

                    this.EncodingAlgotihm = (BlockEncoding) cryptMethod;

                    var bytes = new byte[16];
                    mmfView.ReadArray(216, bytes, 0, 16);
                    var nbt_bref = new BREF(bytes);

                    mmfView.ReadArray(232, bytes, 0, 16);
                    var bbt_bref = new BREF(bytes);

                    this.NodeBT = new NDB.PSTBTree(nbt_bref, pst);
                    this.BlockBT = new NDB.PSTBTree(bbt_bref, pst);
                }
            }
        }
Exemple #4
0
        public BTENTRY(byte[] bytes)
        {
            this._btkey = BitConverter.ToUInt64(bytes, 0);
            this.BREF   = new BREF(bytes.Skip(8).Take(16).ToArray());

            /*this.BREF = new BREF_UNICODE
             *              {BID_raw = BitConverter.ToUInt64(bytes, 8), ByteIndex = BitConverter.ToUInt64(bytes, 16)};*/
        }
Exemple #5
0
 public PSTBTree(BREF bref, PSTFile pst)
 {
     using (var viewer = pst.PSTMMF.CreateViewAccessor((long)bref.IB, 512))
     {
         var data = new byte[512];
         viewer.ReadArray(0, data, 0, 512);
         this.Root = new BTPage(data, bref, pst);
     }
 }
Exemple #6
0
 public BBTENTRY(byte[] bytes)
 {
     this.BREF = new BREF(bytes);
     /*this.BREF = new BREF_UNICODE
                     {BID_raw = BitConverter.ToUInt64(bytes, 0), ByteIndex = BitConverter.ToUInt64(bytes, 8)};*/
     this.Internal = this.BREF.IsInternal;
     this.BlockByteCount = BitConverter.ToUInt16(bytes, 16);
     this.RefCount = BitConverter.ToUInt16(bytes, 18);
 }
Exemple #7
0
 public PSTBTree(BREF bref, PSTFile pst)
 {
     using (var viewer = pst.PSTMMF.CreateViewAccessor((long)bref.IB, 512))
     {
         var data = new byte[512];
         viewer.ReadArray(0, data, 0, 512);
         this.Root = new BTPage(data, bref, pst);
     }
 }
Exemple #8
0
        public BBTENTRY(byte[] bytes)
        {
            this.BREF = new BREF(bytes);

            /*this.BREF = new BREF_UNICODE
             *              {BID_raw = BitConverter.ToUInt64(bytes, 0), ByteIndex = BitConverter.ToUInt64(bytes, 8)};*/
            this.Internal       = this.BREF.IsInternal;
            this.BlockByteCount = BitConverter.ToUInt16(bytes, 16);
            this.RefCount       = BitConverter.ToUInt16(bytes, 18);
        }
Exemple #9
0
        public BTPage(bool unicode, byte[] pageData, BREF _ref, PSTFile pst)
        {
            InternalChildren = new List <BTPage>();
            this._ref        = _ref;
            if (unicode)
            {
                _trailer    = new PageTrailer(unicode, pageData.RangeSubset(496, 16));
                _numEntries = pageData[488];
                _maxEntries = pageData[489];
                _cbEnt      = pageData[490];
                _cLevel     = pageData[491];
            }
            else
            {
                _trailer    = new PageTrailer(unicode, pageData.RangeSubset(500, 12));
                _numEntries = pageData[496];
                _maxEntries = pageData[497];
                _cbEnt      = pageData[498];
                _cLevel     = pageData[499];
            }

            Entries = new List <BTPAGEENTRY>();
            for (var i = 0; i < _numEntries; i++)
            {
                var curEntryBytes = pageData.RangeSubset(i * _cbEnt, _cbEnt);
                if (_cLevel == 0)
                {
                    if (_trailer.PageType == PageType.NBT)
                    {
                        Entries.Add(new NBTENTRY(unicode, curEntryBytes));
                    }
                    else
                    {
                        Entries.Add(new BBTENTRY(unicode, curEntryBytes));
                    }
                }
                else
                {
                    //btentries
                    var entry = new BTENTRY(unicode, curEntryBytes);
                    Entries.Add(entry);
                    using (var view = pst.PSTMMF.CreateViewAccessor((long)entry.BREF.IB, 512))
                    {
                        var bytes = new byte[512];
                        view.ReadArray(0, bytes, 0, 512);
                        InternalChildren.Add(new BTPage(unicode, bytes, entry.BREF, pst));
                    }
                }
            }
        }
Exemple #10
0
        public BTPage(byte[] pageData, BREF _ref, PSTFile pst)
        {
            this._ref             = _ref;
            this.InternalChildren = new List <BTPage>();
            this._trailer         = new PageTrailer(pageData.RangeSubset(496, 16));
            this._numEntries      = pageData[488];
            this._maxEntries      = pageData[489];
            this._cbEnt           = pageData[490];
            this._cLevel          = pageData[491];

            this.Entries = new List <BTPAGEENTRY>();
            for (var i = 0; i < this._numEntries; i++)
            {
                var curEntryBytes = pageData.RangeSubset(i * this._cbEnt, this._cbEnt);
                if (this._cLevel == 0)
                {
                    if (this._trailer.PageType == PageType.NBT)
                    {
                        this.Entries.Add(new NBTENTRY(curEntryBytes));
                    }
                    else
                    {
                        var curEntry = new BBTENTRY(curEntryBytes);
                        this.Entries.Add(curEntry);
                    }
                }
                else
                {
                    //btentries
                    var entry = new BTENTRY(curEntryBytes);
                    this.Entries.Add(entry);
                    using (var view = pst.PSTMMF.CreateViewAccessor((long)entry.BREF.IB, 512))
                    {
                        var bytes = new byte[512];
                        view.ReadArray(0, bytes, 0, 512);
                        this.InternalChildren.Add(new BTPage(bytes, entry.BREF, pst));
                    }
                }
            }
        }
Exemple #11
0
        public BTPage(byte[] pageData, BREF _ref, PSTFile pst)
        {
            this._ref = _ref;
            this.InternalChildren = new List<BTPage>();
            this._trailer = new PageTrailer(pageData.RangeSubset(496,16));
            this._numEntries = pageData[488];
            this._maxEntries = pageData[489];
            this._cbEnt = pageData[490];
            this._cLevel = pageData[491];

            this.Entries = new List<BTPAGEENTRY>();
            for (var i = 0; i < this._numEntries; i++)
            {
                var curEntryBytes = pageData.RangeSubset(i*this._cbEnt, this._cbEnt);
                if (this._cLevel == 0)
                {
                    if (this._trailer.PageType == PageType.NBT)
                        this.Entries.Add(new NBTENTRY(curEntryBytes));
                    else
                    {
                        var curEntry = new BBTENTRY(curEntryBytes);
                        this.Entries.Add(curEntry);
                    }
                }
                else
                {
                    //btentries
                    var entry = new BTENTRY(curEntryBytes);
                    this.Entries.Add(entry);
                    using (var view = pst.PSTMMF.CreateViewAccessor((long)entry.BREF.IB,512))
                    {
                        var bytes = new byte[512];
                        view.ReadArray(0, bytes, 0, 512);
                        this.InternalChildren.Add(new BTPage(bytes, entry.BREF, pst));
                    }
                }
            }
        }
Exemple #12
0
 public BTENTRY(bool unicode, byte[] bytes)
 {
     Key  = unicode ? BitConverter.ToUInt64(bytes, 0) : BitConverter.ToUInt32(bytes, 0);
     BREF = unicode ? new BREF(unicode, bytes.Skip(8).Take(16).ToArray()) : new BREF(unicode, bytes.Skip(4).Take(8).ToArray());
 }