home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / os / os2 / programm / 4755 < prev    next >
Encoding:
Internet Message Format  |  1992-09-07  |  1.2 KB

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