ReactOS 0.4.16-dev-814-g656a5dc
CreateProcessA.cpp
Go to the documentation of this file.
1//
2// CreateProcessA.cpp
3//
4// Copyright (c) Microsoft Corporation. All rights reserved.
5//
6// Definition of __acrt_CreateProcessA.
7//
8
10
12 LPCSTR const lpApplicationName,
13 LPSTR const lpCommandLine,
14 LPSECURITY_ATTRIBUTES const lpProcessAttributes,
15 LPSECURITY_ATTRIBUTES const lpThreadAttributes,
16 BOOL const bInheritHandles,
17 DWORD const dwCreationFlags,
18 LPVOID const lpEnvironment,
19 LPCSTR const lpCurrentDirectory,
20 LPSTARTUPINFOW const lpStartupInfo,
21 LPPROCESS_INFORMATION const lpProcessInformation
22 )
23{
24 __crt_internal_win32_buffer<wchar_t> wide_application_name;
26 __crt_internal_win32_buffer<wchar_t> wide_current_directory;
27
29 lpApplicationName,
30 wide_application_name,
32 );
33
34 if (cvt1 != 0) {
35 return FALSE;
36 }
37
39 lpCommandLine,
40 wide_command_line,
42 );
43
44 if (cvt2 != 0) {
45 return FALSE;
46 }
47
48 LPWSTR wide_current_directory_ptr = nullptr;
49
50 if (lpCurrentDirectory != nullptr) {
51 errno_t const cvt3 = __acrt_mbs_to_wcs_cp(
52 lpCurrentDirectory,
53 wide_current_directory,
55 );
56
57 if (cvt3 != 0) {
58 return FALSE;
59 }
60
61 wide_current_directory_ptr = wide_current_directory.data();
62 }
63
64 // converted_command_line is an out parameter, but is not reconverted to utf8 string,
65 // since it is only written to in the Wide version. CreateProcessA does not expect it
66 // to have changed.
67 return ::CreateProcessW(
68 wide_application_name.data(),
69 wide_command_line.data(),
70 lpProcessAttributes,
71 lpThreadAttributes,
72 bInheritHandles,
73 dwCreationFlags,
74 lpEnvironment,
75 wide_current_directory_ptr,
76 lpStartupInfo,
77 lpProcessInformation
78 );
79}
BOOL __cdecl __acrt_CreateProcessA(LPCSTR const lpApplicationName, LPSTR const lpCommandLine, LPSECURITY_ATTRIBUTES const lpProcessAttributes, LPSECURITY_ATTRIBUTES const lpThreadAttributes, BOOL const bInheritHandles, DWORD const dwCreationFlags, LPVOID const lpEnvironment, LPCSTR const lpCurrentDirectory, LPSTARTUPINFOW const lpStartupInfo, LPPROCESS_INFORMATION const lpProcessInformation)
#define __cdecl
Definition: accygwin.h:79
SIZE_T LPSTARTUPINFOW
Definition: cordebug.idl:85
SIZE_T LPPROCESS_INFORMATION
Definition: cordebug.idl:86
errno_t __acrt_mbs_to_wcs_cp(char const *const null_terminated_input_string, __crt_win32_buffer< wchar_t, ResizePolicy > &win32_buffer, unsigned int const code_page)
unsigned int __acrt_get_utf8_acp_compatibility_codepage()
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
errno_t const cvt2
Definition: strftime.cpp:161
errno_t const cvt1
Definition: strftime.cpp:139
int errno_t
Definition: corecrt.h:615
const char * LPCSTR
Definition: xmlstorage.h:183
char * LPSTR
Definition: xmlstorage.h:182
WCHAR * LPWSTR
Definition: xmlstorage.h:184