- STARTUPINFO si = {0};
- SECURITY_ATTRIBUTES sa = {0};
- DWORD dwWaitResult = 0;
- DWORD dwExitCode = 0;
- DWORD ThreadId;
- DWORD nBytes = 0;
- DWORD dwCreationMode = CREATE_NO_WINDOW;
- char cmdLine[4098] = {0};
-
- TestCaseContext_t context = (TestCaseContext_t)param;
- context->started = true;
-
-
- sa.nLength = sizeof(SECURITY_ATTRIBUTES);
- sa.lpSecurityDescriptor = NULL;
- /* The pipe handes can be inherited by the child. */
- sa.bInheritHandle = TRUE;
-
- /* Create a write pipe handle for the child std output */
- if(!CreatePipe(&(context->hChildStdoutReadTmp),&(context->hChildStdOutWrite),&sa,0))
- {
- setErrno(E_CANNOT_CREATE_CHILD_STDOUT_READ_HANDLE);
- return getErrno();
- }
-
- /*
- * Create a duplicate of the output write handle for the std error
- * write handle. This is necessary in case the child application closes
- * one of its std output handles.
- */
- if(!DuplicateHandle(GetCurrentProcess(),(context->hChildStdOutWrite),GetCurrentProcess(),&(context->hChildStderr),0,TRUE,DUPLICATE_SAME_ACCESS))
- {
- setErrno(E_CANNOT_CREATE_CHILD_STDERR_READ_HANDLE);
- return getErrno();
- }
-
- /* Create a read pipe handle for the child std input */
- if(!CreatePipe(&(context->hChildStdInRead),&(context->hChildStdinWriteTmp),&sa,0))
- {
- setErrno(E_CANNOT_CREATE_CHILD_STDIN_WRITE_HANDLE);
- return getErrno();
- }
-
-
- /* Create new output read handle and the input write handle use by
- * the parent process to communicate with his child. Set the Properties
- * to FALSE. Otherwise, the child inherits the properties and, as a
- * result, non-closeable handles to the pipes are created.
- */
-
- /* Read handle for read operations on the child std output. */
- if(!DuplicateHandle(GetCurrentProcess(),(context->hChildStdoutReadTmp),GetCurrentProcess(),&(context->hOutputRead),0,FALSE, DUPLICATE_SAME_ACCESS))
- {
- setErrno(E_CANNOT_CREATE_STDOUT_READ_HANDLE);
- return getErrno();
- }
-
-
- /* Write handle for write operations on the child std input. */
- if(!DuplicateHandle(GetCurrentProcess(),(context->hChildStdinWriteTmp),GetCurrentProcess(),&(context->hInputWrite), 0,FALSE,DUPLICATE_SAME_ACCESS))
- {
- setErrno(E_CANNOT_CREATE_STDIN_WRITE_HANDLE);
- return getErrno();
- }
-
-
- /* Close inheritable copies of the handles you do not want to be inherited. */
- if(!CloseHandle((context->hChildStdoutReadTmp)))
- {
- setErrno(E_CANNOT_CLOSE_CHILD_STDIN_TEMPORY_HANDLE);
- return getErrno();
- }
+ STARTUPINFO si = { 0 };
+ SECURITY_ATTRIBUTES sa = { 0 };
+ DWORD dwWaitResult = 0;
+ DWORD dwExitCode = 0;
+ DWORD ThreadId;
+ DWORD nBytes = 0;
+ DWORD dwCreationMode = CREATE_NO_WINDOW;
+ char cmdLine[4098] = { 0 };
+
+ TestCaseContext_t context = (TestCaseContext_t) param;
+ context->started = true;
+
+
+ sa.nLength = sizeof(SECURITY_ATTRIBUTES);
+ sa.lpSecurityDescriptor = NULL;
+ /* The pipe handes can be inherited by the child. */
+ sa.bInheritHandle = TRUE;
+
+ /* Create a write pipe handle for the child std output */
+ if (!CreatePipe
+ (&(context->hChildStdoutReadTmp), &(context->hChildStdOutWrite), &sa,
+ 0)) {
+ setErrno(E_CANNOT_CREATE_CHILD_STDOUT_READ_HANDLE);
+ return getErrno();
+ }