-
Notifications
You must be signed in to change notification settings - Fork 88
Memory
Robert edited this page Apr 2, 2019
·
2 revisions
When calling certain functions a process handle is required. This is found by calling the openProcess
function on a process.
Some functions also require a dataType
parameter to denote the type of data being read or written. This can either be a string, or a constant from within the library:
Data Type | String | Constant |
---|---|---|
byte | "byte" | memoryjs.BYTE |
int | "int" | memoryjs.INT |
32 bit signed integer | "int32" | memoryjs.INT32 |
32 bit unsigned integer | "uint32" | memoryjs.UINT32 |
64 bit signed integer | "int64" | memoryjs.INT64 |
64 bit unsigned integer | "uint64" | memoryjs.UINT64 |
dword (uint32) | "dword" | memoryjs.DWORD |
short (int16) | "short" | memoryjs.SHORT |
long (int32) | "long" | memoryjs.LONG |
float | "float" | memoryjs.FLOAT |
double | "double" | memoryjs.DOUBLE |
boolean | "bool" | memoryjs.BOOL |
boolean | "boolean" | memoryjs.BOOLEAN |
pointer | "ptr" | memoryjs.PTR |
pointer | "pointer" | memoryjs.POINTER |
string | "str" | memoryjs.STR |
string | "string" | memoryjs.STRING |
vector3 | "vec3" | memoryjs.VEC3 |
vector3 | "vector3" | memoryjs.VECTOR3 |
vector4 | "vec4" | memoryjs.VEC4 |
vector4 | "vector4" | memoryjs.VECTOR4 |
When using the vector3
or vector4
data types, the library expects certain standard forms.
Vector3 is a data structure of three floats:
const vector3 = { x: 0.0, y: 0.0, z: 0.0 };
Vector4 is a data structure of four floats:
const vector4 = { w: 0.0, x: 0.0, y: 0.0, z: 0.0 };
-
handle - the handle of the process, retrieved from calling
openProcess
- address - the address in memory to read from
- dataType - the type of data being read
-
callback - has two parameters:
- error - error message (if one occurred)
- value - the value read from memory
returns (if no callback provided): the value read from memory
Reads the memory at a given address.
// synchronously
const value = memoryjs.readMemory(processObject.handle, address, dataType);
// asynchronously
memoryjs.readMemory(processObject.handle, address, dataType, (error, value) => {
});
-
handle - the handle of the process, retrieved from calling
openProcess
- address - the address in memory to write to
- value - the data to write to memory
- dataType - the type of data being written
-
callback - has two parameters:
- error - error message (if one occurred)
memoryjs.writeMemory(processObject.handle, address, value, dataType);