PEReader Constructors

Definition

Overloads

PEReader(ImmutableArray<Byte>)

Creates a Portable Executable reader over a PE image stored in a byte array.

PEReader(Stream)

Creates a Portable Executable reader over a PE image stored in a stream.

PEReader(Byte*, Int32)

Creates a Portable Executable reader over a PE image stored in memory.

PEReader(Stream, PEStreamOptions)

Creates a Portable Executable reader over a PE image stored in a stream beginning at its current position and ending at the end of the stream.

PEReader(Byte*, Int32, Boolean)

Creates a Portable Executable reader over a PE image stored in memory. A flag indicates whether the image has already been loaded into memory.

PEReader(Stream, PEStreamOptions, Int32)

Creates a Portable Executable reader over a PE image of the given size beginning at the stream's current position.

PEReader(ImmutableArray<Byte>)

Source:
PEReader.cs
Source:
PEReader.cs
Source:
PEReader.cs
Source:
PEReader.cs

Creates a Portable Executable reader over a PE image stored in a byte array.

public:
 PEReader(System::Collections::Immutable::ImmutableArray<System::Byte> peImage);
public PEReader (System.Collections.Immutable.ImmutableArray<byte> peImage);
new System.Reflection.PortableExecutable.PEReader : System.Collections.Immutable.ImmutableArray<byte> -> System.Reflection.PortableExecutable.PEReader
Public Sub New (peImage As ImmutableArray(Of Byte))

Parameters

peImage
ImmutableArray<Byte>

An immutable array of bytes representing the PE image.

Exceptions

peImage is null.

Remarks

The content of the image is not read during the construction of the PEReader

Applies to

PEReader(Stream)

Source:
PEReader.cs
Source:
PEReader.cs
Source:
PEReader.cs
Source:
PEReader.cs

Creates a Portable Executable reader over a PE image stored in a stream.

public:
 PEReader(System::IO::Stream ^ peStream);
public PEReader (System.IO.Stream peStream);
new System.Reflection.PortableExecutable.PEReader : System.IO.Stream -> System.Reflection.PortableExecutable.PEReader
Public Sub New (peStream As Stream)

Parameters

peStream
Stream

PE image stream.

Exceptions

peStream is null.

Remarks

Ownership of the stream is transferred to the PEReader upon successful validation of constructor arguments. It will be disposed by the PEReader and the caller must not manipulate it.

Applies to

PEReader(Byte*, Int32)

Source:
PEReader.cs
Source:
PEReader.cs
Source:
PEReader.cs
Source:
PEReader.cs

Creates a Portable Executable reader over a PE image stored in memory.

public:
 PEReader(System::Byte* peImage, int size);
public PEReader (byte* peImage, int size);
new System.Reflection.PortableExecutable.PEReader : nativeptr<byte> * int -> System.Reflection.PortableExecutable.PEReader

Parameters

peImage
Byte*

A pointer to the start of the PE image.

size
Int32

The size of the PE image.

Exceptions

size is negative.

Remarks

The memory is owned by the caller and not released on disposal of the PEReader. The caller is responsible for keeping the memory alive and unmodified throughout the lifetime of the PEReader.

The content of the image is not read during the construction of the PEReader

Applies to

PEReader(Stream, PEStreamOptions)

Source:
PEReader.cs
Source:
PEReader.cs
Source:
PEReader.cs
Source:
PEReader.cs

Creates a Portable Executable reader over a PE image stored in a stream beginning at its current position and ending at the end of the stream.

public:
 PEReader(System::IO::Stream ^ peStream, System::Reflection::PortableExecutable::PEStreamOptions options);
public PEReader (System.IO.Stream peStream, System.Reflection.PortableExecutable.PEStreamOptions options);
new System.Reflection.PortableExecutable.PEReader : System.IO.Stream * System.Reflection.PortableExecutable.PEStreamOptions -> System.Reflection.PortableExecutable.PEReader
Public Sub New (peStream As Stream, options As PEStreamOptions)

Parameters

peStream
Stream

A PE image stream.

options
PEStreamOptions

Options specifying how sections of the PE image are read from the stream.

Exceptions

peStream is null.

options has an invalid value.

Error reading from the stream (only when prefetching data).

PrefetchMetadata is specified, and the PE headers of the image are invalid.

Remarks

Unless PEStreamOptions.LeaveOpen is specified, ownership of the stream is transferred to the PEReader upon successful argument validation. It will be disposed by the PEReader and the caller must not manipulate it.

Unless PEStreamOptions.PrefetchMetadata or PEStreamOptions.PrefetchEntireImage is specified, no data is read from the stream during the construction of the PEReader. Furthermore, the stream must not be manipulated by caller while the PEReader is alive and undisposed.

If options includes PEStreamOptions.PrefetchMetadata or PEStreamOptions.PrefetchEntireImage, the PEReader will have read all of the data requested during construction. As such, if PEStreamOptions.LeaveOpen is also specified, the caller retains full ownership of the stream and is assured that it will not be manipulated by the PEReader after construction.

Applies to

PEReader(Byte*, Int32, Boolean)

Source:
PEReader.cs
Source:
PEReader.cs
Source:
PEReader.cs
Source:
PEReader.cs

Creates a Portable Executable reader over a PE image stored in memory. A flag indicates whether the image has already been loaded into memory.

public:
 PEReader(System::Byte* peImage, int size, bool isLoadedImage);
public PEReader (byte* peImage, int size, bool isLoadedImage);
new System.Reflection.PortableExecutable.PEReader : nativeptr<byte> * int * bool -> System.Reflection.PortableExecutable.PEReader

Parameters

peImage
Byte*

A pointer to the start of the PE image.

size
Int32

The size of the PE image.

isLoadedImage
Boolean

true if the PE image has been loaded into memory by the OS loader; otherwise, false.

Exceptions

size is negative.

Remarks

The memory is owned by the caller and is not released when the PEReader is disposed. The caller is responsible for keeping the memory alive and unmodified throughout the lifetime of the PEReader.

The content of the image is not read during the construction of the PEReader

Applies to

PEReader(Stream, PEStreamOptions, Int32)

Source:
PEReader.cs
Source:
PEReader.cs
Source:
PEReader.cs
Source:
PEReader.cs

Creates a Portable Executable reader over a PE image of the given size beginning at the stream's current position.

public:
 PEReader(System::IO::Stream ^ peStream, System::Reflection::PortableExecutable::PEStreamOptions options, int size);
public PEReader (System.IO.Stream peStream, System.Reflection.PortableExecutable.PEStreamOptions options, int size);
new System.Reflection.PortableExecutable.PEReader : System.IO.Stream * System.Reflection.PortableExecutable.PEStreamOptions * int -> System.Reflection.PortableExecutable.PEReader
Public Sub New (peStream As Stream, options As PEStreamOptions, size As Integer)

Parameters

peStream
Stream

A PE image stream.

options
PEStreamOptions

Options specifying how sections of the PE image are read from the stream.

size
Int32

The PE image size.

Exceptions

size is negative or extends past the end of the stream.

Error reading from the stream (only when prefetching data).

PrefetchMetadata is specified, and the PE headers of the image are invalid.

Remarks

Unless PEStreamOptions.LeaveOpen is specified, ownership of the stream is transferred to the PEReader upon successful argument validation. It will be disposed by the PEReader, and the caller must not manipulate it.

Unless PEStreamOptions.PrefetchMetadata or PEStreamOptions.PrefetchEntireImage is specified, no data is read from the stream during the construction of the PEReader. Furthermore, the stream must not be manipulated by the caller while the PEReader is alive and undisposed.

If options includes the PEStreamOptions.PrefetchMetadata or PEStreamOptions.PrefetchEntireImage values, the PEReader will have read all of the data requested during construction. As such, if PEStreamOptions.LeaveOpen is also specified, the caller retains full ownership of the stream and is assured that it will not be manipulated by the PEReader after construction.

Applies to