2
votes

Is it possible to create a process and redirect its input and output but set the child not to inherit socket handles ? ( maybe pinvoke with CreateProcess somehow ) If I use UseShellExecute = true the child doesn't inherit the socket but I cant redirect output.

1

1 Answers

1
votes

CreateProcess takes a STARTUPINFO as one of its parameters. Three of the fields in this struct are the in, out and error handles.

Don't forget to set the STARTF_USESTDHANDLES flag.

Edit: So you have to set the bInheritHandles parameter. See this page for more information about inherited handles.