private void PatchResourceDataEntry(ByteBuffer resources) { uint num = resources.ReadUInt32(); resources.position -= 4; resources.WriteUInt32((num - this.GetImageResourceSection().VirtualAddress) + this.rsrc.VirtualAddress); }
void PatchResourceDataEntry(ByteBuffer resources) { var rva = resources.ReadUInt32(); resources.position -= 4; resources.WriteUInt32(rva - win32_rva + rsrc.VirtualAddress); }
private void PatchResourceDataEntry(ByteBuffer resources) { uint num = resources.ReadUInt32(); resources.position -= 4; resources.WriteUInt32(num - module.Image.Win32Resources.VirtualAddress + rsrc.VirtualAddress); }
void PatchResourceDataEntry(ByteBuffer resources) { var old_rsrc = GetImageResourceSection(); var rva = resources.ReadUInt32(); resources.position -= 4; resources.WriteUInt32(rva - old_rsrc.VirtualAddress + rsrc.VirtualAddress); }
void PatchResourceDataEntry(ByteBuffer resources) { var rva = resources.ReadUInt32(); resources.position -= 4; resources.WriteUInt32(rva - module.Image.Win32Resources.VirtualAddress + rsrc.VirtualAddress); }
private void ReadPdbHeap() { PdbHeap pdbHeap = image.PdbHeap; ByteBuffer byteBuffer = new ByteBuffer(pdbHeap.data); pdbHeap.Id = byteBuffer.ReadBytes(20); pdbHeap.EntryPoint = byteBuffer.ReadUInt32(); pdbHeap.TypeSystemTables = byteBuffer.ReadInt64(); pdbHeap.TypeSystemTableRows = new uint[58]; for (int i = 0; i < 58; i++) { Table table = (Table)i; if (pdbHeap.HasTable(table)) { pdbHeap.TypeSystemTableRows[i] = byteBuffer.ReadUInt32(); } } }
void ReadPdbHeap() { var heap = image.PdbHeap; var buffer = new ByteBuffer(heap.data); heap.Id = buffer.ReadBytes(20); heap.EntryPoint = buffer.ReadUInt32(); heap.TypeSystemTables = buffer.ReadInt64(); heap.TypeSystemTableRows = new uint [Mixin.TableCount]; for (int i = 0; i < Mixin.TableCount; i++) { var table = (Table)i; if (!heap.HasTable(table)) { continue; } heap.TypeSystemTableRows [i] = buffer.ReadUInt32(); } }
private void PatchResourceDirectoryEntry(ByteBuffer resources) { resources.Advance(4); uint num = resources.ReadUInt32(); int num1 = resources.position; resources.position = (int)(num & 2147483647); if ((num & -2147483648) == 0) { this.PatchResourceDataEntry(resources); } else { this.PatchResourceDirectoryTable(resources); } resources.position = num1; }
private void PatchResourceDirectoryEntry(ByteBuffer resources) { resources.Advance(4); uint num = resources.ReadUInt32(); int position = resources.position; resources.position = ((int)num) & 0x7fffffff; if ((num & 0x80000000) != 0) { this.PatchResourceDirectoryTable(resources); } else { this.PatchResourceDataEntry(resources); } resources.position = position; }
private void PatchResourceDirectoryEntry(ByteBuffer resources) { resources.Advance(4); uint num = resources.ReadUInt32(); int position = resources.position; resources.position = (int)(num & 0x7FFFFFFF); if (((int)num & -2147483648) != 0) { PatchResourceDirectoryTable(resources); } else { PatchResourceDataEntry(resources); } resources.position = position; }
void PatchResourceDirectoryEntry(ByteBuffer resources) { resources.Advance(4); var child = resources.ReadUInt32(); var position = resources.position; resources.position = (int)child & 0x7fffffff; if ((child & 0x80000000) != 0) { PatchResourceDirectoryTable(resources); } else { PatchResourceDataEntry(resources); } resources.position = position; }
static MetadataToken GetLocalVarToken (ByteBuffer buffer, MethodSymbols symbols) { if (symbols.variables.IsNullOrEmpty ()) return MetadataToken.Zero; buffer.position = 8; return new MetadataToken (buffer.ReadUInt32 ()); }
void PatchResourceDirectoryEntry(ByteBuffer resources) { resources.Advance (4); var child = resources.ReadUInt32 (); var position = resources.position; resources.position = (int) child & 0x7fffffff; if ((child & 0x80000000) != 0) PatchResourceDirectoryTable (resources); else PatchResourceDataEntry (resources); resources.position = position; }
void PatchResourceDataEntry(ByteBuffer resources) { var old_rsrc = GetImageResourceSection (); var rva = resources.ReadUInt32 (); resources.position -= 4; resources.WriteUInt32 (rva - old_rsrc.VirtualAddress + rsrc.VirtualAddress); }
void PatchRawCode(ByteBuffer buffer, int code_size, CodeWriter writer) { var metadata = writer.metadata; buffer.WriteBytes (ReadBytes (code_size)); var end = buffer.position; buffer.position -= code_size; while (buffer.position < end) { OpCode opcode; var il_opcode = buffer.ReadByte (); if (il_opcode != 0xfe) { opcode = OpCodes.OneByteOpCode [il_opcode]; } else { var il_opcode2 = buffer.ReadByte (); opcode = OpCodes.TwoBytesOpCode [il_opcode2]; } switch (opcode.OperandType) { case OperandType.ShortInlineI: case OperandType.ShortInlineBrTarget: case OperandType.ShortInlineVar: case OperandType.ShortInlineArg: buffer.position += 1; break; case OperandType.InlineVar: case OperandType.InlineArg: buffer.position += 2; break; case OperandType.InlineBrTarget: case OperandType.ShortInlineR: case OperandType.InlineI: buffer.position += 4; break; case OperandType.InlineI8: case OperandType.InlineR: buffer.position += 8; break; case OperandType.InlineSwitch: var length = buffer.ReadInt32 (); buffer.position += length * 4; break; case OperandType.InlineString: var @string = GetString (new MetadataToken (buffer.ReadUInt32 ())); buffer.position -= 4; buffer.WriteUInt32 ( new MetadataToken ( TokenType.String, metadata.user_string_heap.GetStringIndex (@string)).ToUInt32 ()); break; case OperandType.InlineSig: var call_site = GetCallSite (new MetadataToken (buffer.ReadUInt32 ())); buffer.position -= 4; buffer.WriteUInt32 (writer.GetStandAloneSignature (call_site).ToUInt32 ()); break; case OperandType.InlineTok: case OperandType.InlineType: case OperandType.InlineMethod: case OperandType.InlineField: var provider = reader.LookupToken (new MetadataToken (buffer.ReadUInt32 ())); buffer.position -= 4; buffer.WriteUInt32 (metadata.LookupToken (provider).ToUInt32 ()); break; } } }
void ReadPdbHeap() { var heap = image.PdbHeap; var buffer = new ByteBuffer (heap.data); heap.Id = buffer.ReadBytes (20); heap.EntryPoint = buffer.ReadUInt32 (); heap.TypeSystemTables = buffer.ReadInt64 (); heap.TypeSystemTableRows = new uint [Mixin.TableCount]; for (int i = 0; i < Mixin.TableCount; i++) { var table = (Table) i; if (!heap.HasTable (table)) continue; heap.TypeSystemTableRows [i] = buffer.ReadUInt32 (); } }
static void PatchResourceDataEntry(ByteBuffer resources, Section old, Section @new) { uint num = resources.ReadUInt32(); resources.Position -= 4; resources.WriteUInt32(num - old.VirtualAddress + @new.VirtualAddress); }
static void PatchResourceDirectoryEntry(ByteBuffer resources, Section old, Section @new) { resources.Advance(4); uint num = resources.ReadUInt32(); int position = resources.Position; resources.Position = ((int)num) & 0x7fffffff; if ((num & 0x80000000) != 0) { PatchResourceDirectoryTable(resources, old, @new); } else { PatchResourceDataEntry(resources, old, @new); } resources.Position = position; }
public void FieldRVA () { TestCSharp ("Layouts.cs", module => { var priv_impl = GetPrivateImplementationType (module); Assert.IsNotNull (priv_impl); Assert.AreEqual (1, priv_impl.Fields.Count); var field = priv_impl.Fields [0]; Assert.IsNotNull (field); Assert.AreNotEqual (0, field.RVA); Assert.IsNotNull (field.InitialValue); Assert.AreEqual (16, field.InitialValue.Length); var buffer = new ByteBuffer (field.InitialValue); Assert.AreEqual (1, buffer.ReadUInt32 ()); Assert.AreEqual (2, buffer.ReadUInt32 ()); Assert.AreEqual (3, buffer.ReadUInt32 ()); Assert.AreEqual (4, buffer.ReadUInt32 ()); }); }
void PatchResourceDataEntry(ByteBuffer resources) { var rva = resources.ReadUInt32 (); resources.position -= 4; resources.WriteUInt32 (rva - win32_rva + rsrc.VirtualAddress); }