BUG: Windows 95/98 Do Not Allow open_osfhandle on Socket Handles (139801)



The information in this article applies to:

  • Microsoft Platform Software Development Kit (SDK) 1.0, when used with:
    • the operating system: Microsoft Windows 95
    • the operating system: Microsoft Windows 98
  • Microsoft Visual C++, 32-bit Editions 4.0
  • Microsoft Visual C++, 32-bit Enterprise Edition 5.0
  • Microsoft Visual C++, 32-bit Professional Edition 5.0

This article was previously published under Q139801

SYMPTOMS

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

CAUSE

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

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

Applications on Windows NT may use _open_osfhandle to get a C run-time file descriptor from a Windows NT socket handle. This enables the application to use the descriptor in C run-time I/O operations such as _lread() and so on.

Windows 95 and Windows 98 do not allow this operation.

Modification Type:MinorLast Reviewed:7/11/2005
Keywords:kbAPI kbBug kbnetwork kbWinsock KB139801