C# Класс PERWAPI.PEFile

Base class for the PEFile (starting point)
Наследование: Module
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
AddExternalManagedResource ( ManifestResource mr, bool isPublic ) : void

Add a managed resource from another assembly.

AddExternalManagedResource ( string resName, AssemblyRef assem, bool isPublic ) : void

Add a managed resource from another assembly.

AddExternalManagedResource ( string resName, ModuleRef mod, uint offset, bool isPublic ) : void

Add a managed resource from another module in this assembly.

AddExternalManagedResource ( string resName, ResourceFile resFile, uint offset, bool isPublic ) : void

Add a managed resource from another file in this assembly.

AddManagedResource ( string resName, byte resBytes, bool isPublic ) : void

Add a managed resource to this PEFile. The resource will be embedded in this PE file.

AddUnmanagedResources ( string resFilename ) : void

Add a manifest resource to this PEFile

GetElement ( uint token ) : MetaDataElement

Get a Meta Data Element from this PE file

GetFileName ( ) : string
GetImportedAssemblies ( ) : AssemblyRef[]
GetNamesOfImports ( ) : string[]
GetNetVersion ( ) : NetVersion

Get the version of .NET for this PE file

GetNetVersionString ( ) : string

Get the .NET version for this PE file

GetResource ( string name ) : ManifestResource

Find a resource

GetResources ( ) : PERWAPI.ManifestResource[]
GetThisAssembly ( ) : Assembly

Get the descriptor for this assembly. The PEFile must have been created with hasAssembly = true

MakeDebuggable ( bool allowDebug, bool suppressOpt ) : void

Makes the assembly debuggable by attaching the DebuggableAttribute to the Assembly. Call immediately before calling WritePEFile.

MakeExternAssembly ( string assemName ) : AssemblyRef

Make a descriptor for an external assembly to this PEFile (.assembly extern)

MakeExternModule ( string name ) : ModuleRef

Make a descriptor for an external module to this PEFile (.module extern)

PEFile ( string fileName ) : System

Create a new PE File with the name "fileName". If "fileName" ends in ".dll" then the file is a dll, otherwise it is an exe file. This PE File has no assembly.

PEFile ( string fileName, string assemblyName ) : System

Create a new PE File with the name "fileName". If "fileName" ends in ".dll" then the file is a dll, otherwise it is an exe file. This file has an Assembly called "assemblyName".

ReadExportedInterface ( string filename ) : ReferenceScope

Read an existing PE File and return the exported interface (ie. anything that was specified as public). All the MetaData structures will be Refs.

ReadPEFile ( string filename ) : PEFile

Read a PE file and create all the data structures to represent it

ReadPublicClasses ( string filename ) : PEFile
SetCorFlags ( CorFlags flags ) : void

Set the flags (.corflags)

SetFileName ( string filename ) : void
SetIsDLL ( bool isDll ) : void

Specify if this PEFile is a .dll or .exe

SetNetVersion ( NetVersion nVer ) : void

Set the .NET version for this PE file

SetOutputDirectory ( string outputDir ) : void

Set the directory that the PE File will be written to. The default is the current directory.

SetOutputStream ( Stream output ) : void

Direct PE File output to an existing stream, instead of creating a new file.

SetSubSystem ( SubSystem subS ) : void

Set the subsystem (.subsystem) (Default is Windows Console mode)

WriteCILFile ( bool debug ) : void

Write out a CIL text file for this PE file

WritePEFile ( bool writePDB ) : void

Write out the PEFile (the "bake" function)

Приватные методы

Метод Описание
AddToFileList ( ) : void
AddToResourceList ( ManifestResource res ) : void
BuildMetaData ( ) : void
ReadPDBScope ( PDBScope scope, MergeBuffer mergeBuffer, Scope parent, MethodDef thisMeth ) : Scope
SetDLLFlags ( ushort dflags ) : void
SetThisAssembly ( Assembly assem ) : void

Описание методов

AddExternalManagedResource() публичный Метод

Add a managed resource from another assembly.
public AddExternalManagedResource ( ManifestResource mr, bool isPublic ) : void
mr ManifestResource
isPublic bool
Результат void

AddExternalManagedResource() публичный Метод

Add a managed resource from another assembly.
public AddExternalManagedResource ( string resName, AssemblyRef assem, bool isPublic ) : void
resName string The name of the resource
assem AssemblyRef The assembly where the resource is
isPublic bool Access for the resource
Результат void

AddExternalManagedResource() публичный Метод

Add a managed resource from another module in this assembly.
public AddExternalManagedResource ( string resName, ModuleRef mod, uint offset, bool isPublic ) : void
resName string The name of the resource
mod ModuleRef
offset uint
isPublic bool Access for the resource
Результат void

AddExternalManagedResource() публичный Метод

Add a managed resource from another file in this assembly.
public AddExternalManagedResource ( string resName, ResourceFile resFile, uint offset, bool isPublic ) : void
resName string The name of the resource
resFile ResourceFile
offset uint
isPublic bool Access for the resource
Результат void

AddManagedResource() публичный Метод

Add a managed resource to this PEFile. The resource will be embedded in this PE file.
public AddManagedResource ( string resName, byte resBytes, bool isPublic ) : void
resName string The name of the managed resource
resBytes byte The managed resource
isPublic bool Access for the resource
Результат void

AddUnmanagedResources() публичный Метод

Add a manifest resource to this PEFile
public AddUnmanagedResources ( string resFilename ) : void
resFilename string
Результат void

GetElement() публичный Метод

Get a Meta Data Element from this PE file
public GetElement ( uint token ) : MetaDataElement
token uint The meta data token for the required element
Результат MetaDataElement

GetFileName() публичный Метод

public GetFileName ( ) : string
Результат string

GetImportedAssemblies() публичный Метод

public GetImportedAssemblies ( ) : AssemblyRef[]
Результат AssemblyRef[]

GetNamesOfImports() публичный Метод

public GetNamesOfImports ( ) : string[]
Результат string[]

GetNetVersion() публичный Метод

Get the version of .NET for this PE file
public GetNetVersion ( ) : NetVersion
Результат NetVersion

GetNetVersionString() публичный Метод

Get the .NET version for this PE file
public GetNetVersionString ( ) : string
Результат string

GetResource() публичный Метод

Find a resource
public GetResource ( string name ) : ManifestResource
name string The name of the resource
Результат ManifestResource

GetResources() публичный Метод

public GetResources ( ) : PERWAPI.ManifestResource[]
Результат PERWAPI.ManifestResource[]

GetThisAssembly() публичный Метод

Get the descriptor for this assembly. The PEFile must have been created with hasAssembly = true
public GetThisAssembly ( ) : Assembly
Результат Assembly

MakeDebuggable() публичный Метод

Makes the assembly debuggable by attaching the DebuggableAttribute to the Assembly. Call immediately before calling WritePEFile.
public MakeDebuggable ( bool allowDebug, bool suppressOpt ) : void
allowDebug bool set true to enable debugging, false otherwise
suppressOpt bool set true to disable optimizations that affect debugging
Результат void

MakeExternAssembly() публичный Метод

Make a descriptor for an external assembly to this PEFile (.assembly extern)
public MakeExternAssembly ( string assemName ) : AssemblyRef
assemName string the external assembly name
Результат AssemblyRef

MakeExternModule() публичный Метод

Make a descriptor for an external module to this PEFile (.module extern)
public MakeExternModule ( string name ) : ModuleRef
name string the external module name
Результат ModuleRef

PEFile() публичный Метод

Create a new PE File with the name "fileName". If "fileName" ends in ".dll" then the file is a dll, otherwise it is an exe file. This PE File has no assembly.
public PEFile ( string fileName ) : System
fileName string Name for the output file.
Результат System

PEFile() публичный Метод

Create a new PE File with the name "fileName". If "fileName" ends in ".dll" then the file is a dll, otherwise it is an exe file. This file has an Assembly called "assemblyName".
public PEFile ( string fileName, string assemblyName ) : System
fileName string Name for the output file
assemblyName string Name of the assembly
Результат System

ReadExportedInterface() публичный статический Метод

Read an existing PE File and return the exported interface (ie. anything that was specified as public). All the MetaData structures will be Refs.
public static ReadExportedInterface ( string filename ) : ReferenceScope
filename string The name of the pe file
Результат ReferenceScope

ReadPEFile() публичный статический Метод

Read a PE file and create all the data structures to represent it
public static ReadPEFile ( string filename ) : PEFile
filename string The file name of the PE file
Результат PEFile

ReadPublicClasses() публичный статический Метод

public static ReadPublicClasses ( string filename ) : PEFile
filename string
Результат PEFile

SetCorFlags() публичный Метод

Set the flags (.corflags)
public SetCorFlags ( CorFlags flags ) : void
flags CorFlags the flags value
Результат void

SetFileName() публичный Метод

public SetFileName ( string filename ) : void
filename string
Результат void

SetIsDLL() публичный Метод

Specify if this PEFile is a .dll or .exe
public SetIsDLL ( bool isDll ) : void
isDll bool
Результат void

SetNetVersion() публичный Метод

Set the .NET version for this PE file
public SetNetVersion ( NetVersion nVer ) : void
nVer NetVersion .NET version
Результат void

SetOutputDirectory() публичный Метод

Set the directory that the PE File will be written to. The default is the current directory.
public SetOutputDirectory ( string outputDir ) : void
outputDir string The directory to write the PE File to.
Результат void

SetOutputStream() публичный Метод

Direct PE File output to an existing stream, instead of creating a new file.
public SetOutputStream ( Stream output ) : void
output Stream The output stream
Результат void

SetSubSystem() публичный Метод

Set the subsystem (.subsystem) (Default is Windows Console mode)
public SetSubSystem ( SubSystem subS ) : void
subS SubSystem subsystem value
Результат void

WriteCILFile() публичный Метод

Write out a CIL text file for this PE file
public WriteCILFile ( bool debug ) : void
debug bool include debug information
Результат void

WritePEFile() публичный Метод

Write out the PEFile (the "bake" function)
public WritePEFile ( bool writePDB ) : void
writePDB bool
Результат void