ReactOS 0.4.15-dev-7924-g5949c20
CProcess Class Reference

#include <CProcess.h>

Inheritance diagram for CProcess:
Collaboration diagram for CProcess:

Public Member Functions

 CProcess (const wstring &CommandLine, LPSTARTUPINFOW StartupInfo)
 
 ~CProcess ()
 
HANDLE GetProcessHandle () const
 

Private Attributes

PROCESS_INFORMATION m_ProcessInfo
 

Detailed Description

Definition at line 8 of file CProcess.h.

Constructor & Destructor Documentation

◆ CProcess()

CProcess::CProcess ( const wstring &  CommandLine,
LPSTARTUPINFOW  StartupInfo 
)

Constructs a CProcess object and uses the CreateProcessW function to start the process immediately.

Parameters
CommandLineA std::wstring containing the command line to run
StartupInfoPointer to a STARTUPINFOW structure containing process startup information

Definition at line 19 of file CProcess.cpp.

20{
21 auto_array_ptr<WCHAR> CommandLinePtr(new WCHAR[CommandLine.size() + 1]);
22
23 wcscpy(CommandLinePtr, CommandLine.c_str());
24
25 if(!CreateProcessW(NULL, CommandLinePtr, NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS, NULL, NULL, StartupInfo, &m_ProcessInfo))
26 TESTEXCEPTION("CreateProcessW failed\n");
27}
PROCESS_INFORMATION m_ProcessInfo
Definition: CProcess.h:11
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4592
#define TESTEXCEPTION(Message)
Definition: precomp.h:59
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define NORMAL_PRIORITY_CLASS
Definition: winbase.h:181
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ ~CProcess()

CProcess::~CProcess ( )

Destructs a CProcess object, terminates the process if running, and closes all handles belonging to the process.

Definition at line 32 of file CProcess.cpp.

33{
37}
#define CloseHandle
Definition: compat.h:739
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
Definition: proc.c:1532

Member Function Documentation

◆ GetProcessHandle()

HANDLE CProcess::GetProcessHandle ( ) const
inline

Definition at line 17 of file CProcess.h.

17{ return m_ProcessInfo.hProcess; }

Member Data Documentation

◆ m_ProcessInfo

PROCESS_INFORMATION CProcess::m_ProcessInfo
private

Definition at line 11 of file CProcess.h.

Referenced by CProcess(), GetProcessHandle(), and ~CProcess().


The documentation for this class was generated from the following files: