0

I want to see the text a program prints to stderr.

I can't see it because the program can only be launched by its launcher so nothing is shown when it's run from the command prompt; the program runs and then the command prompt immediately returns for input instead of blocking and displaying the output.

Can you think of any technique, even an ugly hack, that will let me read what's being printed to stderr?

I have a few ideas but I don't know how to carry them out easily:

  • Read the memory of the process at the right location
  • Modify the memory of the process to change the stderr handle to one I can read
  • Hook the API calls that write to stderr
  • Hook CreateProcess of the launcher and change the output handles
AsksAnyway
  • 890
  • 1
  • 8
  • 21
  • Inject a DLL, call [`SetStdHandle`](http://msdn.microsoft.com/en-us/library/windows/desktop/ms686244(v=vs.85).aspx) – Remus Rusanu Dec 25 '14 at 13:31
  • How do you know the program writes to stderr in the first place? (GUI programs usually don't, and AFAIK aren't even allowed to, properly speaking.) But assuming it does, I guess you could inject a DLL and do [something like this](http://stackoverflow.com/a/27651806/886887). You'll have to make sure your DLL is dynamically linked to the same C runtime library as the application. – Harry Johnston Dec 26 '14 at 01:22

0 Answers0