That doesn't guarantee that it's the process console, console handles
can be passed across processes.
So apologies if this is an ignorant question, I dont really understand this console logic properly so I was researching the options. MSDN help for DuplicateHandle (http://msdn.microsoft.com/en-gb/library/windows/desktop/ms724251(v=vs.85).aspx) states console handles cannot be duplicated for use in other processes, is there another context that I am missing?
Any hints/suggestions on the best way to solve this problem - Ideally we would want to duplicate the handle extending to add write access, since the original device was opened read only, but I am not aware of a clean way to do this.