Difference between revisions of "Mono:Mono Lua"

From Cheat Engine
Jump to navigation Jump to search
(improved mono_invoke_method parameter)
m (Reverted edits by This content is not available (Talk) to last revision by Igromanru)
(4 intermediate revisions by 2 users not shown)
Line 105: Line 105:
:JIT a method if it wasn't compiled yet (??return value address of assembly??)
:JIT a method if it wasn't compiled yet, returns the address of the method
Line 124: Line 124:
:loads a c# assembly in the target process
:loads a c# assembly in the target process
;mono_invoke_method(''domainId', ''methodId'', ''objectId'', ''args...'')
;mono_invoke_method(''domainId'', ''methodId'', ''address'', ''args...'')
:Lets you invoke a method with the given arguments. args is a tablearray of record with value and type
:Lets you invoke a method with the given arguments. args is a tablearray of record with value and type

Latest revision as of 14:10, 18 March 2019

This entry needs a lot of work. Please contribute if you can.

Check this page to see if there are some suggestions for adding to Mono:Mono Lua.

The advanced Mono features of Cheat Engine are controlled by the "monoscript.lua" script in the autorun directory where cheat engine is installed. When you attach to a process, the script scans for "mono.dll". If it is found, the appropriate MonoDataDissector dll from the autorun directory is injected into the process which creates a named pipe waiting for a connection. The LUA code then connects to the pipe and messages are exchanged to perform the mono functions.

Main Methods[edit]

injects the dll and returns 0 for failure, or monoBase returned from the CMD_INITMONO command on the pipe
varType = monoTypeToVarType(monoType)
Returns the Cheat Engine type (vtString, vtByte, vtWorkd, vtDword, vtSingle, vtDouble, vtPointer) for the given mono type
returns classId, className of the class at the given address in memory
returns a table array of domainaddress for each domain in the game
returns ? (result of MONOCMD_SETCURRENTDOMAIN)
sets the domain the MonoDataCollector will use
returns table of assemblyId for each assembly in the current domain from the MonoDataCollector
returns the imageId for the passed assembly
returns the name of the assembly with the given imageId
returns a table of classId for classes in the given assembly image
returns the class name as a string
returns the namespace of the given class as a string
returns the classId of the parent class of the given class
mono_class_getStaticFieldAddress(domainId, classId)
returns the base address for a special area that stores static addresses for a given class. For example if you have a class that has 5 static fields, their offsets will be added to this base address to get the memory location
returns a table of field objects for fields in the given class
field - the field id
type - ?? the Cheat Engine type? (i.e. vtByte, vtWord, vtString, etc?)
monotype - ?? the mono type?
parent - ?? the class id?
offset - the offset in bytes from the structure base address
flags - ??
isStatic - true/false - if true, offset is into static address, use mono_class_getStaticFieldAddress
name - field name
typename - name of the type with namespace (i.e. "System.Int32")
returns a table of method objects for the methods in the given class
method - method id
name - string name of the method
returns a result object with the properties given the address of code in memory
method - the method id
code_start - address where method code begins
code_size - length of code in bytes
mono_image_findClass(imageId, namespace, className)
returns the classId of the given class name and namespace in an image
mono_findClass(namespace, className)
returns the classId of the given class name and namespace
mono_class_findMethod(classId, methodName)
returns the methodId of a certain method in a class
mono_findMethod(namespace, className, methodName)
returns the methodId of a certain method, calls mono_image_findClass and mono_class_findMethod
returns the name of a method given the id
returns a headerId??
returns result, parameternames, returntype
result - ?? string
parameterNames - table of strings representing parameter names
returnType - string?? - mono type string?
returns a string - ?? the IL code ??
returns the classId a method belongs in
JIT a method if it wasn't compiled yet, returns the address of the method
(no return value) - only works on dynamic method, and only if profiler isn't being used
returns address, size
address - address of start of IL code?
size - size of IL code?
combination of mono_method_getHeader and mono_methodheader_getILCode
mono_iamge_rva_map(imageId, offset)
?? not sure what this is ??
loads a c# assembly in the target process
mono_invoke_method(domainId, methodId, address, args...)
Lets you invoke a method with the given arguments. args is a tablearray of record with value and type

Cheat Engine Hooks[edit]

sets up hooks, calls old open process hook if there was one, calls syncrhonize("mono_OpenProcessMT")
if parameter is not nil, calls t.destroy(), enumerates modules looking for 'mono.dll', adds menu item to cheat engine main form
mono_structureDissectOverrideCallback(structure, baseaddress)
Called by CE when a structure is being dissected to fill in the values if we know the structure
Returns true if the structure members were defined, nil if not
Calls mono_object_findRealStartOfObject(baseaddress), mono_class_enumFields(classaddress), monoTypeToVarType(monotype)
Returns classname,currentaddress (the real base address) or nil
Called by CE when creating a new structure in the structure dissector
returns pointer or nil
called by CE when it is trying to find the address to go with a symbol
calls mono_findMethod and mono_compile_method
returns string
called by CE in the disassembly window to show a symbol name for the address
calls mono_getJitInfo(address), mono_method_getClass(method), mono_class_GetName(class), mono_class_GetNamespace(class), mono_method_getName(method)

Mono Dissector Methods[edit]

mono_TVExpanding(sender, node)
mono_TVCollapsing(sender, node)

See also[edit]