IProcessControl interface
The API is defined in the header file sysroot-*-kos/include/alm/execution_manager/i_process_control.h
from the KasperskyOS SDK.
The API lets you do the following:
- Start a process from an executable file installed by the PackageManager component from the KPA package in a KasperskyOS-based solution.
- Get information about process, including information about its termination.
- Stop a process.
Information about API functions is provided in the table below.
Starting a process
To start the process, call the StartProcess()
function. Using the opts
input parameter, this function accepts process startup parameters in the StartOptions
structure. All fields of this structure are optional for initialization.
During initialization of the StartOptions
structure, the parent
handle transport container is populated with the default values, which indicate the absence of a parent process. You can create a process hierarchy by passing the handle of a parent process in this parameter to a started child process.
The userHandles
vector is a component of the StartOptions
structure and contains a list of custom handles that will be transferred to the process when it is started. Items of this list are pairs that are defined in the UserHandleItem
structure. These pairs consist of a handle and its name. After a process is started, the handles transferred to this process can be found by using the KosTaskLookupResource()
function based on the names of these handles.
The input parameters pkgId
and runConfigId
of the StartProcess()
function are defined in the KPA package manifest. Their values may be received by using functions from the IPackageManifest interface of the PackageManager component.
Stopping a process
To stop the process, call the StopProcess()
function. Using the stopPolicy
input parameter, this function receives the process stop policy from the StopPolicy
enumeration.
Receiving information about a process
To request information about a process, call the GetProcessState()
function. Using the state
output parameter, this function returns information about a process in the ProcessContext
structure.
The state
enumeration is a component of the ProcessContext
structure and describes the state of a process.
The exitStatus
enumeration is a component of the ProcessContext
structure and describes the reason for stopping a process. The ExecutableExitStatus
enumeration is defined in the header file sysroot-*-kos/include/alm/execution_manager/execution_manager_types.h
from the KasperskyOS SDK.
The numeric exitCode
parameter is a component of the ProcessContext
structure and contains the return code for a process that stopped on its own, including after receiving a stop signal. The values for this return code are defined by the developer of the KasperskyOS-based solution.
The numeric exitReason
parameter is a component of the ProcessContext
structure and contains the return code that specifies the reason for an unsuccessful attempt to start the process, or rcOk
if the startup was successful. Parameter is defined in the header file sysroot-*-kos/include/rtl_cpp/retcode.h
from the KasperskyOS SDK. This file contains return codes that are common for the APIs of all solution components and their constituent parts (see Return codes).
i_process_control.h functions
Function |
Information about the function |
---|---|
|
Purpose Starts a process. Parameters
Returned values If successful, the function returns |
|
Purpose Stops a process. Parameters
Returned values If successful, the function returns |
|
Purpose Requests information about a process. Parameters
Returned values If successful, the function returns |
Usage example:
client.cpp