!
! ********************************************************************
! *                                                                  *
! *  Copyright 2001 Compaq Computer Corporation                      *
! *                                                                  *
! *  COMPAQ Registered in U.S. Patent and Trademark Office.          *
! *                                                                  *
! *  Confidential computer software. Valid license from Compaq or    *
! *  authorized sublicensor required for possession, use or copying. *
! *  Consistent with FAR 12.211 and 12.212, Commercial Computer      *
! *  Software, Computer Software Documentation, and Technical Data   *
! *  for Commercial Items are licensed to the U.S. Government under  *
! *  vendor's standard commercial license.                           *
! *                                                                  *
! ********************************************************************
!
!DEC$ IF .NOT. DEFINED (WSOCK32_ )
!DEC$ DEFINE xWSOCK32_  
!
!
!
!         *****WSOCK32.LIB Interfaces*****
! 
!     This module defines routine interfaces to the Windows APIs
!     for both the 32-bit (_M_IX86) and 64-bit (_M_IA64) versions of the
!     NT4 and WIN2000 operating systems.  
!
!     The base for this version is: 
!
!           Microsoft Platform Software Development Kit (SDK)
!                Win64 Pre-alpha February 2000
!
!     As with the C header files distributed with the SDK, there
!     is only one common set of files for both 64-bit and 32-bit
!     operating systems.
!   
!     Within the Fortran versions of the header files, the
!     following symbols are used to control the compilation.
! 
!     _M_IA64 conditionally compiles items for 64 bit systems.
!     _M_IX86 conditionally compiles items for 32 bit systesm.
!
!     Known problems: 
!
!07-12-00
!
module wsock32
use dfwinty
!DEC$OBJCOMMENT LIB:"WSOCK32.LIB"
!
    INTERFACE 
    FUNCTION f__WSAFDIsSet( &
            arg1, &
            arg2)
    USE DFWINTY
      integer(SINT) :: f__WSAFDIsSet ! int
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'__WSAFDIsSet' :: f__WSAFDIsSet
      integer(UINT_PTR)  arg1 ! SOCKET arg1
    !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: arg2
      TYPE (T_fd_set)  arg2 ! fd_set*  arg2
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION accept( &
            s, &
            addr, &
            addrlen)
    USE DFWINTY
      integer(UINT_PTR)  :: accept ! SOCKET
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'accept' :: accept
       integer(UINT_PTR)  s ! SOCKET s
    !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: addr
    TYPE(T_sockaddr) addr ! struct_sockaddr* addr
      integer(LPINT) addrlen ! int* addrlen
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION bind( &
            s, &
            addr, &
            namelen)
    USE DFWINTY
      integer(SINT) :: bind ! int
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'bind' :: bind
      integer(UINT_PTR)  s ! SOCKET s
    !DEC$ ATTRIBUTES REFERENCE, IGNORE_LOC, ALLOW_NULL :: addr
      TYPE(T_sockaddr) addr ! struct_sockaddr* addr
      integer(SINT) namelen ! int namelen
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION closesocket( &
            s)
    USE DFWINTY
      integer(SINT) :: closesocket ! int
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'closesocket' :: closesocket
      integer(UINT_PTR)  s ! SOCKET s
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION connect( &
            s, &
            name, &
            namelen)
    USE DFWINTY
      integer(SINT) :: connect ! int
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'connect' :: connect
      integer(UINT_PTR)  s ! SOCKET s
    !DEC$ ATTRIBUTES REFERENCE, IGNORE_LOC, ALLOW_NULL :: name
      TYPE(T_sockaddr) name ! struct_sockaddr* name
      integer(SINT) namelen ! int namelen
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION ioctlsocket( &
            s, &
            cmd, &
            argp)
    USE DFWINTY
      integer(SINT) :: ioctlsocket ! int
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'ioctlsocket' :: ioctlsocket
      integer(UINT_PTR)  s ! SOCKET s
      integer(LONG) cmd ! long cmd
      integer(LPULONG) argp ! u_long* argp
     END FUNCTION
    END INTERFACE
INTERFACE 
FUNCTION getpeername( &
        s, &
        name, &
        namelen)
USE DFWINTY
  integer(SINT) :: getpeername ! int
    !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'getpeername' :: getpeername
  integer(UINT_PTR) s ! SOCKET s
    !DEC$ ATTRIBUTES REFERENCE, IGNORE_LOC, ALLOW_NULL :: name
  TYPE(T_sockaddr) name ! struct_sockaddr* name
    integer(LPINT) namelen ! int* namelen
 END FUNCTION
END INTERFACE
INTERFACE 
FUNCTION getsockname( &
        s, &
        name, &
        namelen)
USE DFWINTY
  integer(SINT) :: getsockname ! int
    !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'getsockname' :: getsockname
  integer(UINT_PTR) s ! SOCKET s
    !DEC$ ATTRIBUTES REFERENCE, IGNORE_LOC, ALLOW_NULL :: name
  TYPE(T_sockaddr) name ! struct_sockaddr * name
    integer(LPINT) namelen ! int* namelen
 END FUNCTION
END INTERFACE
INTERFACE 
FUNCTION getsockopt( &
        s, &
        level, &
        optname, &
        optval, &
        optlen)
USE DFWINTY
  integer(SINT) :: getsockopt ! int
    !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'getsockopt' :: getsockopt
  integer(UINT_PTR) s ! SOCKET s
  integer(SINT) optname ! int optname
  integer(SINT) level ! int level
    !DEC$ ATTRIBUTES REFERENCE, IGNORE_LOC, ALLOW_NULL :: optval
  character*(*) optval ! char*  optval
  integer(LPINT) optlen ! int* optlen
 END FUNCTION
END INTERFACE
    INTERFACE 
    FUNCTION htonl( &
            hostlong)
    USE DFWINTY
      integer(ULONG) :: htonl ! u_long
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'htonl' :: htonl
      integer(ULONG) hostlong ! u_long hostlong
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION htons( &
            hostshort)
    USE DFWINTY
      integer(USHORT) :: htons ! u_short
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'htons' :: htons
      integer(USHORT) hostshort ! u_short hostshort
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION inet_addr( &
            cp)
    USE DFWINTY
      integer(LONG) :: inet_addr ! long
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'inet_addr' :: inet_addr
    !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: cp
      character*(*)  cp ! char*  cp
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION inet_ntoa( &
            in)
    USE DFWINTY
       integer(LPCHAR) :: inet_ntoa ! char*
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'inet_ntoa' :: inet_ntoa
       TYPE(T_in_addr) in ! struct_in_addr in
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION listen( &
            s, &
            backlog)
    USE DFWINTY
      integer(SINT) :: listen ! int
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'listen' :: listen
      integer(UINT_PTR)  s ! SOCKET s
      integer(SINT) backlog ! int backlog
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION ntohl( &
            netlong)
    USE DFWINTY
      integer(ULONG) :: ntohl ! u_long
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'ntohl' :: ntohl
      integer(ULONG) netlong ! u_long netlong
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION ntohs( &
            netshort)
    USE DFWINTY
      integer(USHORT) :: ntohs ! u_short
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'ntohs' :: ntohs
      integer(USHORT) netshort ! u_short netshort
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION recv( &
            s, &
            buf, &
            len, &
            flags)
    USE DFWINTY
      integer(SINT) :: recv ! int
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'recv' :: recv
      integer(UINT_PTR)  s ! SOCKET s
    !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: buf
      character*(*)  buf ! char*  buf
      integer(SINT) len ! int len
      integer(SINT) flags ! int flags
     END FUNCTION
    END INTERFACE
INTERFACE 
FUNCTION recvfrom( &
        s, &
        buf, &
        len, &
        flags, &
        from, &
        fromlen)
USE DFWINTY
  integer(SINT) :: recvfrom ! int
    !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'recvfrom' :: recvfrom
  integer(UINT_PTR) s ! SOCKET s
    !DEC$ ATTRIBUTES REFERENCE, IGNORE_LOC, ALLOW_NULL :: buf
  character*(*) buf ! char*  buf
  integer(SINT) len ! int len
  integer(SINT) flags ! int flags
    !DEC$ ATTRIBUTES REFERENCE, IGNORE_LOC, ALLOW_NULL :: from
  TYPE(T_sockaddr) from ! struct_sockaddr * from
  integer(SINT) fromlen ! int * fromlen
 END FUNCTION
END INTERFACE
INTERFACE 
FUNCTION select( &
        nfds, &
        readfds, &
        writefds, &
        exceptfds, &
        timeout)
USE DFWINTY
  integer(SINT) :: select ! int
    !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'select' :: select
  integer(SINT) nfds ! int nfds
    !DEC$ ATTRIBUTES REFERENCE, IGNORE_LOC, ALLOW_NULL :: readfds
      TYPE (T_fd_set) readfds ! fd_set* readfds
    !DEC$ ATTRIBUTES REFERENCE, IGNORE_LOC, ALLOW_NULL :: writefds
      TYPE (T_fd_set) writefds ! fd_set* writefds
    !DEC$ ATTRIBUTES REFERENCE, IGNORE_LOC, ALLOW_NULL :: exceptfds
      TYPE (T_fd_set) exceptfds ! fd_set* exceptfds
    !DEC$ ATTRIBUTES REFERENCE, IGNORE_LOC, ALLOW_NULL :: timeout
      TYPE(T_timeval) timeout ! struct_timeval* timeout
 END FUNCTION
END INTERFACE
    INTERFACE 
    FUNCTION send( &
            s, &
            buf, &
            len, &
            flags)
    USE DFWINTY
      integer(SINT) :: send ! int
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'send' :: send
      integer(UINT_PTR)  s ! SOCKET s
    !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: buf
      character*(*)  buf ! char*  buf
      integer(SINT) len ! int len
      integer(SINT) flags ! int flags
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION sendto( &
            s, &
            buf, &
            len, &
            flags, &
            to, &
            tolen)
    USE DFWINTY
      integer(SINT) :: sendto ! int
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'sendto' :: sendto
      integer(UINT_PTR)  s ! SOCKET s
    !DEC$ ATTRIBUTES REFERENCE, IGNORE_LOC, ALLOW_NULL :: buf
      character*(*)  buf ! char*  buf
      integer(SINT) len ! int len
      integer(SINT) flags ! int flags
    !DEC$ ATTRIBUTES REFERENCE, IGNORE_LOC, ALLOW_NULL :: to
      TYPE(T_sockaddr) to ! struct_sockaddr* to
      integer(SINT) tolen ! int tolen
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION setsockopt( &
            s, &
            level, &
            optname, &
            optval, &
            optlen)
    USE DFWINTY
      integer(SINT) :: setsockopt ! int
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'setsockopt' :: setsockopt
      integer(UINT_PTR)  s ! SOCKET s
      integer(SINT) level ! int level
      integer(SINT) optname ! int optname
    !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: optval
      character*(*)  optval ! char*  optval
      integer(SINT) optlen ! int optlen
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION shutdown( &
            s, &
            how)
    USE DFWINTY
      integer(SINT) :: shutdown ! int
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'shutdown' :: shutdown
      integer(UINT_PTR)  s ! SOCKET s
      integer(SINT) how ! int how
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION socket( &
            af, &
            type, &
            protocol)
    USE DFWINTY
      integer(UINT_PTR)  :: socket ! SOCKET
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'socket' :: socket
      integer(SINT) af ! int af
      integer(SINT) type ! int type
      integer(SINT) protocol ! int protocol
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION gethostbyaddr( &
            addr, &
            len, &
            type)
    USE DFWINTY
        integer(UINT_PTR) :: gethostbyaddr ! struct_hostent*
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'gethostbyaddr' :: gethostbyaddr
    !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: addr
      character*(*)  addr ! char*  addr
      integer(SINT) len ! int len
      integer(SINT) type ! int type
     END FUNCTION
    END INTERFACE

    INTERFACE 
    FUNCTION gethostbyname( &
             name)
    USE DFWINTY
        integer(UINT_PTR) :: gethostbyname ! hostent*
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'gethostbyname' :: gethostbyname
    !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: name
      character*(*)  name ! char*  name
    END FUNCTION
    END INTERFACE

    INTERFACE 
    FUNCTION gethostname( &
            name, &
            namelen)
    USE DFWINTY
      integer(SINT) :: gethostname ! int
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'gethostname' :: gethostname
    !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: name
      character*(*)  name ! char*  name
      integer(SINT) namelen ! int namelen
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION getservbyport( &
            port, &
            proto)
    USE DFWINTY
       integer(UINT_PTR) :: getservbyport ! struct_servent*
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'getservbyport' :: getservbyport
      integer(SINT) port ! int port
    !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: proto
      character*(*)  proto ! char*  proto
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION getservbyname( &
            name, &
            proto)
    USE DFWINTY
      integer(UINT_PTR) :: getservbyname ! struct_servent*
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'getservbyname' :: getservbyname
    !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: name
      character*(*)  name ! char*  name
    !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: proto
      character*(*)  proto ! char*  proto
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION WSAStartup( &
            wVersionRequired, &
            lpWSAData)
    USE DFWINTY
      integer(SINT) :: WSAStartup ! int
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'WSAStartup' :: WSAStartup
      integer(WORD) wVersionRequired ! WORD wVersionRequired
    !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: lpWSAData
      TYPE(T_WSADATA)  lpWSAData ! LPWSADATA lpWSAData
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION WSACleanup( &
                 )
    USE DFWINTY
      integer(SINT) :: WSACleanup ! int
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'WSACleanup' :: WSACleanup
     END FUNCTION
    END INTERFACE
    INTERFACE 
       SUBROUTINE WSASetLastError( &
            iError)
    USE DFWINTY
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'WSASetLastError' :: WSASetLastError
      integer(SINT) iError ! int iError
     END SUBROUTINE
    END INTERFACE
    INTERFACE 
    FUNCTION WSAGetLastError( &
                 )
    USE DFWINTY
      integer(SINT) :: WSAGetLastError ! int
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'WSAGetLastError' :: WSAGetLastError
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION WSAIsBlocking( &
                 )
    USE DFWINTY
      integer(BOOL) :: WSAIsBlocking ! BOOL
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'WSAIsBlocking' :: WSAIsBlocking
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION WSAUnhookBlockingHook( &
                 )
    USE DFWINTY
      integer(SINT) :: WSAUnhookBlockingHook ! int
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'WSAUnhookBlockingHook' :: WSAUnhookBlockingHook
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION WSASetBlockingHook( &
            lpBlockFunc)
    USE DFWINTY
      integer(UINT_PTR) :: WSASetBlockingHook ! FARPROC
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'WSASetBlockingHook' :: WSASetBlockingHook
      integer(UINT_PTR) lpBlockFunc ! FARPROC lpBlockFunc
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION WSACancelBlockingCall( &
                 )
    USE DFWINTY
      integer(SINT) :: WSACancelBlockingCall ! int
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'WSACancelBlockingCall' :: WSACancelBlockingCall
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION WSAAsyncGetServByName( &
            hWnd, &
            wMsg, &
            name, &
            proto, &
            buf, &
            buflen)
    USE DFWINTY
      integer(HANDLE) :: WSAAsyncGetServByName ! HANDLE
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'WSAAsyncGetServByName' :: WSAAsyncGetServByName
      integer(HANDLE) hWnd ! HWND hWnd
      integer(UINT) wMsg ! u_int wMsg
    !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: name
      character*(*)  name ! char*  name
    !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: proto
      character*(*)  proto ! char*  proto
    !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: buf
      character*(*)  buf ! char*  buf
      integer(SINT) buflen ! int buflen
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION WSAAsyncGetServByPort( &
            hWnd, &
            wMsg, &
            port, &
            proto, &
            buf, &
            buflen)
    USE DFWINTY
      integer(HANDLE) :: WSAAsyncGetServByPort ! HANDLE
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'WSAAsyncGetServByPort' :: WSAAsyncGetServByPort
      integer(HANDLE) hWnd ! HWND hWnd
      integer(UINT) wMsg ! u_int wMsg
      integer(SINT) port ! int port
    !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: proto
      character*(*)  proto ! char*  proto
    !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: buf
      character*(*)  buf ! char*  buf
      integer(SINT) buflen ! int buflen
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION WSAAsyncGetProtoByName( &
            hWnd, &
            wMsg, &
            name, &
            buf, &
            buflen)
    USE DFWINTY
      integer(HANDLE) :: WSAAsyncGetProtoByName ! HANDLE
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'WSAAsyncGetProtoByName' :: WSAAsyncGetProtoByName
      integer(HANDLE) hWnd ! HWND hWnd
      integer(UINT) wMsg ! u_int wMsg
    !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: name
      character*(*)  name ! char*  name
    !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: buf
      character*(*)  buf ! char*  buf
      integer(SINT) buflen ! int buflen
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION WSAAsyncGetProtoByNumber( &
            hWnd, &
            wMsg, &
            number, &
            buf, &
            buflen)
    USE DFWINTY
      integer(HANDLE) :: WSAAsyncGetProtoByNumber ! HANDLE
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'WSAAsyncGetProtoByNumber' :: WSAAsyncGetProtoByNumber
      integer(HANDLE) hWnd ! HWND hWnd
      integer(UINT) wMsg ! u_int wMsg
      integer(SINT) number ! int number
    !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: buf
      character*(*)  buf ! char*  buf
      integer(SINT) buflen ! int buflen
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION WSAAsyncGetHostByName( &
            hWnd, &
            wMsg, &
            name, &
            buf, &
            buflen)
    USE DFWINTY
      integer(HANDLE) :: WSAAsyncGetHostByName ! HANDLE
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'WSAAsyncGetHostByName' :: WSAAsyncGetHostByName
      integer(HANDLE) hWnd ! HWND hWnd
      integer(UINT) wMsg ! u_int wMsg
    !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: name
      character*(*)  name ! char*  name
    !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: buf
      character*(*)  buf ! char*  buf
      integer(SINT) buflen ! int buflen
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION WSAAsyncGetHostByAddr( &
            hWnd, &
            wMsg, &
            addr, &
            len, &
            type, &
            buf, &
            buflen)
    USE DFWINTY
      integer(HANDLE) :: WSAAsyncGetHostByAddr ! HANDLE
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'WSAAsyncGetHostByAddr' :: WSAAsyncGetHostByAddr
      integer(HANDLE) hWnd ! HWND hWnd
      integer(UINT) wMsg ! u_int wMsg
    !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: addr
      character*(*)  addr ! char*  addr
      integer(SINT) len ! int len
      integer(SINT) type ! int type
    !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: buf
      character*(*)  buf ! char*  buf
      integer(SINT) buflen ! int buflen
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION WSACancelAsyncRequest( &
            hAsyncTaskHandle)
    USE DFWINTY
      integer(SINT) :: WSACancelAsyncRequest ! int
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'WSACancelAsyncRequest' :: WSACancelAsyncRequest
      integer(HANDLE) hAsyncTaskHandle ! HANDLE hAsyncTaskHandle
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION WSAAsyncSelect( &
            s, &
            hWnd, &
            wMsg, &
            lEvent)
    USE DFWINTY
      integer(SINT) :: WSAAsyncSelect ! int
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'WSAAsyncSelect' :: WSAAsyncSelect
      integer(UINT_PTR)  s ! SOCKET s
      integer(HANDLE) hWnd ! HWND hWnd
      integer(UINT) wMsg ! u_int wMsg
      integer(LONG) lEvent ! long lEvent
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION WSARecvEx( &
            s, &
            buf, &
            len, &
            flags)
    USE DFWINTY
      integer(SINT) :: WSARecvEx ! int
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'WSARecvEx' :: WSARecvEx
      integer(UINT_PTR)  s ! SOCKET s
    !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: buf
      character*(*)  buf ! char*  buf
      integer(SINT) len ! int len
      integer(LPINT) flags ! int* flags
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION TransmitFile( &
            hSocket, &
            hFile, &
            nNumberOfBytesToWrite, &
            nNumberOfBytesPerSend, &
            lpOverlapped, &
            lpTransmitBuffers, &
            dwReserved)
    USE DFWINTY
      integer(BOOL) :: TransmitFile ! BOOL
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'TransmitFile' :: TransmitFile
      integer(UINT_PTR)  hSocket ! SOCKET hSocket
      integer(HANDLE) hFile ! HANDLE hFile
      integer(DWORD) nNumberOfBytesToWrite ! DWORD nNumberOfBytesToWrite
      integer(DWORD) nNumberOfBytesPerSend ! DWORD nNumberOfBytesPerSend
    !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: lpOverlapped
      TYPE (T_OVERLAPPED) lpOverlapped ! LPOVERLAPPED lpOverlapped
    !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: lpTransmitBuffers
      TYPE (T_TRANSMIT_FILE_BUFFERS) lpTransmitBuffers ! LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers
      integer(DWORD) dwReserved ! DWORD dwReserved
     END FUNCTION
    END INTERFACE
    INTERFACE 
    FUNCTION AcceptEx( &
            sListenSocket, &
            sAcceptSocket, &
            lpOutputBuffer, &
            dwReceiveDataLength, &
            dwLocalAddressLength, &
            dwRemoteAddressLength, &
            lpdwBytesReceived, &
            lpOverlapped)
    USE DFWINTY
      integer(BOOL) :: AcceptEx ! BOOL
        !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'AcceptEx' :: AcceptEx
      integer(UINT_PTR)  sListenSocket ! SOCKET sListenSocket
      integer(UINT_PTR)  sAcceptSocket ! SOCKET sAcceptSocket
      integer(PVOID) lpOutputBuffer ! PVOID lpOutputBuffer
      integer(DWORD) dwReceiveDataLength ! DWORD dwReceiveDataLength
      integer(DWORD) dwLocalAddressLength ! DWORD dwLocalAddressLength
      integer(DWORD) dwRemoteAddressLength ! DWORD dwRemoteAddressLength
      integer(LPDWORD) lpdwBytesReceived ! LPDWORD lpdwBytesReceived
    !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: lpOverlapped
      TYPE (T_OVERLAPPED) lpOverlapped ! LPOVERLAPPED lpOverlapped
     END FUNCTION
    END INTERFACE
 
INTERFACE 
SUBROUTINE GetAcceptExSockaddrs( &
        lpOutputBuffer, &
        dwReceiveDataLength, &
        dwLocalAddressLength, &
        dwRemoteAddressLength, &
        LocalSockaddr, &
        LocalSockaddrLength, &
        RemoteSockaddr, &
        RemoteSockaddrLength)
USE DFWINTY
    !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'GetAcceptExSockaddrs' :: GetAcceptExSockaddrs
  integer(PVOID) lpOutputBuffer ! PVOID lpOutputBuffer
  integer(DWORD) dwReceiveDataLength ! DWORD dwReceiveDataLength
  integer(DWORD) dwLocalAddressLength ! DWORD dwLocalAddressLength
  integer(DWORD) dwRemoteAddressLength ! DWORD dwRemoteAddressLength
!DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: LocalSockaddr
 TYPE(T_sockaddr)  LocalSockaddr ! struct_sockaddr* * LocalSockaddr
  integer(LPINT) LocalSockaddrLength ! LPINT LocalSockaddrLength
!DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: RemoteSockaddr
 TYPE(T_sockaddr) RemoteSockaddr ! struct_sockaddr* * RemoteSockaddr
  integer(LPINT) RemoteSockaddrLength ! LPINT RemoteSockaddrLength
 END SUBROUTINE
END INTERFACE
!
end module wsock32
!
!DEC$ ENDIF ! /* WSOCK32_ */
