Commit 086eba7e authored by John van Groningen's avatar John van Groningen

add win_create_process

parent a3f74290
......@@ -250,3 +250,51 @@ int get_finished_compiler_id_and_exit_code (int *exit_code_p)
*exit_code_p=0;
return -1;
}
void win_create_process (PSTR commandline,PSTR dir,int *success,int *exitcode)
{
SECURITY_ATTRIBUTES sa;
STARTUPINFO si;
PROCESS_INFORMATION pi;
BOOL fsuccess;
*success = FALSE;
*exitcode = -1;
sa.nLength = sizeof (SECURITY_ATTRIBUTES);
sa.bInheritHandle = TRUE;
sa.lpSecurityDescriptor = NULL;
si.cb = sizeof (STARTUPINFO);
si.lpReserved = NULL;
si.lpReserved2 = NULL;
si.cbReserved2 = 0;
si.lpDesktop = NULL;
si.lpTitle = NULL;
si.dwFlags = 0;
si.hStdInput = NULL;
si.hStdOutput = NULL;
si.hStdError = NULL;
fsuccess =
CreateProcess (NULL, /* pointer to name of executable module */
commandline, /* pointer to command line string */
NULL, /* pointer to process security attributes */
NULL, /* pointer to thread security attributes */
TRUE, /* handle inheritance flag */
DETACHED_PROCESS, /* creation flags */
NULL, /* pointer to new environment block */
dir, /* pointer to current directory name */
&si, /* pointer to STARTUPINFO */
&pi /* pointer to PROCESS_INFORMATION */
);
if (fsuccess) {
WaitForSingleObject (pi.hProcess, INFINITE);
GetExitCodeProcess (pi.hProcess, (unsigned long *) exitcode);
*success = TRUE;
} else {
*success = FALSE;
*exitcode = -1;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment