Are there any restrictions to the types of I/O kernel objects that one can use for redirection when calling CreateProcess()
?
As can be seen in the documentation, one of the parameters the function receives is the STARTUPINFO
structure. Within this structure, one can specify handles for both input, output and errors. However, it's not mentioned what specific kinds of I/O kernel objects can be use.
I have tested the use of windows sockets as I/O devices, and found that it works. However, I assume that the nature of such a device is rather different than a file object, which makes me wonder if it was actually intended that sockets can be used for this purpose.
Well, not sure if I'm answering your question, but in terms of inheritance, as of MSDN documentation states, one can modify the inheritance policy of a socket by means of SetHandleInformation(). This way you can prevent child processes from inherit a listening socket of the parent process.