6.10. Inheriting Handles

When a process creates a child process, the child is completely independent of the parent. By default, the parent and the child have absolutely no connection with one another. However, it is possible for the child process to inherit handles from the parent if the parent marks any of its handles as inheritable. For example, if the parent creates a file handle, or a handle to a thread, or an event handle, it is possible for the parent to share those handles with any child processes it creates. Listings 6.13 and 6.14 show a parent and a child process that share a file handle.

Code Listing 6.13. The parent process that will share a file handle with an appropriately designed child. Listing 6.14 contains the child process ...

Get Win32 System Services: The Heart of Windows® 98 and Windows® 2000 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.