#include <ProcessUtils.h>
Definition at line 133 of file ProcessUtils.h.
ProcessUtils::SubProcess::SubProcess |
( |
const char * |
exePath, |
|
|
DWORD |
timeOutMS = 60*1000 |
|
) |
| |
|
inline |
Definition at line 137 of file ProcessUtils.h.
139 WIN32_OP( (ev =
CreateEvent(NULL, TRUE, FALSE, NULL)) != NULL );
141 WIN32_OP( (ev =
CreateEvent(NULL, TRUE, FALSE, NULL)) != NULL );
typedef HANDLE(WINAPI *pPowerCreateRequest_t)(__in void *Context)
HANDLE CreateEvent(LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCTSTR lpName)
const pfc::string8 ExePath
ProcessUtils::SubProcess::~SubProcess |
( |
| ) |
|
|
inline |
static void ProcessUtils::SubProcess::_Close |
( |
HANDLE & |
h | ) |
|
|
inlinestaticprivate |
Definition at line 217 of file ProcessUtils.h.
218 if (h != NULL) {CloseHandle(h); h = NULL;}
void ProcessUtils::SubProcess::CleanUp |
( |
bool |
bDetach = false | ) |
|
|
inlineprotected |
Definition at line 203 of file ProcessUtils.h.
DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds)
const pfc::string8 ExePath
static void _Close(HANDLE &h)
void ProcessUtils::SubProcess::Detach |
( |
| ) |
|
|
inline |
bool ProcessUtils::SubProcess::IsRunning |
( |
| ) |
const |
|
inline |
static void ProcessUtils::SubProcess::myCreatePipe |
( |
HANDLE & |
in, |
|
|
HANDLE & |
out |
|
) |
| |
|
inlinestaticprivate |
Definition at line 221 of file ProcessUtils.h.
222 SECURITY_ATTRIBUTES Attributes = {
sizeof(SECURITY_ATTRIBUTES), 0,
true };
223 WIN32_OP( CreatePipe( &in, &out, &Attributes, 0 ) );
static void ProcessUtils::SubProcess::myCreatePipeIn |
( |
HANDLE & |
in, |
|
|
HANDLE & |
out |
|
) |
| |
|
inlinestaticprivate |
Definition at line 251 of file ProcessUtils.h.
252 SECURITY_ATTRIBUTES Attributes = {
sizeof(SECURITY_ATTRIBUTES), 0,
true };
254 SetLastError(NO_ERROR);
255 HANDLE pipe = CreateNamedPipe(
257 FILE_FLAG_FIRST_PIPE_INSTANCE | PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED,
258 PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT,
262 NMPWAIT_USE_DEFAULT_WAIT,&Attributes);
263 if (pipe == INVALID_HANDLE_VALUE)
throw exception_win32(GetLastError());
265 out = CreateFile(pipeName,GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,&Attributes,OPEN_EXISTING,0,NULL);
266 DuplicateHandle ( GetCurrentProcess(), pipe, GetCurrentProcess(), &in, 0, FALSE, DUPLICATE_SAME_ACCESS );
typedef HANDLE(WINAPI *pPowerCreateRequest_t)(__in void *Context)
static pfc::string_formatter makePipeName()
static void ProcessUtils::SubProcess::myCreatePipeOut |
( |
HANDLE & |
in, |
|
|
HANDLE & |
out |
|
) |
| |
|
inlinestaticprivate |
Definition at line 232 of file ProcessUtils.h.
233 SECURITY_ATTRIBUTES Attributes = {
sizeof(SECURITY_ATTRIBUTES), 0,
true };
235 SetLastError(NO_ERROR);
236 HANDLE pipe = CreateNamedPipe(
238 FILE_FLAG_FIRST_PIPE_INSTANCE | PIPE_ACCESS_OUTBOUND | FILE_FLAG_OVERLAPPED,
239 PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT,
243 NMPWAIT_USE_DEFAULT_WAIT,&Attributes);
244 if (pipe == INVALID_HANDLE_VALUE)
throw exception_win32(GetLastError());
246 in = CreateFile(pipeName,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,&Attributes,OPEN_EXISTING,0,NULL);
247 DuplicateHandle ( GetCurrentProcess(), pipe, GetCurrentProcess(), &out, 0, FALSE, DUPLICATE_SAME_ACCESS );
typedef HANDLE(WINAPI *pPowerCreateRequest_t)(__in void *Context)
static pfc::string_formatter makePipeName()
ProcessUtils::SubProcess::PFC_DECLARE_EXCEPTION |
( |
failure |
, |
|
|
std::exception |
, |
|
|
"Unexpected failure" |
|
|
) |
| |
size_t ProcessUtils::SubProcess::read |
( |
void * |
p_buffer, |
|
|
size_t |
p_bytes, |
|
|
abort_callback & |
abort |
|
) |
| |
|
inline |
Definition at line 192 of file ProcessUtils.h.
194 return reader.read(p_buffer, p_bytes, abort);
void ProcessUtils::SubProcess::Restart |
( |
| ) |
|
|
inline |
Definition at line 145 of file ProcessUtils.h.
150 si.dwFlags = STARTF_USESTDHANDLES | STARTF_FORCEOFFFEEDBACK;
155 si.hStdError = GetStdHandle(STD_ERROR_HANDLE);
157 PROCESS_INFORMATION pi = {};
void CleanUp(bool bDetach=false)
static void myCreatePipeIn(HANDLE &in, HANDLE &out)
const pfc::string8 ExePath
static void _Close(HANDLE &h)
static void myCreatePipeOut(HANDLE &in, HANDLE &out)
void ProcessUtils::SubProcess::SetPriority |
( |
DWORD |
val | ) |
|
|
inline |
void ProcessUtils::SubProcess::write |
( |
const void * |
p_buffer, |
|
|
size_t |
p_bytes, |
|
|
abort_callback & |
abort |
|
) |
| |
|
inline |
Definition at line 188 of file ProcessUtils.h.
190 writer.write(p_buffer, p_bytes, abort);
HANDLE ProcessUtils::SubProcess::hEventRead |
|
protected |
HANDLE ProcessUtils::SubProcess::hEventWrite |
|
protected |
HANDLE ProcessUtils::SubProcess::hProcess |
|
protected |
HANDLE ProcessUtils::SubProcess::hStdIn |
|
protected |
HANDLE ProcessUtils::SubProcess::hStdOut |
|
protected |
bool ProcessUtils::SubProcess::ProcessMessages |
DWORD ProcessUtils::SubProcess::TimeOutMS |
The documentation for this class was generated from the following file: