c# – Receiving I / O streams of another process


Let's say we got a pool of processes that call themselves conhost .

            var list = Process.GetProcessesByName("conhost").GroupBy(_x => _x.Id).ToDictionary(_x => _x.Key, _x => _x);

conhost instantiated for each copy of a Windows console application to provide input and output streams (If this is not the case, correct it) So I need to "listen" to what each console writes and reads – I myself will decide how to aggregate it. But the problem is that I cannot get access to the input and output streams.

There is an assumption that this is solved by the native or Winapi (more inclined towards winapi) .

The decision to make my own child process doesn't suit me. I need to listen to the pool of processes. Or rather, to access their input and output streams.


Answering my own question. I advise everyone who was interested in this to read this article: Windows 7 / Windows Server 2008 R2: Console Host

In theory, nothing in the world that cannot be solved is not. But the solution to this question leads to a hack, which of course cannot be discussed on stackoverflow.

Scroll to Top