Skip to content

InjectConnector ​

Connector that edits memory and injects code into a process using ConnectorLib.Inject.ProcessLink. This is the base/host class for all inject-type connectors.

Kind: Class

Namespace: ConnectorLib.Inject

Inheritance: ConnectorBase → IAddressableConnector → IDisposable → IDomainMappableConnector → IDomainMappableConnector\<InjectConnector\> → IGameConnector → IPCConnector → IScannableConnector

Public Constructors

InjectConnector()

Public Member Functions

virtual override

Task>

Connect()

virtual override

Task

Disconnect(string message)

virtual override

bool

SendMessage(string text)

bool

TryGetRegion(IntPtr address, MEMORY_BASIC_INFORMATION out info)

Gets information about a memory region at the specified address.

IEnumerable

GetRegions()

Gets information about all memory regions in the process.

IEnumerable

GetRegions(IntPtr address)

Gets information about all memory regions in the process.

long[]

ScanForBytes(ReadOnlySpan scanFor, ReadOnlySpan mask, bool oneOnly = true, ScanHint hint = None, long? startAddress = null, long? endAddress = null)

ulong[]

ScanForBytes(ReadOnlySpan scanFor, ReadOnlySpan mask, bool oneOnly = true, ScanHint hint = None, ulong? startAddress = null, ulong? endAddress = null)

IAsyncEnumerable

ScanForBytesAsync(byte[] scanFor, string mask, int threadCount = 16, ScanHint hint = None, long? startAddress = null, long? endAddress = null)

IAsyncEnumerable

ScanForBytesAsync(byte[] scanFor, string mask, int threadCount = 16, ScanHint hint = None, ulong? startAddress = null, ulong? endAddress = null)

bool

ReadMemory(long address, byte[] buffer)

bool

ReadMemory(long address, byte[] buffer, int offset, int length)

bool

ReadMemory(long address, Span buffer)

bool

ReadMemory(long address, Span buffer, int offset, int length)

bool

WriteMemory(long address, byte[] buffer)

bool

WriteMemory(long address, byte[] buffer, int offset, int length)

bool

WriteMemory(long address, ReadOnlySpan buffer)

bool

WriteMemory(long address, ReadOnlySpan buffer, int offset, int length)

bool

MemoryTest()

long

InjectASMSimple(ulong trampoline, ulong codeCaveAddress, byte[] byteCode, uint stolenBytesLength = 0)

long

InjectASMSimple(long trampoline, long codeCaveAddress, byte[] byteCode, int stolenBytesLength = 0)

long

InjectASMSimple(ulong trampoline, byte[] byteCode, uint stolenBytesLength = 0)

long

InjectASMSimple(long trampoline, byte[] byteCode, int stolenBytesLength = 0)

byte[]

InsertCallLong(ulong trampoline, ulong codeCaveAddress, uint stolenBytesLength = 0)

Inserts an absolute CALL instruction at the specified trampoline address to the specified code cave address.

byte[]

InsertJumpLong(ulong trampoline, ulong codeCaveAddress, uint stolenBytesLength = 0)

Inserts an absolute JMP instruction at the specified trampoline address to the specified code cave address.

byte[]

InsertCallRelative(ulong trampoline, ulong codeCaveAddress, uint stolenBytesLength = 5)

Inserts a relative CALL instruction at the specified trampoline address to the specified code cave address.

byte[]

InsertJumpRelative(ulong trampoline, ulong codeCaveAddress, uint stolenBytesLength = 5)

Inserts a relative JMP instruction at the specified trampoline address to the specified code cave address.

long

InjectASMNear(ulong trampoline, ulong codeCaveAddress, byte[] byteCode, uint stolenBytesLength = 0)

long

InjectASMNear(long trampoline, long codeCaveAddress, byte[] byteCode, int stolenBytesLength = 0)

long

InjectASMNear(ulong trampoline, byte[] byteCode, uint stolenBytesLength = 0)

long

InjectASMNear(long trampoline, byte[] byteCode, int stolenBytesLength = 0)

byte[]

InjectASM(ulong startAddress, byte[] byteCode, uint stolenBytesLength)

byte[]

InjectASM(long trampoline, byte[] byteCode, int stolenBytesLength)

IntPtr

AllocateCodeCave(long length)

Allocates a code cave in the target process.

IntPtr

AllocateCodeCave(long length, IntPtr out regionBaseAddress)

Allocates a code cave in the target process.

IntPtr

AllocateCodeCaveNear(long length, IntPtr nearAddress)

Allocates a code cave near the specified address in the target process.

IntPtr

AllocateCodeCaveNear(long length, IntPtr nearAddress, IntPtr out regionBaseAddress)

Allocates a code cave near the specified address in the target process.

ASMContext

GetASMContext(ASMArchitecture architecture)

Creates a new ASMContext for the given architecture.

T

Call<T>(string funcName, object[] parameters = null, bool varParams = false)

object

Call(string funcName, object[] parameters = null, bool varParams = false, Type resultType = null)

T

Call<T>(string moduleName, string funcName, object[] parameters = null, bool varParams = false)

object

Call(string moduleName, string funcName, object[] parameters = null, bool varParams = false, Type resultType = null)

T

Call<T>(Func moduleDiscriminator, string funcName, object[] parameters = null, bool varParams = false)

object

Call(Func moduleDiscriminator, string funcName, object[] parameters = null, bool varParams = false, Type resultType = null)

T

Call<T>(IntPtr funcPtr, object[] parameters = null, bool varParams = false)

object

Call(IntPtr funcPtr, object[] parameters = null, bool varParams = false, Type resultType = null)

bool

TryCall<T>(string funcName, object[] parameters, bool varParams, T out result)

bool

TryCall(string funcName, object[] parameters, bool varParams, Type resultType, object out result)

bool

TryCall<T>(string moduleName, string funcName, object[] parameters, bool varParams, T out result)

bool

TryCall(string moduleName, string funcName, object[] parameters, bool varParams, Type resultType, object out result)

bool

TryCall<T>(Func moduleDiscriminator, string funcName, object[] parameters, bool varParams, T out result)

bool

TryCall(Func moduleDiscriminator, string funcName, object[] parameters, bool varParams, Type resultType, object out result)

bool

TryCall<T>(IntPtr funcPtr, object[] parameters, bool varParams, T out result)

bool

TryCall(IntPtr funcPtr, object[] parameters, bool varParams, Type resultType, object out result)

ulong[]

ScanForBytes(ReadOnlySpan scanFor, ReadOnlySpan mask, bool oneOnly = true, ulong? startAddress = null, ulong? endAddress = null)

bool

TryReadNullTerminatedASCIIString(IntPtr addr, int maxLength, string out result)

Reads a null-terminated ASCII string from the specified address.

bool

TryReadNullTerminatedUTF8String(IntPtr addr, int maxLength, string out result)

Reads a null-terminated UTF-8 string from the specified address.

bool

TryReadNullTerminatedUTF16String(IntPtr addr, int maxLength, string out result)

Reads a null-terminated UTF-16 string from the specified address.

bool

TryReadLengthPrefixedASCIIString(IntPtr addr, int lengthSize, string out result)

Reads a length-prefixed ASCII string from the specified address.

bool

TryReadLengthPrefixedUTF8String(IntPtr addr, int lengthSize, string out result)

Reads a length-prefixed UTF-8 string from the specified address.

bool

TryReadLengthPrefixedUTF16String(IntPtr addr, int lengthSize, string out result)

Reads a length-prefixed UTF-16 string from the specified address.

Properties

VersionProfile

VersionProfile

[, set]

List of version profiles to check for the game.

List

VersionProfiles

[get, set]

List of version profiles to check for the game.

VersionProfile

ActiveVersionProfile

[get, ]

Version profile that was successfully injected.

bool

Is32Bit

[get, ]

Indicates whether the connected process is 32-bit.

bool

Is64Bit

[get, ]

Indicates whether the connected process is 64-bit.

PointerFormat

PointerFormat

[get, set]

Format to use when reading/writing pointers in the target process.

PointerFormat

RelativePointerFormat

[get, set]

AOBScanMode

AOBScanMode

[get, set]

Mode to use when scanning for byte patterns.

int

AOBThreads

[get, set]

Number of threads to use for asynchronous AOB scans.

ProcessLink

Connector

[get, set]

A ConnectorLib.Inject.ProcessLink representing the process to attach to.

IEnumerable

ProcessModules

[get, ]

Gets the modules loaded in the target process.

CallMutexType

CallMutexMode

[get, set]

bool

Connected

[get, ]

IFeatureAware

Features

[get, ]

IMemoryMapper

Mapper

[get, set]