Esempio n. 1
0
        /// <summary>
        /// Binary searches the rids table for <paramref name="originalHeapOffset"/>
        /// </summary>
        /// <param name="originalHeapOffset">Original heap offset</param>
        /// <returns>The rids table index or <see cref="uint.MaxValue"/> if not found</returns>
        protected uint BinarySearch(uint originalHeapOffset)
        {
            uint lo = 0, hi = numRids - 1;

            while (lo <= hi && hi != uint.MaxValue)
            {
                uint index = (lo + hi) / 2;
                uint val   = reader.ReadUInt32At(posRids + index * 4);
                if (originalHeapOffset == val)
                {
                    return(index);
                }
                if (originalHeapOffset > val)
                {
                    lo = index + 1;
                }
                else
                {
                    hi = index - 1;
                }
            }
            return(uint.MaxValue);
        }
Esempio n. 2
0
 /// <summary>
 ///     Gets the offset of the hot table directory in <see cref="fullStream" />
 /// </summary>
 protected long GetHotTableBaseOffset()
 {
     // All bits in this dword are used
     return(endOffset - 8 - HotTableStream.HOT_HEAP_DIR_SIZE - fullStream.ReadUInt32At(endOffset - 8));
 }