Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: Win32::Process::Create and IO::Select bad interaction (SetHandleInformation)

by tye (Sage)
on Jan 09, 2003 at 16:59 UTC ( #225577=note: print w/replies, xml ) Need Help??

in reply to Win32::Process::Create and IO::Select bad interaction

Like in Unix, each file handle also has a bit saying whether or not it should be inheritted by another program.

In Unix it is called the "close-on-exec flag", can be controlled by fcntl() with F_SETFD, and (as the name implies) takes effect on exec since a forked child always inherits all open file handles.

In Windows it is just the "inherit flag" for the file handle, is initially set by the bInheritHandle field of the SECURITY_ATTRIBUTES struct argument to CreateFile() (and defaults to "don't inherit" if this argument is NULL), can be changed using SetHandleInformation() with HANDLE_FLAG_INHERIT, and takes effect when a new process is created [for example, via CreateProcess()].

If you create a process with the bInheritHandles parameter of CreateProcess() specified as TRUE, then that process will inherit only those handles that have their "inherit bit" set to TRUE. If you specify bInheritHandles as FALSE, then no handles are inheritted.

You should already have Win32API::File on your system so you can use SetHandleInformation() via it.

                - tye
  • Comment on Re: Win32::Process::Create and IO::Select bad interaction (SetHandleInformation)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://225577]
[marto]: a security event in the building, police dogs and and so on...
[Discipulus]: a test I hope..
[marto]: just a security event, they have people from the 'corporate' security, external security companies, the police etc
[marto]: perhaps I'll get the time to pin down some of the corporate security people, since they refuse to answer any questions
[marto]: for our system, the windows pre production domains alone require 490 accounts :/

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2017-11-22 10:25 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (317 votes). Check out past polls.