views:

193

answers:

1

I'm writing a command-line tool which requires privileges elevating. This can be successfully implemented using manifest.

But if this tools is launched from cmd.exe or Far Manager (far.exe), a new console window is created. So all tool console output is written to it and is lost on close.

So my idea is about implementing a fork, where first part of code call the same executable with some argument and Process.ProcessStartInfo in additional gains UseShellExecute = true, Verb = "runas"; and another part, called with argument, is doing what privileges elevating requires.

Is it possible to 'virtualize' my tool re-lauch with grabbing output from second instance and redirecting it to the first?

A: 

If it is possible, it is a potential security issue. If any process can launch another process (or even itself) elevated and intercept its output, it can lead to information disclosure.

Franci Penov