Class CilRawTinyMethodBody
- Namespace
- AsmResolver.PE.DotNet.Cil
- Assembly
- AsmResolver.PE.dll
Represents a CIL method body using the tiny format.
public class CilRawTinyMethodBody : CilRawMethodBody, ISegment, IOffsetProvider, IWritable
- Inheritance
-
CilRawTinyMethodBody
- Implements
- Inherited Members
Remarks
The tiny method body format is used when a CIL method body's code size is less than 64 bytes, has no local variables, its max stack size is less than or equal to 8, and has no extra sections (e.g. no exception handlers).
This class does not do any encoding/decoding of the bytes that make up the actual CIL instructions, nor does it do any verification of the code.
Constructors
CilRawTinyMethodBody(IReadableSegment)
Creates a new method body using a buffer of assembled CIL instructions.
public CilRawTinyMethodBody(IReadableSegment code)
Parameters
code
IReadableSegmentThe buffer containing the raw CIL instructions.
CilRawTinyMethodBody(byte[])
Creates a new method body using a buffer of assembled CIL instructions.
public CilRawTinyMethodBody(byte[] code)
Parameters
code
byte[]The buffer containing the raw CIL instructions.
Properties
IsFat
Gets a value indicating whether the method body is using the fat format.
public override bool IsFat { get; }
Property Value
Methods
FromReader(IErrorListener, ref BinaryStreamReader)
Reads a raw method body from the given binary input stream using the tiny method body format.
public static CilRawTinyMethodBody? FromReader(IErrorListener errorListener, ref BinaryStreamReader reader)
Parameters
errorListener
IErrorListenerThe object responsible for recording parser errors.
reader
BinaryStreamReaderThe binary input stream to read from.
Returns
- CilRawTinyMethodBody
The raw method body.
Exceptions
- FormatException
Occurs when the method header indicates an method body that is not in the tiny format.
GetPhysicalSize()
Computes the number of bytes that the structure contains.
public override uint GetPhysicalSize()
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 override 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 override void Write(BinaryStreamWriter writer)
Parameters
writer
BinaryStreamWriterThe output stream to write the data to.