Пример #1
0
        private static DecayPointer <T> CreateDecayedPointer(IntPtr pHeap, bool isString)
        {
            PointerMetadata meta = new PointerMetadata(Unsafe.SizeOf <T>(), true);
            var             p    = new DecayPointer <T>(pHeap, meta, isString);


            return(p);
        }
Пример #2
0
        private protected DecayPointer(IntPtr pHeap, PointerMetadata metadata, bool isString) :
            base(pHeap, metadata)
        {
            _origin = pHeap;

            IntPtr sizePtr;

            // Calculate the size ptr
            if (isString)
            {
                // an Int32 is the first field in a string
                // indicating the number of the elements
                sizePtr = _origin - sizeof(int);
            }
            else
            {
                // The lowest DWORD of a QWORD is the length of the array
                sizePtr = _origin - sizeof(long);
            }

            Count = Marshal.ReadInt32(sizePtr);
        }
Пример #3
0
 protected bool Equals(PointerMetadata m)
 {
     return(this.IsDecayed == m.IsDecayed && this.ElementSize == m.ElementSize);
 }