BUG: Windows 95 Doesn't Allow open_osfhandle on Socket Handles

Last reviewed: June 5, 1997
Article ID: Q139801
The information in this article applies to:
  • Microsoft Win32 Software Development Kit (SDK) version 4.0
  • Microsoft Visual C++ version 4.0, 5.0

SYMPTOMS

The Visual C++ runtime API _open_osfhandle on Windows 95 fails when called with a socket handle as the argument. The call returns -1 with errno set to EINVAL.

CAUSE

_open_osfhandle makes a call to GetFileType to verify the handle type. Under Windows 95, GetFileType returns FILE_TYPE_UNKNOWN for a socket handle instead of FILE_TYPE_PIPE. _open_osfhandle does not convert handles of unknown type.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Applications on Windows NT may use _open_osfhandle to get a C-runtime file descriptor from a Windows NT socket handle. This enables the application to use the descriptor in C-runtime I/O operations like _lread(), etc.

Windows 95 does not allow this operation.


Additional query words: 4.00 Windows 95
Keywords : NtwkMisc kbbuglist kbnetwork vcbuglist500
Version : 4.0 5.0
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 5, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.