void Read() { // Refs: coreclr/src/vm/{ecalllist.h,mscorlib.cpp,ecall.h,ecall.cpp} long pos = 0; long end = reader.Length - (3 * ptrSize - 1); List <ECClass> eccList = new List <ECClass>(); for (; pos <= end; pos += ptrSize) { tableFormat = null; var ecc = ReadECClass(pos, true); if (ecc is null) { continue; } for (long pos2 = pos; pos2 <= end; pos2 += 3 * ptrSize) { ecc = ReadECClass(pos2, false); if (ecc is null) { break; } eccList.Add(ecc.Value); } if (eccList.Count >= 20) { break; } eccList.Clear(); } list.AddRange(eccList); }
public ECallListReader(string filename) { peImage = new PEImage(filename); reader = peImage.CreateReader(); is32bit = peImage.ImageNTHeaders.OptionalHeader.Magic == 0x010B; ptrSize = is32bit ? 4U : 8; var last = peImage.ImageSectionHeaders[peImage.ImageSectionHeaders.Count - 1]; endRva = (uint)last.VirtualAddress + last.VirtualSize; list = new List <ECClass>(); tableFormat = null; Read(); }
void InitializeTableFormat(long pos) { if (pos + ptrSize > reader.Length) { return; } ulong flags = ReadPtr(pos); if ((flags & (ulong)FCFuncFlag.EndOfArray) != 0) { return; } bool hasSig = (flags & (ulong)FCFuncFlag.HasSignature) != 0; if (pos + ptrSize * (5 + (hasSig ? 1 : 0)) < reader.Length) { uint? methRva = ReadRva(pos + ptrSize * 1); ulong nullPtr1 = ReadPtr(pos + ptrSize * 2); ulong nullPtr2 = ReadPtr(pos + ptrSize * 3); var name = ReadAsciizIdPtr(pos + ptrSize * 4); if (nullPtr1 == 0 && nullPtr2 == 0 && !(name is null) && !(methRva is null) && (methRva.Value == 0 || IsCodeRva(methRva.Value))) { tableFormat = TableFormat.V1; return; } } if (pos + ptrSize * (3 + (hasSig ? 1 : 0)) < reader.Length) { uint?methRva = ReadRva(pos + ptrSize * 1); var name = ReadAsciizIdPtr(pos + ptrSize * 2); if (!(name is null) && !(methRva is null) && (methRva.Value == 0 || IsCodeRva(methRva.Value))) { tableFormat = TableFormat.V2; return; } } }
void InitializeTableFormat(long pos) { if (pos + ptrSize > reader.Length) return; ulong flags = ReadPtr(pos); if ((flags & (ulong)FCFuncFlag.EndOfArray) != 0) return; bool hasSig = (flags & (ulong)FCFuncFlag.HasSignature) != 0; if (pos + ptrSize * (5 + (hasSig ? 1 : 0)) < reader.Length) { uint? methRva = ReadRva(pos + ptrSize * 1); ulong nullPtr1 = ReadPtr(pos + ptrSize * 2); ulong nullPtr2 = ReadPtr(pos + ptrSize * 3); var name = ReadAsciizIdPtr(pos + ptrSize * 4); if (nullPtr1 == 0 && nullPtr2 == 0 && name != null && methRva != null && (methRva.Value == 0 || IsCodeRva(methRva.Value))) { tableFormat = TableFormat.V1; return; } } if (pos + ptrSize * (3 + (hasSig ? 1 : 0)) < reader.Length) { uint? methRva = ReadRva(pos + ptrSize * 1); var name = ReadAsciizIdPtr(pos + ptrSize * 2); if (name != null && methRva != null && (methRva.Value == 0 || IsCodeRva(methRva.Value))) { tableFormat = TableFormat.V2; return; } } }
void Read() { // Refs: coreclr/src/vm/{ecalllist.h,mscorlib.cpp,ecall.h,ecall.cpp} long pos = 0; long end = reader.Length - (3 * ptrSize - 1); List<ECClass> eccList = new List<ECClass>(); for (; pos <= end; pos += ptrSize) { tableFormat = null; var ecc = ReadECClass(pos, true); if (ecc == null) continue; for (long pos2 = pos; pos2 <= end; pos2 += 3 * ptrSize) { ecc = ReadECClass(pos2, false); if (ecc == null) break; eccList.Add(ecc.Value); } if (eccList.Count >= 20) break; eccList.Clear(); } list.AddRange(eccList); }
public ECallListReader(string filename) { this.peImage = new PEImage(filename); this.reader = peImage.CreateFullStream(); this.is32bit = peImage.ImageNTHeaders.OptionalHeader.Magic == 0x010B; this.ptrSize = is32bit ? 4U : 8; var last = peImage.ImageSectionHeaders[peImage.ImageSectionHeaders.Count - 1]; this.endRva = (uint)last.VirtualAddress + last.VirtualSize; this.list = new List<ECClass>(); this.tableFormat = null; Read(); }