Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6096601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:56:50+00:00 2026-05-23T12:56:50+00:00

Microsoft played safe here. In their article, Creating a Child Process with Redirected Input

  • 0

Microsoft played safe here. In their article, “Creating a Child Process with Redirected Input and Output”, they are saying:

The remaining open handles are cleaned up when this process terminates.
To avoid resource leaks in a larger application, close handles explicitly.

Which is perfectly useless. What handles? In which process?


I want to get my head around it.

When a handle is created in parent process with SECURITY_ATTRIBUTES.bInheritHandle = TRUE, a child process can see and use it, and the handle has the same value and access rights in both processes.

But is it the same handle, or is it a copy that happen to have same numerical representation?

If I pass a hRead handle to a child process so that it can read from a pipe, and the child process closes the handle, do I also need to close it from the parent process? Will it not wipe the pipe from under the child process?

My experiments show that CloseHandle returns success when trying to close a hRead handle passed to the child after the child has closed it. This argues strongly for Yes, you should close it. However, I would appreciate a more solid advice here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:56:51+00:00Added an answer on May 23, 2026 at 12:56 pm

    You hit the nail on the head there. Win32 handles act as user mode references to an underlying kernel mode object. Handles (references) to new and existing objects are typically created via some kind of CreateXXX call – additional references can be created in the current, or other processes, by calling DuplicateHandle – {or marking a handle as inheritable and creating a new process – which duplicates a handle from the current process into the child process – ensuring that the handle value is identical.}

    At that point, there are (at least) two references to the kernel object, both of which need to be closed to unlock the object and free any consumed resources.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Microsoft like implementing their own versions of popular open-source frameworks and assemblies, for example:
Microsoft recently announced that they were endorsing jQuery as an officially supported JavaScript library.
I played with the code : <script type=text/javascript> var str=Visit Microsoft!; document.write(str.replace(Microsoft,function (a){return a+1111}));
I've checked and played a bit with Microsoft Pex . It's a very handy
Where can I start learning Windows Form designing? For example: Microsoft Zune player, Buttons,
Microsoft SQL Server Profiler is a graphical user interface to SQL Trace for monitoring
Microsoft recently announced that the Javascript/HTML DOM library jQuery will be integrated into the
Microsoft's new Windows Live Application Based Storage API is a RESTful API. More info
Microsoft Access is a slick way to access data in a MS SQL Server
Microsoft, of Cairo fame, is working on Oslo, a new modeling platform . Bob

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.