DWORD stdif, stdof, stdef;
BOOL bresult;
DWORD error_code;
+ DWORD create_no_window;
if (GNUNET_SYSERR == GNUNET_OS_check_helper_binary (filename, GNUNET_NO, NULL))
return NULL; /* not executable */
return NULL;
}
+ create_no_window = 0;
+ {
+ HANDLE console_input = CreateFile ("CONIN$", GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
+ if (INVALID_HANDLE_VALUE == console_input)
+ create_no_window = CREATE_NO_WINDOW;
+ else
+ CloseHandle (console_input);
+ }
+
bresult = CreateProcessW (wpath, wcmd, NULL, NULL, GNUNET_YES,
- CREATE_NO_WINDOW | CREATE_SUSPENDED, env_block, NULL, &start, &proc);
+ create_no_window | CREATE_SUSPENDED, env_block, NULL, &start, &proc);
error_code = GetLastError ();
if ((NULL == pipe_stdin) && (stdih))
return NULL;
}
- gnunet_proc = GNUNET_malloc (sizeof (struct GNUNET_OS_Process));
+ gnunet_proc = GNUNET_new (struct GNUNET_OS_Process);
gnunet_proc->pid = proc.dwProcessId;
gnunet_proc->handle = proc.hProcess;
gnunet_proc->control_pipe = childpipe_write;
* @param std_inheritance a set of GNUNET_OS_INHERIT_STD_* flags
* @param lsocks array of listen sockets to dup systemd-style (or NULL);
* must be NULL on platforms where dup is not supported
- * @param first_arg name of the binary. It is valid to have the arguments
+ * @param filename name of the binary. It is valid to have the arguments
* in this string when they are separated by spaces.
* @param ... more arguments. Should be of type `char *`. It is valid
* to have the arguments in these strings when they are separated by
- * spaces.
+ * spaces. The last argument MUST be NULL.
* @return pointer to process structure of the new process, NULL on error
*/
struct GNUNET_OS_Process *
GNUNET_OS_start_process_s (int pipe_control,
unsigned int std_inheritance,
const SOCKTYPE * lsocks,
- const char *first_arg, ...)
+ const char *filename, ...)
{
va_list ap;
char **argv;
size_t len;
argv_size = 1;
- va_start (ap, first_arg);
- arg = first_arg;
+ va_start (ap, filename);
+ arg = filename;
last = NULL;
do
{
argv = GNUNET_malloc (argv_size * sizeof (char *));
argv_size = 0;
- va_start (ap, first_arg);
- arg = first_arg;
+ va_start (ap, filename);
+ arg = filename;
last = NULL;
do
{
return NULL;
}
GNUNET_DISK_pipe_close_end (opipe, GNUNET_DISK_PIPE_END_WRITE);
- cmd = GNUNET_malloc (sizeof (struct GNUNET_OS_CommandHandle));
+ cmd = GNUNET_new (struct GNUNET_OS_CommandHandle);
cmd->timeout = GNUNET_TIME_relative_to_absolute (timeout);
cmd->eip = eip;
cmd->opipe = opipe;