Class CustomMetadataStream
- Namespace
- AsmResolver.PE.DotNet.Metadata
- Assembly
- AsmResolver.PE.dll
Represents a metadata stream with contents in a custom data format.
public class CustomMetadataStream : IMetadataStream, ISegment, IOffsetProvider, IWritable
- Inheritance
-
CustomMetadataStream
- Implements
- Inherited Members
Constructors
CustomMetadataStream(string, ISegment)
Creates a new custom metadata stream.
public CustomMetadataStream(string name, ISegment contents)
Parameters
CustomMetadataStream(string, byte[])
Creates a new custom metadata stream.
public CustomMetadataStream(string name, byte[] data)
Parameters
Properties
CanRead
Gets a value indicating whether the raw contents of the stream can be read using a binary stream reader.
public bool CanRead { get; }
Property Value
CanUpdateOffsets
Determines whether this structure can be relocated to another offset or virtual address.
public bool CanUpdateOffsets { get; }
Property Value
Contents
Gets or sets the raw contents of the stream.
public ISegment Contents { get; set; }
Property Value
Name
Gets or sets the name of the metadata stream.
public string Name { get; set; }
Property Value
Offset
Gets the physical starting offset of the segment.
public ulong Offset { get; }
Property Value
Rva
Gets the virtual address relative to the beginning of the section that the segment is located in.
public uint Rva { get; }
Property Value
Methods
CreateReader()
Creates a binary reader that reads the raw contents of the metadata stream.
public BinaryStreamReader CreateReader()
Returns
- BinaryStreamReader
The reader.
Exceptions
- InvalidOperationException
Occurs when CanRead is
false
.
GetPhysicalSize()
Computes the number of bytes that the structure contains.
public uint GetPhysicalSize()
Returns
- uint
The number of bytes.
GetVirtualSize()
Computes the number of bytes the segment will contain when it is mapped into memory.
public uint GetVirtualSize()
Returns
- uint
The number of bytes.
UpdateOffsets(in RelocationParameters)
Assigns a new file and virtual offset to the segment and all its sub-components.
public void UpdateOffsets(in RelocationParameters parameters)
Parameters
parameters
RelocationParametersThe parameters containing the new offset information for the segment.
Write(BinaryStreamWriter)
Serializes the structure to an output stream.
public void Write(BinaryStreamWriter writer)
Parameters
writer
BinaryStreamWriterThe output stream to write the data to.