Table of Contents

Class GenericPlatform

Namespace
AsmResolver.PE.Platforms
Assembly
AsmResolver.PE.dll

Represents the generic fallback target platform.

public sealed class GenericPlatform : Platform
Inheritance
GenericPlatform
Inherited Members

Remarks

This class implements the bare minimum for any platform that is not supported through a dedicated Platform class. It is therefore also not able to generate native code (such as thunk stubs or IAT initializers), and will throw NotSupportedException when instructed to do so.

Note that for .NET binaries, the generic platform is not the same as AnyCPU. AnyCPU binaries are compiled as if they were i386 binaries and thus use the I386Platform instead.

Properties

Is32Bit

Gets a value indicating whether the platform is a 32-bit platform.

public override bool Is32Bit { get; }

Property Value

bool

IsClrBootstrapperRequired

Gets a value indicating whether PEs with a .NET image embedded requires a CLR bootstrapper.

public override bool IsClrBootstrapperRequired { get; }

Property Value

bool

TargetMachine

Gets the machine type associated to the platform.

public override MachineType TargetMachine { get; }

Property Value

MachineType

ThunkStubAlignment

Gets the default byte-boundary used in aligning thunk stubs in a PE file.

public override uint ThunkStubAlignment { get; }

Property Value

uint

Methods

CreateAddressTableInitializer(ISymbol)

Creates a new address table initializer stub.

public override AddressTableInitializerStub CreateAddressTableInitializer(ISymbol virtualProtect)

Parameters

virtualProtect ISymbol

The symbol to kernel32.dll!VirtualProtect to use for temporarily adjusting the memory protection bits while initializing the address table.

Returns

AddressTableInitializerStub

The initializer stub.

CreateThunkStub(ISymbol)

Creates a new thunk stub that transfers control to the provided symbol.

public override RelocatableSegment CreateThunkStub(ISymbol entryPoint)

Parameters

entryPoint ISymbol

The symbol to jump to.

Returns

RelocatableSegment

The created stub.

TryExtractThunkAddress(PEImage, BinaryStreamReader, out uint)

Attempts to extract the original RVA from the code at the provided thunk address reader.

public override bool TryExtractThunkAddress(PEImage image, BinaryStreamReader reader, out uint rva)

Parameters

image PEImage

The image containing the thunk.

reader BinaryStreamReader

The thunk reader.

rva uint

The extracted RVA.

Returns

bool

true if the RVA was extracted successfully from the code, false otherwise.