![]() |
Gray C++ Libraries
0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
|
#include <cOSProcess.h>
Public Member Functions | |
cOSProcess () noexcept | |
virtual | ~cOSProcess () |
HRESULT | CreateProcessX (const FILECHAR_t *pszExeName, const FILECHAR_t *pszArgs=nullptr, SHOWWINDOW_t nShowCmd=SW_SHOWNORMAL, const FILECHAR_t *pszCurrentDir=nullptr, cFile *pFileOutPipe=nullptr) |
bool | isValidProcess () const noexcept |
PROCESSID_t | get_ProcessId () const noexcept |
virtual cStringF | get_ProcessPath () const |
cStringF | get_ProcessName () const |
HRESULT | OpenProcessId (PROCESSID_t dwProcessID, DWORD dwDesiredAccess=0, bool bInheritHandle=false) |
cStringF | get_CommandLine () const |
HRESULT | WaitForProcessExit (TIMESYSD_t nTimeWait, APP_EXITCODE_t *pnExitCode=nullptr) |
void | AttachCurrentProcess () noexcept |
HRESULT | TerminateProcess (APP_EXITCODE_t uExitCode) |
DWORD | get_PriorityClass () const noexcept |
CPU priority level for scheduling. More... | |
bool | put_PriorityClass (DWORD dwPriorityClass) noexcept |
Static Public Member Functions | |
static bool __stdcall | IsSystemPID (PROCESSID_t nProcessID) noexcept |
Protected Attributes | |
PROCESSID_t | m_nPid |
Process ID, 0 = PROCESSID_BAD = un-init. More... | |
Friends | |
class | cOSProcessTests |
A running process in the system. May or may not be the current process. handle to some active process I started (me or my child). Related to MIME_EXT_exe PROCESSID_t. Related to cOSModule.
|
noexcept |
|
virtual |
|
inlinenoexcept |
No need to close this handle!
HRESULT Gray::cOSProcess::CreateProcessX | ( | const FILECHAR_t * | pszExeName, |
const FILECHAR_t * | pszArgs = nullptr , |
||
SHOWWINDOW_t | nShowCmd = SW_SHOWNORMAL , |
||
const FILECHAR_t * | pszCurrentDir = nullptr , |
||
cFile * | pFileOutPipe = nullptr |
||
) |
Create/launch/spawn the child process file and get handle to it.
cStringF Gray::cOSProcess::get_CommandLine | ( | ) | const |
Get the full command line arguments for the process by id. "App.exe Args" like _WIN32 "::GetCommandLine()"
|
inlinenoexcept |
CPU priority level for scheduling.
ABOVE_NORMAL_PRIORITY_CLASS
|
inlinenoexcept |
cStringF Gray::cOSProcess::get_ProcessName | ( | ) | const |
Get a process name from a handle. like GetModuleBaseName() _WIN32 must have the PROCESS_QUERY_INFORMATION and PROCESS_VM_READ access rights.
|
virtual |
Get the full file path for this process EXE. MUST be loaded by this process for _WIN32. e.g. "c:\Windows\System32\smss.exe" or "\Device\HarddiskVolume2\Windows\System32\smss.exe"
|
inlinestaticnoexcept |
|
inlinenoexcept |
HRESULT Gray::cOSProcess::OpenProcessId | ( | PROCESSID_t | dwProcessID, |
DWORD | dwDesiredAccess = 0 , |
||
bool | bInheritHandle = false |
||
) |
get a handle to a process by its PROCESSID_t.
|
inlinenoexcept |
Set the threads priority.
|
inline |
terminate some process. inject uExitCode. m_nPid may be invalid after this!
HRESULT Gray::cOSProcess::WaitForProcessExit | ( | TIMESYSD_t | nTimeWait, |
APP_EXITCODE_t * | pnExitCode = nullptr |
||
) |
Wait for a process to exit.
|
friend |
|
protected |
Process ID, 0 = PROCESSID_BAD = un-init.