Processes and threads

EsProcessCreate

EsError EsProcessCreate(const EsProcessCreationArguments *arguments, EsProcessInformation *information);

Creates a new process from arguments. information receives the process handle and the main thread handle. Close both handles.

EsProcessGetExitStatus

int EsProcessGetExitStatus(EsHandle process);

Returns the exit status of the process.

EsProcessGetID

EsObjectID EsProcessGetID(EsHandle process);

Returns the process ID.

EsProcessGetState

void EsProcessGetState(EsHandle process, EsProcessState *state);

Fills state with the process state: ID, executable state, crash reason, and flags.

EsProcessGetCreateData

void EsProcessGetCreateData(EsProcessCreateData *data);

For the current process.

EsProcessOpen

EsHandle EsProcessOpen(EsObjectID pid);

Opens a handle to the process with ID pid. Requires the process-open permission. Returns ES_INVALID_HANDLE if the process does not exist.

EsProcessPause

void EsProcessPause(EsHandle process, bool resume);

Pauses the process, or resumes it if resume is true.

EsProcessTerminate

void EsProcessTerminate(EsHandle process, int status);

Terminates the process with the given exit status.

EsProcessTerminateCurrent

void EsProcessTerminateCurrent();

Terminates the current process.

EsThreadCreate

EsError EsThreadCreate(EsThreadEntryCallback entryFunction, EsThreadInformation *information, EsGeneric argument);

Creates a new thread that calls entryFunction with argument. information receives the handle and thread ID; it is optional, and the handle is closed if it is omitted.

EsThreadGetID

EsObjectID EsThreadGetID(EsHandle thread);

Returns the ID of the thread. Pass ES_CURRENT_THREAD for the current thread.

EsThreadTerminate

void EsThreadTerminate(EsHandle thread);

Terminates the thread.

EsWorkQueue

EsError EsWorkQueue(EsWorkCallback callback, EsGeneric context);

Queues callback to run on a worker thread. Returns an error code.

EsWorkIsExiting

bool EsWorkIsExiting();

Returns true if the work queue is shutting down. Work callbacks should check this.