Jump to content

Handle Inheritance


Recommended Posts

Hi.

Reference to MSDN under the topic pipes/Anonymous Pipe/Pipe Handle Inheritance

The following are the steps mentioned for redirecting the standard output handle to the child process

1.Call the GetStdHandle function to get the current standard output handle

2.Call the SetStdHandle function to set the standard output handle to the write handle to the pipe.

3.Create the child process

4.Call the CloseHandle function to close the write handle to the pipe.

5.Call SetStdHandle to restore the original standard output handle

My Question is whether there will be any impact in the parent process when the restoring of the original handle is not done. Please reply back. its urgent.

Moreover, the GetStdHandle() API in the step (1) is returning INVALID_HANDLE_VALUE. When does this API returns INVALID_HANDLE_VALUE. When GetLastError is called it returns 6 (invalid handle). Is there any scenario or condition in which this API return INVALID_HANDLE_VALUE.

Thanks in advance

Edited by ootsoo
Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...