memory package

Submodules

Module contents

Provides binary/memory based functionality.

class memory.BinaryFile

Bases: instance

__init__()

Raises an exception This class cannot be instantiated from Python

find_address((BinaryFile)arg1, (object)identifier) Pointer :

Returns the address of a signature or symbol found in memory.

find_pointer((BinaryFile)arg1, (object)arg2[, (_engines._sound.Channel)offset=0[, (int)level=0]]) Pointer :

Rips out a pointer from a function.

property base

Base address of the binary.

property module

Handle of the binary.

property size

Size of the binary.

property symbols

Return a dict containing all symbols and their addresses.

class memory.Callback(*args, **kwargs)[source]

Bases: AutoUnload, Function

Decorator to create a function in memory to call a Python callback.

__init__(convention, arg_types, return_type)[source]

Initialize the Callback object.

Parameters:
  • convention (Convention|CallingConvention) – Calling convention that should be used for this callback.

  • arg_types (iterable) – Argument types of the callback.

  • return_type – Return type of the callback.

class memory.CallingConvention

Bases: instance

An an abstract class that is used to create custom calling conventions (only available for hooking function and not for calling functions).

__init__((object)arg1, (object)arg2, (DataType)arg3[, (_engines._sound.Channel)alignment=4[, (Convention)default_convention=_memory.Convention.CUSTOM]]) object :

Initialize the calling convention.

Parameters:
  • arg_types (iterable) – A list of DataType values that define the argument types of a function.

  • return_type (DataType) – The return type of a function.

  • alignment (int) – The stack alignment.

  • default_convention (Convention_t) – The default convention for un override function.

argument_ptr_changed((CallingConvention)arg1, (_engines._sound.Channel)index, (Registers)registers, (object)ptr) None :

Called when the argument pointer returned by get_argument_ptr() has been changed.

Parameters:
  • index (int) – The index of the argument that has been changed.

  • registers (Registers) – A snapshot of all saved registers.

  • ptr (Pointer) – The argument pointer that has been changed.

get_argument_ptr((CallingConvention)arg1, (_engines._sound.Channel)index, (Registers)registers) object :

Return a pointer to the argument at the given index.

Parameters:
  • index (int) – The index of the argument.

  • registers (Registers) – A snapshot of all saved registers.

get_pop_size((CallingConvention)arg1) int :

Return the number of bytes that should be added to the stack to clean up.

get_registers((CallingConvention)arg1) object :

Return a list of Register values. These registeres will be saved for later access.

get_return_ptr((CallingConvention)arg1, (Registers)registers) object :

Return a pointer to the return value.

Parameters:

registers (Registers) – A snapshot of all saved registers.

return_ptr_changed((CallingConvention)arg1, (Registers)registers, (object)ptr) None :

Called when the return value pointer returned by get_return_ptr() has been changed.

Parameters:
  • registers (Registers) – A snapshot of all saved registers.

  • ptr (Pointer) – The return value pointer that has been changed.

property alignment

An integer that defines the stack alignment.

property argument_types

A list of DataType values that define the argument types of a function.

property return_type

A DataType value that defines the return type of a function.

class memory.Convention

Bases: enum

CDECL = _memory.Convention.CDECL
CUSTOM = _memory.Convention.CUSTOM
FASTCALL = _memory.Convention.FASTCALL
STDCALL = _memory.Convention.STDCALL
THISCALL = _memory.Convention.THISCALL
names = {'CDECL': _memory.Convention.CDECL, 'CUSTOM': _memory.Convention.CUSTOM, 'FASTCALL': _memory.Convention.FASTCALL, 'STDCALL': _memory.Convention.STDCALL, 'THISCALL': _memory.Convention.THISCALL}
values = {0: _memory.Convention.CUSTOM, 1: _memory.Convention.CDECL, 2: _memory.Convention.THISCALL, 3: _memory.Convention.STDCALL, 4: _memory.Convention.FASTCALL}
class memory.DataType

Bases: enum

BOOL = _memory.DataType.BOOL
CHAR = _memory.DataType.CHAR
DOUBLE = _memory.DataType.DOUBLE
FLOAT = _memory.DataType.FLOAT
INT = _memory.DataType.INT
LONG = _memory.DataType.LONG
LONG_LONG = _memory.DataType.LONG_LONG
POINTER = _memory.DataType.POINTER
SHORT = _memory.DataType.SHORT
STRING = _memory.DataType.STRING
UCHAR = _memory.DataType.UCHAR
UINT = _memory.DataType.UINT
ULONG = _memory.DataType.ULONG
ULONG_LONG = _memory.DataType.ULONG_LONG
USHORT = _memory.DataType.USHORT
VOID = _memory.DataType.VOID
names = {'BOOL': _memory.DataType.BOOL, 'CHAR': _memory.DataType.CHAR, 'DOUBLE': _memory.DataType.DOUBLE, 'FLOAT': _memory.DataType.FLOAT, 'INT': _memory.DataType.INT, 'LONG': _memory.DataType.LONG, 'LONG_LONG': _memory.DataType.LONG_LONG, 'POINTER': _memory.DataType.POINTER, 'SHORT': _memory.DataType.SHORT, 'STRING': _memory.DataType.STRING, 'UCHAR': _memory.DataType.UCHAR, 'UINT': _memory.DataType.UINT, 'ULONG': _memory.DataType.ULONG, 'ULONG_LONG': _memory.DataType.ULONG_LONG, 'USHORT': _memory.DataType.USHORT, 'VOID': _memory.DataType.VOID}
values = {0: _memory.DataType.VOID, 1: _memory.DataType.BOOL, 2: _memory.DataType.CHAR, 3: _memory.DataType.UCHAR, 4: _memory.DataType.SHORT, 5: _memory.DataType.USHORT, 6: _memory.DataType.INT, 7: _memory.DataType.UINT, 8: _memory.DataType.LONG, 9: _memory.DataType.ULONG, 10: _memory.DataType.LONG_LONG, 11: _memory.DataType.ULONG_LONG, 12: _memory.DataType.FLOAT, 13: _memory.DataType.DOUBLE, 14: _memory.DataType.POINTER, 15: _memory.DataType.STRING}
class memory.Function

Bases: Pointer

__init__((object)arg1, (int)arg2, (object)arg3, (object)arg4, (object)arg5) None

__init__( (object)arg1, (Function)arg2) -> None

add_hook((Function)arg1, (HookType)hook_type, (object)callback) None :

Adds a hook callback.

add_post_hook((Function)arg1, (object)arg2) None :

Adds a post-hook callback.

add_pre_hook((Function)arg1, (object)arg2) None :

Adds a pre-hook callback.

call_trampoline()
object call_trampoline(tuple args, dict kwds) :

Calls the trampoline function dynamically.

is_callable((Function)arg1) bool :

Return True if the function is callable.

is_hookable((Function)arg1) bool :

Return True if the function is hookable.

is_hooked((Function)arg1) bool :

Return True if the function is hooked.

remove_hook((Function)arg1, (HookType)hook_type, (object)callback) None :

Removes a hook callback.

remove_post_hook((Function)arg1, (object)arg2) None :

Removes a post-hook callback.

remove_pre_hook((Function)arg1, (object)arg2) None :

Removes a pre-hook callback.

skip_hooks()
object skip_hooks(tuple args, dict kwds) :

Call the function, but skip hooks if there are any.

property arguments

None( (_memory.Function)arg1) -> tuple

property convention

None( (_memory.Function)arg1) -> object

property converter

None( (_memory.Function)arg1) -> object

property custom_convention

None( (_memory.Function)arg1) -> object

property return_type

None( (_memory.Function)arg1) -> object

property trampoline

Return the trampoline function if the function is hooked.

class memory.FunctionInfo

Bases: instance

__init__()

Raises an exception This class cannot be instantiated from Python

property argument_types

None( (_memory.FunctionInfo)arg1) -> tuple

property calling_convention

None( (_memory.FunctionInfo)arg1) -> object

property is_virtual

None( (_memory.FunctionInfo)arg1) -> bool

property return_type

None( (_memory.FunctionInfo)arg1) -> object

property this_pointer_offset

None( (_memory.FunctionInfo)arg1) -> int

property vtable_index

None( (_memory.FunctionInfo)arg1) -> int

property vtable_offset

None( (_memory.FunctionInfo)arg1) -> int

class memory.Pointer

Bases: instance

__init__((object)arg1[, (int)arg2[, (bool)arg3]]) None

__init__( (object)arg1, (Pointer)arg2) -> None

compare((Pointer)arg1, (object)other, (int)num) int :

Compares the first <num> bytes of both pointers. Returns 0 if they are equal. A value greater than zero indicates that the first byte that does not match in both pointers has a greater value in <self> than in <other>. A value less than zero indicates the opposite.

copy((Pointer)arg1, (object)destination, (int)num_bytes) None :

Copies <num_bytes> from <self> to the pointer <destination>. Overlapping is not allowed!

dealloc((object)arg1) None :

Deallocates a memory block.

get_bool((Pointer)arg1[, (_engines._sound.Channel)offset=0]) bool :

Returns the value at the given memory location.

get_char((Pointer)arg1[, (_engines._sound.Channel)offset=0]) str :

Returns the value at the given memory location.

get_double((Pointer)arg1[, (_engines._sound.Channel)offset=0]) float :

Returns the value at the given memory location.

get_float((Pointer)arg1[, (_engines._sound.Channel)offset=0]) float :

Returns the value at the given memory location.

get_int((Pointer)arg1[, (_engines._sound.Channel)offset=0]) int :

Returns the value at the given memory location.

get_long((Pointer)arg1[, (_engines._sound.Channel)offset=0]) int :

Returns the value at the given memory location.

get_long_long((Pointer)arg1[, (_engines._sound.Channel)offset=0]) int :

Returns the value at the given memory location.

get_pointer((Pointer)arg1[, (_engines._sound.Channel)offset=0]) Pointer :

Returns the value at the given memory location.

get_short((Pointer)arg1[, (_engines._sound.Channel)offset=0]) int :

Returns the value at the given memory location.

get_string_array((Pointer)arg1[, (_engines._sound.Channel)offset=0]) str :

Returns the value at the memory location.

get_string_pointer((Pointer)arg1[, (_engines._sound.Channel)offset=0]) str :

Returns the value at the given memory location.

get_uchar((Pointer)arg1[, (_engines._sound.Channel)offset=0]) int :

Returns the value at the given memory location.

get_uint((Pointer)arg1[, (_engines._sound.Channel)offset=0]) int :

Returns the value at the given memory location.

get_ulong((Pointer)arg1[, (_engines._sound.Channel)offset=0]) int :

Returns the value at the given memory location.

get_ulong_long((Pointer)arg1[, (_engines._sound.Channel)offset=0]) int :

Returns the value at the given memory location.

get_ushort((Pointer)arg1[, (_engines._sound.Channel)offset=0]) int :

Returns the value at the given memory location.

get_virtual_func((Pointer)arg1, (_engines._sound.Channel)index) Pointer :

Returns the address (as a Pointer instance) of a virtual function at the given index.

is_overlapping((Pointer)arg1, (object)destination, (int)num_bytes) bool :

Returns True if the pointers are overlapping each other.

make_function((Pointer)arg1, (object)convention, (object)arguments, (object)return_type) Function :

Creates a new Function instance.

make_function( (Pointer)arg1, (FunctionInfo)arg2) -> Function :

Use the given FunctionInfo object to convert the pointer into a Function object.

make_virtual_function((Pointer)arg1, (_engines._sound.Channel)index, (object)convention, (object)arguments, (object)return_type) Function :

Creates a new Function instance.

make_virtual_function( (Pointer)arg1, (FunctionInfo)arg2) -> Function :

Use the given FunctionInfo object to retrieve a virtual function and convert it into a Function object.

move((Pointer)arg1, (object)destination, (int)num_bytes) None :

Copies <num_bytes> from <self> to the pointer <destination>. Overlapping is allowed!

protect((Pointer)arg1, (_engines._sound.Channel)size) None :

Make the memory block read-only.

realloc((object)arg1, (_engines._sound.Channel)size) Pointer :

Reallocates a memory block.

search_bytes((Pointer)arg1, (object)bytes, (int)num_bytes) Pointer :

Searches within the first <num_bytes> of this memory block for the first occurence of <bytes> and returns a pointer it.

set_bool((Pointer)arg1, (bool)arg2[, (_engines._sound.Channel)offset=0]) None :

Sets the value at the given memory location.

set_char((Pointer)arg1, (str)arg2[, (_engines._sound.Channel)offset=0]) None :

Sets the value at the given memory location.

set_double((Pointer)arg1, (float)arg2[, (_engines._sound.Channel)offset=0]) None :

Sets the value at the given memory location.

set_float((Pointer)arg1, (float)arg2[, (_engines._sound.Channel)offset=0]) None :

Sets the value at the given memory location.

set_int((Pointer)arg1, (_engines._sound.Channel)arg2[, (_engines._sound.Channel)offset=0]) None :

Sets the value at the given memory location.

set_long((Pointer)arg1, (int)arg2[, (_engines._sound.Channel)offset=0]) None :

Sets the value at the given memory location.

set_long_long((Pointer)arg1, (int)arg2[, (_engines._sound.Channel)offset=0]) None :

Sets the value at the given memory location.

set_pointer((Pointer)arg1, (object)arg2[, (_engines._sound.Channel)offset=0]) None :

Sets the value at the given memory location.

set_protection((Pointer)arg1, (Protection)protection, (_engines._sound.Channel)size) None :

Set memory protection.

set_short((Pointer)arg1, (int)arg2[, (_engines._sound.Channel)offset=0]) None :

Sets the value at the given memory location.

set_string_array((Pointer)arg1, (str)arg2[, (_engines._sound.Channel)offset=0]) None :

Sets the value at the given memory location.

set_string_pointer((Pointer)arg1, (str)arg2[, (_engines._sound.Channel)offset=0]) None :

Sets the value at the given memory location.

set_uchar((Pointer)arg1, (int)arg2[, (_engines._sound.Channel)offset=0]) None :

Sets the value at the given memory location.

set_uint((Pointer)arg1, (int)arg2[, (_engines._sound.Channel)offset=0]) None :

Sets the value at the given memory location.

set_ulong((Pointer)arg1, (int)arg2[, (_engines._sound.Channel)offset=0]) None :

Sets the value at the given memory location.

set_ulong_long((Pointer)arg1, (int)arg2[, (_engines._sound.Channel)offset=0]) None :

Sets the value at the given memory location.

set_ushort((Pointer)arg1, (int)arg2[, (_engines._sound.Channel)offset=0]) None :

Sets the value at the given memory location.

unprotect((Pointer)arg1, (_engines._sound.Channel)size) None :

Make the memory block read-, write- and executable.

property address

None( (_memory.Pointer)arg1) -> int

property auto_dealloc

None( (_memory.Pointer)arg1) -> bool

property size

Returns the size of the memory block.

property type_info

None( (_memory.Pointer)arg1) -> object

class memory.ProcessorRegister

Bases: instance

__init__()

Raises an exception This class cannot be instantiated from Python

property address

None( (_memory.ProcessorRegister)arg1) -> _memory.Pointer

property size

None( (_memory.ProcessorRegister)arg1) -> int

class memory.Register

Bases: enum

AH = _memory.Register.AH
AL = _memory.Register.AL
AX = _memory.Register.AX
BH = _memory.Register.BH
BL = _memory.Register.BL
BP = _memory.Register.BP
BX = _memory.Register.BX
CH = _memory.Register.CH
CL = _memory.Register.CL
CS = _memory.Register.CS
CX = _memory.Register.CX
DH = _memory.Register.DH
DI = _memory.Register.DI
DL = _memory.Register.DL
DS = _memory.Register.DS
DX = _memory.Register.DX
EAX = _memory.Register.EAX
EBP = _memory.Register.EBP
EBX = _memory.Register.EBX
ECX = _memory.Register.ECX
EDI = _memory.Register.EDI
EDX = _memory.Register.EDX
ES = _memory.Register.ES
ESI = _memory.Register.ESI
ESP = _memory.Register.ESP
FS = _memory.Register.FS
GS = _memory.Register.GS
MM0 = _memory.Register.MM0
MM1 = _memory.Register.MM1
MM2 = _memory.Register.MM2
MM3 = _memory.Register.MM3
MM4 = _memory.Register.MM4
MM5 = _memory.Register.MM5
MM6 = _memory.Register.MM6
MM7 = _memory.Register.MM7
SI = _memory.Register.SI
SP = _memory.Register.SP
SS = _memory.Register.SS
ST0 = _memory.Register.ST0
XMM0 = _memory.Register.XMM0
XMM1 = _memory.Register.XMM1
XMM2 = _memory.Register.XMM2
XMM3 = _memory.Register.XMM3
XMM4 = _memory.Register.XMM4
XMM5 = _memory.Register.XMM5
XMM6 = _memory.Register.XMM6
XMM7 = _memory.Register.XMM7
names = {'AH': _memory.Register.AH, 'AL': _memory.Register.AL, 'AX': _memory.Register.AX, 'BH': _memory.Register.BH, 'BL': _memory.Register.BL, 'BP': _memory.Register.BP, 'BX': _memory.Register.BX, 'CH': _memory.Register.CH, 'CL': _memory.Register.CL, 'CS': _memory.Register.CS, 'CX': _memory.Register.CX, 'DH': _memory.Register.DH, 'DI': _memory.Register.DI, 'DL': _memory.Register.DL, 'DS': _memory.Register.DS, 'DX': _memory.Register.DX, 'EAX': _memory.Register.EAX, 'EBP': _memory.Register.EBP, 'EBX': _memory.Register.EBX, 'ECX': _memory.Register.ECX, 'EDI': _memory.Register.EDI, 'EDX': _memory.Register.EDX, 'ES': _memory.Register.ES, 'ESI': _memory.Register.ESI, 'ESP': _memory.Register.ESP, 'FS': _memory.Register.FS, 'GS': _memory.Register.GS, 'MM0': _memory.Register.MM0, 'MM1': _memory.Register.MM1, 'MM2': _memory.Register.MM2, 'MM3': _memory.Register.MM3, 'MM4': _memory.Register.MM4, 'MM5': _memory.Register.MM5, 'MM6': _memory.Register.MM6, 'MM7': _memory.Register.MM7, 'SI': _memory.Register.SI, 'SP': _memory.Register.SP, 'SS': _memory.Register.SS, 'ST0': _memory.Register.ST0, 'XMM0': _memory.Register.XMM0, 'XMM1': _memory.Register.XMM1, 'XMM2': _memory.Register.XMM2, 'XMM3': _memory.Register.XMM3, 'XMM4': _memory.Register.XMM4, 'XMM5': _memory.Register.XMM5, 'XMM6': _memory.Register.XMM6, 'XMM7': _memory.Register.XMM7}
values = {0: _memory.Register.AL, 1: _memory.Register.CL, 2: _memory.Register.DL, 3: _memory.Register.BL, 4: _memory.Register.AH, 5: _memory.Register.CH, 6: _memory.Register.DH, 7: _memory.Register.BH, 8: _memory.Register.AX, 9: _memory.Register.CX, 10: _memory.Register.DX, 11: _memory.Register.BX, 12: _memory.Register.SP, 13: _memory.Register.BP, 14: _memory.Register.SI, 15: _memory.Register.DI, 16: _memory.Register.EAX, 17: _memory.Register.ECX, 18: _memory.Register.EDX, 19: _memory.Register.EBX, 20: _memory.Register.ESP, 21: _memory.Register.EBP, 22: _memory.Register.ESI, 23: _memory.Register.EDI, 24: _memory.Register.MM0, 25: _memory.Register.MM1, 26: _memory.Register.MM2, 27: _memory.Register.MM3, 28: _memory.Register.MM4, 29: _memory.Register.MM5, 30: _memory.Register.MM6, 31: _memory.Register.MM7, 32: _memory.Register.XMM0, 33: _memory.Register.XMM1, 34: _memory.Register.XMM2, 35: _memory.Register.XMM3, 36: _memory.Register.XMM4, 37: _memory.Register.XMM5, 38: _memory.Register.XMM6, 39: _memory.Register.XMM7, 40: _memory.Register.CS, 41: _memory.Register.SS, 42: _memory.Register.DS, 43: _memory.Register.ES, 44: _memory.Register.FS, 45: _memory.Register.GS, 46: _memory.Register.ST0}
class memory.Registers

Bases: instance

__init__()

Raises an exception This class cannot be instantiated from Python

property ah

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property al

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property ax

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property bh

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property bl

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property bp

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property bx

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property ch

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property cl

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property cs

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property cx

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property dh

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property di

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property dl

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property ds

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property dx

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property eax

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property ebp

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property ebx

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property ecx

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property edi

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property edx

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property es

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property esi

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property esp

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property fs

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property gs

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property mm0

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property mm1

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property mm2

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property mm3

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property mm4

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property mm5

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property mm6

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property mm7

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property si

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property sp

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property ss

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property st0

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property xmm0

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property xmm1

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property xmm2

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property xmm3

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property xmm4

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property xmm5

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property xmm6

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

property xmm7

None( (_memory.Registers)arg1) -> _memory.ProcessorRegister

class memory.StackData

Bases: instance

__init__((object)arg1, (object)arg2) None
property registers

None( (_memory.StackData)arg1) -> object

property return_address

Return the ‘return address’ to which DynamicHooks will jump after the post-hook has finished.

property use_pre_registers

None( (_memory.StackData)arg1) -> bool

memory.alloc((_engines._sound.Channel)arg1[, (bool)auto_dealloc=True]) Pointer :

Allocate a memory block.

Parameters:
  • size (int) – The size (in bytes) of the memory block.

  • auto_dealloc (bool) – If True the memory block will be deallocated automatically when the return value goes out of the scope.

memory.find_binary((str)arg1[, (bool)srv_check=True[, (bool)check_extension=True]]) BinaryFile :

Search for a binary and return it as a BinaryFile object.

Parameters:
  • path (str) – The path to the binary file (absolute, relative or just the name of the file if it’s on the search path).

  • srv_check (bool) – If True it will automatically check the binary for the ‘_srv’ ending on Linux.

memory.get_class(classname)[source]

Return the class of an exposed class by its C++ class name.

Parameters:

classname (str) – The name of the exposed class on the C++ side.

Raises:

KeyError – Raised if the classname is not the name of an exposed class.

memory.get_class_info(cls)[source]

Return the class info dictionary of a class.

Parameters:

cls (str) – A string that defines the name of the class on the C++ side or an exposed class or an object of an exposed class.

Raises:

ValueError – See get_class_name().

memory.get_class_name(cls)[source]

Return the name of a class or class object on the C++ side.

Parameters:

cls – A class or class object.

Raises:

ValueError – Raised if the class was not exposed by Source.Python.

memory.get_data_type_size((DataType)arg1[, (_engines._sound.Channel)alignment=4]) int :

Return the size of the data type after applying alignment.

Parameters:
  • data_type (DataType) – The data type you would like to get the size of.

  • alignment (int) – The alignment that should be used.

memory.get_function_info(cls, function_name, function_index=0)[source]

Return the FunctionInfo object of a member function.

Parameters:
  • cls (str) – See get_class_info().

  • function_name (str) – The name of the member function on the C++ side.

  • function_index (int) – The index of the member function in the function info list. This is only required if the function is overloaded and you want to get a different FunctionInfo object than the first one.

Raises:

ValueError – See get_class_name().

memory.get_object_pointer((object)obj) object :

Return the pointer of the C++ object of a given Python object.

Parameters:

obj – The object you want to retrieve a pointer from.

memory.get_size((object)cls) object :

Return the size of a class or class object of its C++ class.

Parameters:

cls – A class or class object.

memory.get_virtual_function(obj, function_name, function_index=0)[source]

Return a Function object.

Create the Function object by using a FunctionInfo object.

Parameters:
Raises:

ValueError – See get_class_name().

memory.make_object((object)cls, (object)ptr) object :

Wrap a pointer using an exposed class.

param cls:

The class that should be used to wrap the pointer.

param Pointer ptr:

The pointer that should be wrapped.

make_object( (object)cls, (Pointer)ptr) -> object :

Wrap a pointer using an exposed class.

param cls:

The class that should be used to wrap the pointer.

param Pointer ptr:

The pointer that should be wrapped.