MSWSOCK.DLL Information

The functions listed below are entry points to MSWSOCK.DLL, the "Microsoft WinSock" DLL. They are not part of the official set of WinSock APIs (not WinSock 1.1 or WinSock 2), but are Microsoft proprietary.

Although they don't appear in the official WinSock specifications, the documentation for some of them is inter-mixed with standard WinSock function documentation in Microsoft's on-line version of the Winsock 2 documentation. This is available at the Microsoft Developers' Network (MSDN) "premium" website. You may have to join MSDN to access these; fortunately there's no charge to join:

http://premium.microsoft.com in the menu

I have not completed testing of all the APIs, but here's what I know so far. The APIs listed under "Routed..." are only hints; in many cases a number of APIs are used, including WSAStartup(). For those I don't know the answer to, I've put a question mark. The way that I tested whether or not the API is "routed to WS2_32.DLL" was by executing a WinSock 2 application that used the functions, and with the debug version of the WinSock 2 DLL installed (WS2_32.DLL) and my updated version of the WinSock 2 (DT_DLL.DLL) in the same directory as the application, I could log what WinSock calls were made (along with their input and output arguments, and return values). For more information on the DT_DLL, see "Debug Trace DLL Issues" at http://www.sockets.com/ws2_stat.htm:

A few things to note about the contents of the table above:

  1. I didn't include ordinals for each entry point, since they differ on different versions and platforms.
  2. On systems with WinSock 2 installed some APIs are routed to the WS2_32.DLL (which means the Layered Service Providers, or TCP/IP Service Providers from vendors other than Microsoft can service the calls).
  3. I've added a few here that weren't in the original list that Eugeni asked about (see message attached below); I have flagged the ones I added with asterisks
  4. This list is what appears in the MSWSOCK.DLL installed with Winsock 2 on Win95. As noted below, some don't appear in the NT4 (SP3) version of MSWSOCK.DLL
  5. For those APIs with a "N" (No) under the Win95 column, the entry point exists, but the API is not supported in Windows 95. This is indicated in the Microsoft documentation. Of the others that are marked "Y" (Yes) I am not sure they are supported in those cases where the last column has '?' to indicate I haven't tested.
  6. Those APIs with the 'W' suffix handle Unicode ("wide" character) input strings (which may be within fields of structures passed), and those with the 'A' suffix handle ANSI (single byte character) strings.
  7. NSPStartup() is doc'd in the WinSock 2 Service Providers Interface (SPI) Specification, not the API specification. The fact that MSWSOCK.DLL has this entry point is a hint that this DLL is where Microsoft has implemented their Name Space
    provider.
  8. Although the rexec() function is not documented, the rexec() program is available in NT. Whether or not this application uses this API, I haven't determined.
  9. Not doc'd, but this function may have Berkeley or RPC heritage, designed to return a privileged port number (a value under 1024).
  10. Not doc'd, but maybe it's related to the perror() function to print and error string. Then again, maybe not.
  11. Another caveat (courtesy of Chris Pearson <CPearson@ideal.jf.intel.com>): MSWSOCK.H creates a header-ordering conflict with WINSOCK2.H. This happens only if you include WINSOCK2.H before (or instead of) WINDOWS.H. What happens is that WINSOCK2.H includes WINDOWS.H, which in turn (recursively) includes WINSOCK2.H to define symbols needed by MSWSOCK.H. However, since _WINSOCK2API_ is already defined by the first inclusion of WINSOCK2.H, the second inclusion of WINSOCK2.H is a no-op. Your compile then fails when MSWSOCK.H reference undefined symbols. If you want to use MSWSOCK APIs, you'll need to make sure you always include WINDOWS.H before WINSOCK2.H. This can be a pain, especially when using third party headers which include WINSOCK2.H directly. If you don't need MSWSOCK, an alternative which allows you to include WINSOCK2.H first is to define these preprocessor symbols in your project definition:
    1. _WIN32_WINT=0x400

      _MSWSOCK_

  12. For more information, also see http://premium.microsoft.com/msdn/library/sdkdoc/ovrspi_6836.htm which lists some of the MSWSOCK.DLL APIs that are not redirected to.

I hope this is helpful. I welcome any other input anyone wants to offer.

[Go back]

updated 1/27/98, (c) Bob Quinn 1995-1998