ReactOS  0.4.13-dev-66-gc714b7f
CProcess.cpp
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Automatic Testing Utility
3  * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE: Class able to create a new process and closing its handles on destruction (exception-safe)
5  * COPYRIGHT: Copyright 2009 Colin Finck (colin@reactos.org)
6  */
7 
8 #include "precomp.h"
9 
19 CProcess::CProcess(const wstring& CommandLine, LPSTARTUPINFOW StartupInfo)
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 }
28 
33 {
36 }
#define TESTEXCEPTION(Message)
Definition: precomp.h:59
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
SIZE_T LPSTARTUPINFOW
Definition: cordebug.idl:85
#define NORMAL_PRIORITY_CLASS
Definition: winbase.h:181
~CProcess()
Definition: CProcess.cpp:32
smooth NULL
Definition: ftsmooth.c:416
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:4623
__wchar_t WCHAR
Definition: xmlstorage.h:180
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
CProcess(const wstring &CommandLine, LPSTARTUPINFOW StartupInfo)
Definition: CProcess.cpp:19
PROCESS_INFORMATION m_ProcessInfo
Definition: CProcess.h:11