ReactOS 0.4.15-dev-7953-g1f49173
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-2019 Colin Finck (colin@reactos.org)
6 */
7
8#include "precomp.h"
9
19CProcess::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{
37}
CProcess(const wstring &CommandLine, LPSTARTUPINFOW StartupInfo)
Definition: CProcess.cpp:19
PROCESS_INFORMATION m_ProcessInfo
Definition: CProcess.h:11
~CProcess()
Definition: CProcess.cpp:32
SIZE_T LPSTARTUPINFOW
Definition: cordebug.idl:85
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:739
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
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
Definition: proc.c:1532
#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