NT Service and redirection of stdOut/stdError

J

José Joye

I have made a NT Service in c# and I need to use some features provided in a
legacy C library (it can be interfaced with callbacks and normal calls). So
far, no problem, I used p/Invoke and all is fine. However, this library
writes to stdOut/stdError. :-((
Is there a way at service startup (or later) to redirect stdOut/stdError to
files so as to prevent my Service to crash?

Thanks!

José
 
J

José Joye

Found it:

Must use:

[ DllImport( "Kernel32.dll" )]

internal static extern bool SetStdHandle( int nStdHandle, HandleRef hndRef);





José
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top