示例#1
0
        internal DirectoryEntry(IoMemory mem, ref int offset)
        {
            if (offset + 8 > mem.Length)
            {
                Error.AccessOutOfRange();
            }

            virtualAddress = mem.Read32Unchecked(offset + 0);
            size           = mem.Read32Unchecked(offset + 4);
            offset        += 8;
        }
示例#2
0
 internal ImportDescriptor(IoMemory mem, ref int offset)
 {
     if (offset + 20 > mem.Length)
     {
         Error.AccessOutOfRange();
     }
     this.characteristics = mem.Read32Unchecked(offset + 0);
     this.timeDateStamp   = mem.Read32Unchecked(offset + 4);
     this.forwarderChain  = mem.Read32Unchecked(offset + 8);
     this.name            = mem.Read32Unchecked(offset + 12);
     this.firstChunk      = mem.Read32Unchecked(offset + 16);
     offset += 20;
 }
示例#3
0
 internal SectionHeader(IoMemory mem, ref int offset)
 {
     if (offset + 40 > mem.Length)
     {
         Error.AccessOutOfRange();
     }
     name             = mem.ReadAsciiZeroString(offset, 8);
     virtualSize      = mem.Read32Unchecked(offset + 8);
     virtualAddress   = mem.Read32Unchecked(offset + 12);
     sizeOfRawData    = mem.Read32Unchecked(offset + 16);
     pointerToRawData = mem.Read32Unchecked(offset + 20);
     characteristics  = mem.Read32Unchecked(offset + 36);
     offset          += 40;
 }
示例#4
0
            internal readonly uint AddressOfOrdinals;       // RVA from base of image

            internal ExportDirectory(IoMemory mem, int offset)
            {
                if (offset + 40 > mem.Length)
                {
                    Error.AccessOutOfRange();
                }
                Characteristics    = mem.Read32Unchecked(offset + 0);
                NumberOfFunctions  = mem.Read32Unchecked(offset + 20);
                NumberOfNames      = mem.Read32Unchecked(offset + 24);
                AddressOfFunctions = mem.Read32Unchecked(offset + 28);
                AddressOfNames     = mem.Read32Unchecked(offset + 32);
                AddressOfOrdinals  = mem.Read32Unchecked(offset + 36);

                if (AddressOfFunctions + 4 * NumberOfFunctions > mem.Length ||
                    AddressOfOrdinals + 2 * NumberOfFunctions > mem.Length ||
                    AddressOfNames + 4 * NumberOfFunctions > mem.Length)
                {
                    Error.AccessOutOfRange();
                }
            }