home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!hal.com!decwrl!borland.com!alexande
- From: alexande@genghis.borland.com (Mark Alexander)
- Newsgroups: comp.os.os2.programmer
- Subject: Re: DosSetFHState() and Pipes -- problem
- Keywords: OS/2 2.0, API, DosSetFHState, anonymous pipes
- Message-ID: <1992Sep5.001241.14644@genghis.borland.com>
- Date: 5 Sep 92 00:12:41 GMT
- References: <1992Sep4.170103.24099@reed.edu>
- Sender: news@borland.com (News Admin)
- Organization: Borland International
- Lines: 18
- Originator: alexande@genghis.borland.com
-
- In article <1992Sep4.170103.24099@reed.edu> celarier@reed.edu (Stuart Celarier) writes:
- >This code fragement (with appropriate parameters and error checking) compiled
- >just fine, but on execution every one of the DosSetFHState() calls returns an
- >error code 87 -- bad parameter.
-
- I went through this pain once, too, and discovered that you have to
- clear bits 0-2, 4-6, and 15 in the file handle flags. This is
- documented in the OS/2 2.0 CPP Reference, on the page for DosFHState.
-
- So the code to turn off handle inheritance looks like this:
-
- ULONG fhstate;
-
- if (DosQueryFHState(handle, &fhstate) != 0) ...;
- fhstate = (fhstate & ~0x8077) | OPEN_FLAGS_NOINHERIT;
- if (DosSetFHState(handle, fhstate) != 0) ...;
-
- I hope this fixes your problem.
-