public override void VisitCLIHeader(CLIHeader header) { m_textWriter.Write(header.Cb); if (m_mdWriter.TargetRuntime == TargetRuntime.NET_2_0) { m_textWriter.Write((ushort)2); m_textWriter.Write((ushort)5); } else { m_textWriter.Write((ushort)2); m_textWriter.Write((ushort)0); } m_textWriter.Write(header.Metadata.VirtualAddress); m_textWriter.Write(header.Metadata.Size); m_textWriter.Write((uint)header.Flags); m_textWriter.Write(header.EntryPointToken); m_textWriter.Write(header.Resources.VirtualAddress); m_textWriter.Write(header.Resources.Size); m_textWriter.Write(header.StrongNameSignature.VirtualAddress); m_textWriter.Write(header.StrongNameSignature.Size); m_textWriter.Write(header.CodeManagerTable.VirtualAddress); m_textWriter.Write(header.CodeManagerTable.Size); m_textWriter.Write(header.VTableFixups.VirtualAddress); m_textWriter.Write(header.VTableFixups.Size); m_textWriter.Write(header.ExportAddressTableJumps.VirtualAddress); m_textWriter.Write(header.ExportAddressTableJumps.Size); m_textWriter.Write(header.ManagedNativeHeader.VirtualAddress); m_textWriter.Write(header.ManagedNativeHeader.Size); }
public override void VisitCLIHeader(CLIHeader header) { if (m_image.PEOptionalHeader.DataDirectories.Debug != DataDirectory.Zero) { m_image.DebugHeader = new DebugHeader(); VisitDebugHeader(m_image.DebugHeader); } SetPositionToAddress(m_image.PEOptionalHeader.DataDirectories.CLIHeader.VirtualAddress); header.Cb = m_binaryReader.ReadUInt32(); header.MajorRuntimeVersion = m_binaryReader.ReadUInt16(); header.MinorRuntimeVersion = m_binaryReader.ReadUInt16(); header.Metadata = ReadDataDirectory(); header.Flags = (RuntimeImage)m_binaryReader.ReadUInt32(); header.EntryPointToken = m_binaryReader.ReadUInt32(); header.Resources = ReadDataDirectory(); header.StrongNameSignature = ReadDataDirectory(); header.CodeManagerTable = ReadDataDirectory(); header.VTableFixups = ReadDataDirectory(); header.ExportAddressTableJumps = ReadDataDirectory(); header.ManagedNativeHeader = ReadDataDirectory(); if (header.StrongNameSignature != DataDirectory.Zero) { SetPositionToAddress(header.StrongNameSignature.VirtualAddress); header.ImageHash = m_binaryReader.ReadBytes((int)header.StrongNameSignature.Size); } else { header.ImageHash = new byte [0]; } SetPositionToAddress(m_image.CLIHeader.Metadata.VirtualAddress); m_image.MetadataRoot.Accept(m_mdReader); }
public override void VisitCLIHeader(CLIHeader header) { if (m_image.PEOptionalHeader.DataDirectories.CLIHeader == DataDirectory.Zero) { throw new ImageFormatException("Non Pure CLI Image"); } if (m_image.PEOptionalHeader.DataDirectories.Debug != DataDirectory.Zero) { m_image.DebugHeader = new DebugHeader(); VisitDebugHeader(m_image.DebugHeader); } m_binaryReader.BaseStream.Position = m_image.ResolveVirtualAddress( m_image.PEOptionalHeader.DataDirectories.CLIHeader.VirtualAddress); header.Cb = m_binaryReader.ReadUInt32(); header.MajorRuntimeVersion = m_binaryReader.ReadUInt16(); header.MinorRuntimeVersion = m_binaryReader.ReadUInt16(); header.Metadata = new DataDirectory( new RVA(m_binaryReader.ReadUInt32()), m_binaryReader.ReadUInt32()); header.Flags = (Mono.Cecil.Binary.RuntimeImage)m_binaryReader.ReadUInt32(); header.EntryPointToken = m_binaryReader.ReadUInt32(); header.Resources = new DataDirectory( new RVA(m_binaryReader.ReadUInt32()), m_binaryReader.ReadUInt32()); header.StrongNameSignature = new DataDirectory( new RVA(m_binaryReader.ReadUInt32()), m_binaryReader.ReadUInt32()); header.CodeManagerTable = new DataDirectory( new RVA(m_binaryReader.ReadUInt32()), m_binaryReader.ReadUInt32()); header.VTableFixups = new DataDirectory( new RVA(m_binaryReader.ReadUInt32()), m_binaryReader.ReadUInt32()); header.ExportAddressTableJumps = new DataDirectory( new RVA(m_binaryReader.ReadUInt32()), m_binaryReader.ReadUInt32()); header.ManagedNativeHeader = new DataDirectory( new RVA(m_binaryReader.ReadUInt32()), m_binaryReader.ReadUInt32()); if (header.StrongNameSignature != DataDirectory.Zero) { m_binaryReader.BaseStream.Position = m_image.ResolveVirtualAddress( header.StrongNameSignature.VirtualAddress); header.ImageHash = m_binaryReader.ReadBytes((int)header.StrongNameSignature.Size); } else { header.ImageHash = new byte [0]; } m_binaryReader.BaseStream.Position = m_image.ResolveVirtualAddress( m_image.CLIHeader.Metadata.VirtualAddress); m_image.MetadataRoot.Accept(m_mdReader); }
internal Image() { m_dosHeader = new DOSHeader(); m_peFileHeader = new PEFileHeader(); m_peOptionalHeader = new PEOptionalHeader(); m_sections = new SectionCollection(); m_importAddressTable = new ImportAddressTable(); m_cliHeader = new CLIHeader(); m_importTable = new ImportTable(); m_importLookupTable = new ImportLookupTable(); m_hintNameTable = new HintNameTable(); m_mdRoot = new MetadataRoot(this); }
internal Image() { m_dosHeader = new DOSHeader (); m_peFileHeader = new PEFileHeader (); m_peOptionalHeader = new PEOptionalHeader (); m_sections = new SectionCollection (); m_importAddressTable = new ImportAddressTable (); m_cliHeader = new CLIHeader (); m_importTable = new ImportTable (); m_importLookupTable = new ImportLookupTable (); m_hintNameTable = new HintNameTable (); m_mdRoot = new MetadataRoot (this); }
public override void VisitCLIHeader(CLIHeader header) { m_textWriter.Write(header.Cb); m_textWriter.Write(header.MajorRuntimeVersion); m_textWriter.Write(header.MinorRuntimeVersion); m_textWriter.Write(header.Metadata.VirtualAddress); m_textWriter.Write(header.Metadata.Size); m_textWriter.Write((uint)header.Flags); m_textWriter.Write(header.EntryPointToken); m_textWriter.Write(header.Resources.VirtualAddress); m_textWriter.Write(header.Resources.Size); m_textWriter.Write(header.StrongNameSignature.VirtualAddress); m_textWriter.Write(header.StrongNameSignature.Size); m_textWriter.Write(header.CodeManagerTable.VirtualAddress); m_textWriter.Write(header.CodeManagerTable.Size); m_textWriter.Write(header.VTableFixups.VirtualAddress); m_textWriter.Write(header.VTableFixups.Size); m_textWriter.Write(header.ExportAddressTableJumps.VirtualAddress); m_textWriter.Write(header.ExportAddressTableJumps.Size); m_textWriter.Write(header.ManagedNativeHeader.VirtualAddress); m_textWriter.Write(header.ManagedNativeHeader.Size); }
public override void VisitCLIHeader(CLIHeader header) { if (m_image.PEOptionalHeader.DataDirectories.Debug != DataDirectory.Zero) { m_image.DebugHeader = new DebugHeader (); VisitDebugHeader (m_image.DebugHeader); } SetPositionToAddress (m_image.PEOptionalHeader.DataDirectories.CLIHeader.VirtualAddress); header.Cb = m_binaryReader.ReadUInt32 (); header.MajorRuntimeVersion = m_binaryReader.ReadUInt16 (); header.MinorRuntimeVersion = m_binaryReader.ReadUInt16 (); header.Metadata = ReadDataDirectory (); header.Flags = (RuntimeImage) m_binaryReader.ReadUInt32 (); header.EntryPointToken = m_binaryReader.ReadUInt32 (); header.Resources = ReadDataDirectory (); header.StrongNameSignature = ReadDataDirectory (); header.CodeManagerTable = ReadDataDirectory (); header.VTableFixups = ReadDataDirectory (); header.ExportAddressTableJumps = ReadDataDirectory (); header.ManagedNativeHeader = ReadDataDirectory (); if (header.StrongNameSignature != DataDirectory.Zero) { SetPositionToAddress (header.StrongNameSignature.VirtualAddress); header.ImageHash = m_binaryReader.ReadBytes ((int) header.StrongNameSignature.Size); } else header.ImageHash = new byte [0]; SetPositionToAddress (m_image.CLIHeader.Metadata.VirtualAddress); m_image.MetadataRoot.Accept (m_mdReader); }
public override void VisitCLIHeader(CLIHeader header) { header.SetDefaultValues (); m_image.MetadataRoot.Accept (m_mdinit); }
public override void VisitCLIHeader(CLIHeader header) { header.SetDefaultValues(); m_image.MetadataRoot.Accept(m_mdinit); }
public override void VisitCLIHeader(CLIHeader header) { if (m_image.PEOptionalHeader.DataDirectories.CLIHeader == DataDirectory.Zero) throw new ImageFormatException ("Non Pure CLI Image"); if (m_image.PEOptionalHeader.DataDirectories.Debug != DataDirectory.Zero) { m_image.DebugHeader = new DebugHeader (); VisitDebugHeader (m_image.DebugHeader); } m_binaryReader.BaseStream.Position = m_image.ResolveVirtualAddress ( m_image.PEOptionalHeader.DataDirectories.CLIHeader.VirtualAddress); header.Cb = m_binaryReader.ReadUInt32 (); header.MajorRuntimeVersion = m_binaryReader.ReadUInt16 (); header.MinorRuntimeVersion = m_binaryReader.ReadUInt16 (); header.Metadata = new DataDirectory ( new RVA (m_binaryReader.ReadUInt32 ()), m_binaryReader.ReadUInt32 ()); header.Flags = (Mono.Cecil.Binary.RuntimeImage) m_binaryReader.ReadUInt32 (); header.EntryPointToken = m_binaryReader.ReadUInt32 (); header.Resources = new DataDirectory ( new RVA (m_binaryReader.ReadUInt32 ()), m_binaryReader.ReadUInt32 ()); header.StrongNameSignature = new DataDirectory ( new RVA (m_binaryReader.ReadUInt32 ()), m_binaryReader.ReadUInt32 ()); header.CodeManagerTable = new DataDirectory ( new RVA (m_binaryReader.ReadUInt32 ()), m_binaryReader.ReadUInt32 ()); header.VTableFixups = new DataDirectory ( new RVA (m_binaryReader.ReadUInt32 ()), m_binaryReader.ReadUInt32 ()); header.ExportAddressTableJumps = new DataDirectory ( new RVA (m_binaryReader.ReadUInt32 ()), m_binaryReader.ReadUInt32 ()); header.ManagedNativeHeader = new DataDirectory ( new RVA (m_binaryReader.ReadUInt32 ()), m_binaryReader.ReadUInt32 ()); if (header.StrongNameSignature != DataDirectory.Zero) { m_binaryReader.BaseStream.Position = m_image.ResolveVirtualAddress ( header.StrongNameSignature.VirtualAddress); header.ImageHash = m_binaryReader.ReadBytes ((int) header.StrongNameSignature.Size); } else { header.ImageHash = new byte [0]; } m_binaryReader.BaseStream.Position = m_image.ResolveVirtualAddress ( m_image.CLIHeader.Metadata.VirtualAddress); m_image.MetadataRoot.Accept (m_mdReader); }
public override void VisitCLIHeader(CLIHeader header) { m_textWriter.Write (header.Cb); if (m_mdWriter.TargetRuntime == TargetRuntime.NET_2_0) { m_textWriter.Write ((ushort) 2); m_textWriter.Write ((ushort) 5); } else { m_textWriter.Write ((ushort) 2); m_textWriter.Write ((ushort) 0); } m_textWriter.Write (header.Metadata.VirtualAddress); m_textWriter.Write (header.Metadata.Size); m_textWriter.Write ((uint) header.Flags); m_textWriter.Write (header.EntryPointToken); m_textWriter.Write (header.Resources.VirtualAddress); m_textWriter.Write (header.Resources.Size); m_textWriter.Write (header.StrongNameSignature.VirtualAddress); m_textWriter.Write (header.StrongNameSignature.Size); m_textWriter.Write (header.CodeManagerTable.VirtualAddress); m_textWriter.Write (header.CodeManagerTable.Size); m_textWriter.Write (header.VTableFixups.VirtualAddress); m_textWriter.Write (header.VTableFixups.Size); m_textWriter.Write (header.ExportAddressTableJumps.VirtualAddress); m_textWriter.Write (header.ExportAddressTableJumps.Size); m_textWriter.Write (header.ManagedNativeHeader.VirtualAddress); m_textWriter.Write (header.ManagedNativeHeader.Size); }
public override void VisitCLIHeader (CLIHeader header) { m_textWriter.Write (header.Cb); m_textWriter.Write (header.MajorRuntimeVersion); m_textWriter.Write (header.MinorRuntimeVersion); m_textWriter.Write (header.Metadata.VirtualAddress); m_textWriter.Write (header.Metadata.Size); m_textWriter.Write ((uint) header.Flags); m_textWriter.Write (header.EntryPointToken); m_textWriter.Write (header.Resources.VirtualAddress); m_textWriter.Write (header.Resources.Size); m_textWriter.Write (header.StrongNameSignature.VirtualAddress); m_textWriter.Write (header.StrongNameSignature.Size); m_textWriter.Write (header.CodeManagerTable.VirtualAddress); m_textWriter.Write (header.CodeManagerTable.Size); m_textWriter.Write (header.VTableFixups.VirtualAddress); m_textWriter.Write (header.VTableFixups.Size); m_textWriter.Write (header.ExportAddressTableJumps.VirtualAddress); m_textWriter.Write (header.ExportAddressTableJumps.Size); m_textWriter.Write (header.ManagedNativeHeader.VirtualAddress); m_textWriter.Write (header.ManagedNativeHeader.Size); }