Location:
e32std.h
Link against: euser.lib
RProcess
Supported from 5.0
A handle to a process. The process itself is a Kernel object.
|
Defined in RProcess
:
CommandLine()
, CommandLineLength()
, Create()
, ExitCategory()
, ExitReason()
, ExitType()
, FileName()
, GetRamSizes()
, Id()
, Kill()
, LoadedFromRam()
, Logon()
, LogonCancel()
, Open()
, Owner()
, Panic()
, Priority()
, Protected()
, RProcess()
, Rename()
, Resume()
, SetOwner()
, SetPriority()
, SetProtected()
, SetType()
, Type()
Inherited from RHandleBase
:
Close()
,
Duplicate()
,
Handle()
,
SetHandle()
RProcess();
Constructs this object.
The constructor exists to initialise private data within this handle; it does not create the process object.
Specifically, it sets the handle-number to the value
KCurrentProcessHandle
, defined in e32std.h.
In effect, construction of a RProcess
creates a default process
handle.
TInt Create(const TDesC& aFileName,const TDesC& aCommand,const TUidType& aUidType, TOwnerType aType=EOwnerProcess);
TInt Create(const TDesC& aFileName,const TDesC& aCommand,TOwnerType aType=EOwnerProcess);
Starts a new process, loading the specified executable which matches the specified UID type.
The executable can be in ROM or RAM.
By default, ownership of this process handle is vested in the
current process, but can be vested in the current thread by passing
EOwnerThread
as the second parameter to this
function.
|
|
TInt Open(const TDesC& aName,TOwnerType aType=EOwnerProcess);
Opens a handle to a specifically named process.
By default, ownership of this process handle is vested in the
current process, but can be vested in the current thread by passing
EOwnerThread
as the second parameter to this
function.
|
|
TInt Open(const TFindProcess& aFind,TOwnerType aType=EOwnerProcess);
Opens a handle to the process found by pattern matching a name.
A TFindProcess
object is used to find all processes
whose full names match a specified pattern.
By default, ownership of this process handle is vested in the current
process, but can be vested in the current thread by passing
EOwnerThread
as the second parameter to this
function.
|
|
TInt Open(TProcessId aId,TOwnerType aType=EOwnerProcess);
Opens a handle to the process whose process Id matches a specific process ID.
By default, ownership of this process handle is vested in the current
process, but can be vested in the current thread by passing
EOwnerThread
as the second parameter to this
function.
|
|
TInt Rename(const TDesC& aName);
Assigns a new name to this process, replacing any existing name.
When a process is created, its default name is the name portion of the filename from which the executable is loaded.
Any attempt to rename a process which is protected and is different from
the process invoking this function, causes the rename operation to fail. A
process can call Rename()
on itself whether it is protected or
not.
The new name must be a valid name and it must also be such that the process's new fullname remains unique amongst processes.
|
|
TProcessPriority Priority() const;
Returns the priority of this process.
|
void SetPriority(TProcessPriority aPriority) const;
Sets the priority of this process to one of the values defined by
theTProcessPriority
enumeration. The priority can be set to one of
the four values:
EPriorityLow
EPriorityBackground
EPriorityForeground
EPriorityHigh
The absolute priority of all threads owned by the process (and all threads owned by those threads etc.) are re-calculated.
Notes:
The priority values EPriorityWindowServer
,
EPriorityFileServer
, EPriorityRealTimeServer
and
EPrioritySupervisor
are restricted to EPOC itself and any attempt
to explicitly set any of these priority values causes a KERN-EXEC 14 panic to
be raised.
Any attempt to set the priority of a process which is protected and is different from the process owning the thread which invokes this function, causes a KERN-EXEC 1 panic to be raised.
A process can set its own priority whether it is protected or not.
|
void Resume();
Makes the first thread (the main thread) in the process eligible for execution.
Notes:
The process must be fully loaded before calling this function, otherwise a PLAT 12 panic is raised.
See the Resume()
member function of RThread
for
additional information on resuming threads.
void Kill(TInt aReason);
Ends this process specifying a reason code.
Notes:
Any attempt to end a process which is protected and is different from the process owning the thread which invokes this function, causes a KERN-EXEC 1 panic to be raised.
A process can call Kill()
on itself whether it is protected
or not.
|
void Panic(const TDesC& aCategory,TInt aReason);
Panics the process and all of its owned threads, specifying the panic category name and reason code.
The length of the category name should be no greater than 16; any name with a length greater than 16 is truncated to 16.
Notes:
Any attempt to panic a process which is protected and is different from the process owning the thread which invokes this function, causes a KERN-EXEC 1 panic to be raised.
A process can call Panic()
on itself whether it is protected
or not.
|
TExitType ExitType() const;
Has the process ended and, if it has ended, return how it ended.
This information allows the caller to distinguish between controlled termination and a panic.
Note that while the process is alive, the function
returnsEExitPending
.
|
TInt ExitReason() const;
Returns the specific reason associated with the end of this process. The reason number together with the category name is a way of distinguishing between different causes of process termination.
If the process has panicked, this value is the panic number. If the
process has ended as a result of a call to Kill()
, then the value
is the one supplied by Kill()
.
If the process has not ended, then the returned value is zero.
|
TExitCategoryName ExitCategory() const;
Returns the name of the category associated with the end of the process. The category name together with the reason number is a way of distinguishing between different causes of process termination.
If the process has panicked, the category name is the panic category
name; for example, E32USER-CBase
or KERN-EXEC
. If the
process has ended as a result of a call to Kill()
, then the
category name is Kill
.
If the process has not ended, then the category name is empty, i.e. the length of the category name is zero.
|
void Logon(TRequestStatus& aStatus) const;
Requests notification when this process dies, normally or otherwise.
A request for notification is an asynchronous request.
When this process dies, the request completes
andTRequestStatus
is set to one of
theTExitType
enumerators identifying how the process has
died.
Alternatively, if an outstanding notification request is cancelled by a
call to this process's LogonCancel()
member function, then the
request completes with the value KErrCancel
.
A request for notification requires memory to be allocated; if this is
unavailable, the call to Logon()
returns but the asynchronous
request completes immediately with the
valueKErrNoMemory
.
|
TInt LogonCancel(TRequestStatus& aStatus) const;
Cancels an outstanding request for notification of the death of this process.
A request for notification must previously have been made, otherwise the
function returns KErrGeneral
.
The caller passes a reference to the same request status object as was
passed in the original call to Logon()
.
|
|
TUidType Type() const;
Returns the type associated with the process.
|
TProcessId Id() const;
Returns the Id of this process.
|
TFileName FileName() const;
Returns a copy of the full path name of the loaded executable on which this process is based.
This is the file name which is passed to the Create()
member
function of this RProcess
.
|
TCommand CommandLine() const;
Withdrawn in 6.0
Gets a copy of the data which is passed as an argument to the thread function of the new process's main thread when it is first scheduled to run.
This is the command line which is passed to
theCreate()
member function of
thisRProcess()
.
|
void CommandLine(TDes& aCommand) const;
Supported from 6.0
Gets a copy of the data which is passed as an argument to the thread function of the new process's main thread when it is first scheduled to run.
|
TInt CommandLineLength() const;
Supported from 6.0
Gets the length of the data which is passed as an argument to the thread function of the new process's main thread when it is first scheduled to run.
|
TInt GetRamSizes(TInt& aCodeSize, TInt& aConstDataSize, TInt& anInitialisedDataSize, TInt& anUninitialisedDataSize);
Gets the size of an executable's sections.
This function is deprecated and should not be used.
TBool LoadedFromRam() const;
Tests whether the executable for this process was loaded from RAM or was found in ROM.
|
TBool Protected() const;
Tests whether this process is protected.
The protected state prevents any other process from setting the priority, ending or panicking this process.
|
TInt Owner(RProcess &anOwner) const;
Gets a handle to the process which owns this process.
|
|
void SetType(const TUidType& aType);
Sets the process type.
|
void SetProtected(TBool aState) const;
Sets the process into a protected state.
The protected state prevents any other process from setting the priority, ending or panicking this process.
|
void SetOwner(const RProcess& aProcess) const;
Makes the process with the specified handle the owner of this process.
|