Struct DotNetEntryPoint
- Namespace
- AsmResolver.PE.DotNet
- Assembly
- AsmResolver.PE.dll
Represents a reference to an entry point in the .NET Data Directory. This is either a metadata token to a method or file defined in the .NET metadata tables, or a virtual address to native code located in a PE section.
public readonly struct DotNetEntryPoint
- Inherited Members
Constructors
DotNetEntryPoint(ISegmentReference)
Constructs a new native entry point reference.
public DotNetEntryPoint(ISegmentReference nativeCode)
Parameters
nativeCode
ISegmentReferenceA reference to the native code implementing the entry point.
DotNetEntryPoint(MetadataToken)
Constructs a new managed entry point reference.
public DotNetEntryPoint(MetadataToken token)
Parameters
token
MetadataTokenThe metadata token of the managed entry point. This must be either a method or a file token.
Properties
IsManaged
Gets a value indicating the entry point is present in the form of a metadata token.
public bool IsManaged { get; }
Property Value
IsNative
Gets a value indicating the entry point is present in the form of a reference to native code.
public bool IsNative { get; }
Property Value
IsPresent
Gets a value indicating whether an entry point is present or not.
public bool IsPresent { get; }
Property Value
MetadataToken
When the entry point is managed, gets the metadata token of the method or file implementing the managed entry point.
public MetadataToken MetadataToken { get; }
Property Value
NativeCode
When the entry point is native, gets the reference to the beginning of the native code implementing the native entry point.
public ISegmentReference? NativeCode { get; }
Property Value
Methods
GetRawValue()
Gets the raw reference value as it would be written in the .NET data directory.
public uint GetRawValue()
Returns
Operators
implicit operator uint(DotNetEntryPoint)
Gets the raw reference value of a .NET entry point reference as it would be written in the .NET data directory.
public static implicit operator uint(DotNetEntryPoint value)
Parameters
value
DotNetEntryPointThe entry point reference.
Returns
- uint
The raw reference value.
implicit operator DotNetEntryPoint(MetadataToken)
Constructs a new managed entry point reference.
public static implicit operator DotNetEntryPoint(MetadataToken token)
Parameters
token
MetadataTokenThe metadata token of the managed entry point. This must be either a method or a file token.
Returns
implicit operator DotNetEntryPoint(SegmentReference)
Constructs a new native entry point reference.
public static implicit operator DotNetEntryPoint(SegmentReference nativeCode)
Parameters
nativeCode
SegmentReferenceA reference to the native code implementing the entry point.
Returns
implicit operator DotNetEntryPoint(uint)
Constructs a new managed or native entry point reference.
[Obsolete("Construct entry points via a MetadataToken or an ISegmentReference instead.")]
public static implicit operator DotNetEntryPoint(uint value)
Parameters
value
uint
Returns
- DotNetEntryPoint
The constructed entry point reference.
Remarks
This method is added for backwards source compatibility, and should only be used when absolutely necessary.
When the input value resembles a valid metadata token, that is, it is of the form 0x06XXXXXX
or
0x26XXXXXX
, a managed entry point will be constructed. In any other case, the passed in integer will
be interpreted as a relative virtual address pointing to native code instead.