Process - Rob--/memoryjs GitHub Wiki
Details
Process Identifier
A processIdentifier
is required to open a process and begin reading or writing memory. This can either be the name of the process, or it's PID:
const processName = 'csgo.exe';
const processId = 1234;
Process Object
When opening a process, an object is returned with details about it.
{ dwSize: 304,
th32ProcessID: 10316,
cntThreads: 47,
th32ParentProcessID: 7804,
pcPriClassBase: 8,
szExeFile: "csgo.exe",
modBaseAddr: 1673789440,
handle: 808 }
This object is important as the handle
property is required to interact further with the process.
Functions
openProcess(processIdentifier[, callback])
- processIdentifier - either the process name, or the ID of the process
- callback - has two parameters:
- error - error message (if one occurred)
- processObject - object containing information about the process
returns (if no callback provided): object containing information about the process
Internally opens a handle to the process to be able to interact with it.
// synchronously
const processObject = memoryjs.openProcess(processIdentifier);
// asynchronously
memoryjs.openProcess(processIdentifier, (error, processObject) => {
});
getProcesses([callback])
- callback - has two parameters:
- error - error message (if one occurred)
- processes - array of process objects
returns (if no callback provided): array of process objects
Finds all the processes running on the system and returns information about them.
Get all processes:
// synchronously
const processes = memoryjs.getProcesses();
// asynchronously
memoryjs.getProcesses((error, processes) => {
});
closeProcess(handle)
- handle - the handle of the process, retrieved from calling
openProcess
Closes the handle on the opened process.
memoryjs.closeProcess(processObject.handle);