Example #1
0
        protected internal unsafe T ReadStructure <T>(uint rva) where T : struct
        {
            try
            {
                byte *baseOfView = null;

                _mappedFileView.AcquirePointer(ref baseOfView);

                ulong positionToReadFrom = (ulong)baseOfView + rva;
                //IntPtr positionToReadFrom = new IntPtr(baseOfView + rva);

                T readStructure = default(T);

                readStructure = _mappedFileView.Read <T>((ulong)positionToReadFrom);

                return(readStructure);
            }
            finally
            {
                _mappedFileView.ReleasePointer();
            }
        }