diff --git a/dlls/mswsock/mswsock.c b/dlls/mswsock/mswsock.c index 48ce2c1a2b1..4b2cdbf0373 100644 --- a/dlls/mswsock/mswsock.c +++ b/dlls/mswsock/mswsock.c @@ -18,54 +18,21 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "config.h" + #include #include "windef.h" #include "winbase.h" #include "winsock2.h" +#include "mswsock.h" + #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(mswsock); -/****************************************************************************** - * This structure is used with the TransmitFile() function. - * - */ - -typedef struct _TRANSMIT_FILE_BUFFERS { - PVOID Head; - DWORD HeadLength; - PVOID Tail; - DWORD TailLength; -} TRANSMIT_FILE_BUFFERS; -typedef TRANSMIT_FILE_BUFFERS* LPTRANSMIT_FILE_BUFFERS; - - -/****************************************************************************** - * TransmitFile (MSWSOCK.@) - * - * This function is used to transmit a file over socket. - * - * TODO - * This function is currently implemented as a stub. - */ - -void WINAPI TransmitFile(SOCKET s, - HANDLE f, - DWORD size, - DWORD numpersend, - LPOVERLAPPED overlapped, - LPTRANSMIT_FILE_BUFFERS trans, - DWORD flags) -{ - FIXME("not implemented\n"); -} - - -/****************************************************************************** - * AcceptEx (MSWSOCK.@) +/*********************************************************************** + * AcceptEx (MSWSOCK.@) * * This function is used to accept a new connection, get the local and remote * address, and receive the initial block of data sent by the client. @@ -74,14 +41,96 @@ void WINAPI TransmitFile(SOCKET s, * This function is currently implemented as a stub. */ -void WINAPI AcceptEx(SOCKET listener, - SOCKET acceptor, - PVOID oput, - DWORD recvlen, - DWORD locaddrlen, - DWORD remaddrlen, - LPDWORD bytesrecv, - LPOVERLAPPED overlapped) +BOOL WINAPI AcceptEx( + SOCKET sListenSocket, /* [in] Descriptor identifying a socket that + has already been called with the listen + function */ + SOCKET sAcceptSocket, /* [in] Descriptor identifying a socket on + which to accept an incoming connection */ + PVOID lpOutputBuffer, /* [in] Pointer to a buffer */ + DWORD dwReceiveDataLength, /* [in] Number of bytes in lpOutputBuffer + that will be used for actual receive data + at the beginning of the buffer */ + DWORD dwLocalAddressLength, /* [in] Number of bytes reserved for the + local address information */ + DWORD dwRemoteAddressLength, /* [in] Number of bytes reserved for the + remote address information */ + LPDWORD lpdwBytesReceived, /* [out] Pointer to a DWORD that receives + the count of bytes received */ + LPOVERLAPPED lpOverlapped) /* [in] Specify in order to achieve an + overlapped (asynchronous) I/O + operation */ { - FIXME("not implemented\n"); + FIXME("not implemented\n"); + + return FALSE; +} + +/*********************************************************************** + * GetAcceptExSockaddrs (MSWSOCK.@) + */ +VOID WINAPI GetAcceptExSockaddrs( + PVOID lpOutputBuffer, /* [in] Pointer to a buffer */ + DWORD dwReceiveDataLength, /* [in] Number of bytes in the buffer used + for receiving the first data */ + DWORD dwLocalAddressLength, /* [in] Number of bytes reserved for the + local address information */ + DWORD dwRemoteAddressLength, /* [in] Number of bytes reserved for the + remote address information */ + struct sockaddr **LocalSockaddr, /* [out] Pointer to the sockaddr + structure that receives the local + address of the connection */ + LPINT LocalSockaddrLength, /* [out] Size in bytes of the local + address */ + struct sockaddr **RemoteSockaddr, /* [out] Pointer to the sockaddr + structure that receives the remote + address of the connection */ + LPINT RemoteSockaddrLength) /* [out] Size in bytes of the remote address */ +{ + FIXME("not implemented\n"); +} + +/*********************************************************************** + * TransmitFile (MSWSOCK.@) + * + * This function is used to transmit a file over socket. + * + * TODO + * This function is currently implemented as a stub. + */ + +BOOL WINAPI TransmitFile( + SOCKET hSocket, /* [in] Handle to a connected socket */ + HANDLE hFile, /* [in] Handle to the open file that should be + transmited */ + DWORD nNumberOfBytesToWrite, /* [in] Number of file bytes to + transmit */ + DWORD nNumberOfBytesPerSend, /* [in] Size in bytes of each block of + data sent in each send operation */ + LPOVERLAPPED lpOverlapped, /* [in] Specify in order to achieve an + overlapped (asynchronous) I/O + operation */ + LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers, + /* [in] Contains pointers to data to send before and after + the file data is sent */ + DWORD dwFlags) /* [in] Flags */ +{ + FIXME("not implemented\n"); + + return FALSE; +} + +/*********************************************************************** + * WSARecvEx (MSWSOCK.@) + */ +INT WINAPI WSARecvEx( + SOCKET s, /* [in] Descriptor identifying a connected socket */ + char *buf, /* [out] Buffer for the incoming data */ + INT len, /* [in] Length of buf, in bytes */ + INT *flags) /* [in/out] Indicator specifying whether the message is + fully or partially received for datagram sockets */ +{ + FIXME("not implemented\n"); + + return SOCKET_ERROR; } diff --git a/dlls/mswsock/mswsock.spec b/dlls/mswsock/mswsock.spec index 81fff4360e2..9c13ae5c4e3 100644 --- a/dlls/mswsock/mswsock.spec +++ b/dlls/mswsock/mswsock.spec @@ -1,2 +1,32 @@ @ stdcall AcceptEx(long long ptr long long long ptr ptr) +@ stub EnumProtocolsA +@ stub EnumProtocolsW +@ stub GetAcceptExSockaddrs +@ stub GetAddressByNameA +@ stub GetAddressByNameW +@ stub GetNameByTypeA +@ stub GetNameByTypeW +@ stub GetServiceA +@ stub GetServiceW +@ stub GetTypeByNameA +@ stub GetTypeByNameW +@ stub MigrateWinsockConfiguration +@ stub NPLoadNameSpaces +@ stub NSPStartup +@ stub ServiceMain +@ stub SetServiceA +@ stub SetServiceW +@ stub StartWsdpService +@ stub StopWsdpService +@ stub SvchostPushServiceGlobals @ stdcall TransmitFile(long long long long ptr ptr long) +@ stub WSARecvEx +@ stub WSPStartup +@ stub dn_expand +@ stub getnetbyname +@ stub inet_network +@ stub rcmd +@ stub rexec +@ stub rresvport +@ stub s_perror +@ stub sethostname diff --git a/dlls/winsock/async.c b/dlls/winsock/async.c index dc87e155828..897964435dc 100644 --- a/dlls/winsock/async.c +++ b/dlls/winsock/async.c @@ -104,6 +104,7 @@ #include "wingdi.h" #include "winuser.h" #include "winsock2.h" +#include "mswsock.h" #include "ws2spi.h" #include "wownt32.h" #include "wine/winsock16.h" diff --git a/dlls/winsock/socket.c b/dlls/winsock/socket.c index d81785eb55d..c70cd184e96 100644 --- a/dlls/winsock/socket.c +++ b/dlls/winsock/socket.c @@ -119,6 +119,7 @@ #include "winuser.h" #include "winerror.h" #include "winsock2.h" +#include "mswsock.h" #include "ws2tcpip.h" #include "wsipx.h" #include "winnt.h" diff --git a/include/mswsock.h b/include/mswsock.h index da021f962fd..09b824759e0 100644 --- a/include/mswsock.h +++ b/include/mswsock.h @@ -18,26 +18,160 @@ #ifndef _MSWSOCK_ #define _MSWSOCK_ -#ifndef USE_WS_PREFIX - -#define SO_OPENTYPE 0x7008 -#define SO_SYNCHRONOUS_ALERT 0x10 -#define SO_SYNCHRONOUS_NONALERT 0x20 - -#else - -#define WS_SO_OPENTYPE 0x7008 -#define WS_SO_SYNCHRONOUS_ALERT 0x10 -#define WS_SO_SYNCHRONOUS_NONALERT 0x20 - -#endif - - #ifdef __cplusplus extern "C" { #endif /* defined(__cplusplus) */ -int WINAPI WSARecvEx(SOCKET,char*,int,int*); +#ifndef USE_WS_PREFIX +#define SO_CONNDATA 0x7000 +#define SO_CONNOPT 0x7001 +#define SO_DISCDATA 0x7002 +#define SO_DISCOPT 0x7003 +#define SO_CONNDATALEN 0x7004 +#define SO_CONNOPTLEN 0x7005 +#define SO_DISCDATALEN 0x7006 +#define SO_DISCOPTLEN 0x7007 +#else +#define WS_SO_CONNDATA 0x7000 +#define WS_SO_CONNOPT 0x7001 +#define WS_SO_DISCDATA 0x7002 +#define WS_SO_DISCOPT 0x7003 +#define WS_SO_CONNDATALEN 0x7004 +#define WS_SO_CONNOPTLEN 0x7005 +#define WS_SO_DISCDATALEN 0x7006 +#define WS_SO_DISCOPTLEN 0x7007 +#endif + +#ifndef USE_WS_PREFIX +#define SO_OPENTYPE 0x7008 +#else +#define WS_SO_OPENTYPE 0x7008 +#endif + +#ifndef USE_WS_PREFIX +#define SO_SYNCHRONOUS_ALERT 0x10 +#define SO_SYNCHRONOUS_NONALERT 0x20 +#else +#define WS_SO_SYNCHRONOUS_ALERT 0x10 +#define WS_SO_SYNCHRONOUS_NONALERT 0x20 +#endif + +#ifndef USE_WS_PREFIX +#define SO_MAXDG 0x7009 +#define SO_MAXPATHDG 0x700A +#define SO_UPDATE_ACCEPT_CONTEXT 0x700B +#define SO_CONNECT_TIME 0x700C +#define SO_UPDATE_CONNECT_CONTEXT 0x7010 +#else +#define WS_SO_MAXDG 0x7009 +#define WS_SO_MAXPATHDG 0x700A +#define WS_SO_UPDATE_ACCEPT_CONTEXT 0x700B +#define WS_SO_CONNECT_TIME 0x700C +#define WS_SO_UPDATE_CONNECT_CONTEXT 0x7010 +#endif + +#ifndef USE_WS_PREFIX +#define TCP_BSDURGENT 0x7000 +#else +#define WS_TCP_BSDURGENT 0x7000 +#endif + +#define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12) + + +#define DE_REUSE_SOCKET TF_REUSE_SOCKET + +#ifndef USE_WS_PREFIX +#define MSG_TRUNC 0x0100 +#define MSG_CTRUNC 0x0200 +#define MSG_BCAST 0x0400 +#define MSG_MCAST 0x0800 +#else +#define WS_MSG_TRUNC 0x0100 +#define WS_MSG_CTRUNC 0x0200 +#define WS_MSG_BCAST 0x0400 +#define WS_MSG_MCAST 0x0800 +#endif + +#define TF_DISCONNECT 0x01 +#define TF_REUSE_SOCKET 0x02 +#define TF_WRITE_BEHIND 0x04 +#define TF_USE_DEFAULT_WORKER 0x00 +#define TF_USE_SYSTEM_THREAD 0x10 +#define TF_USE_KERNEL_APC 0x20 + +#define TP_DISCONNECT TF_DISCONNECT +#define TP_REUSE_SOCKET TF_REUSE_SOCKET +#define TP_USE_DEFAULT_WORKER TF_USE_DEFAULT_WORKER +#define TP_USE_SYSTEM_THREAD TF_USE_SYSTEM_THREAD +#define TP_USE_KERNEL_APC TF_USE_KERNEL_APC + +#define TP_ELEMENT_MEMORY 1 +#define TP_ELEMENT_FILE 2 +#define TP_ELEMENT_EOP 4 + +#define WSAID_ACCEPTEX \ + {0xb5367df1,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}} +#define WSAID_CONNECTEX \ + {0x25a207b9,0xddf3,0x4660,{0x8e,0xe9,0x76,0xe5,0x8c,0x74,0x06,0x3e}} +#define WSAID_DISCONNECTEX \ + {0x7fda2e11,0x8630,0x436f,{0xa0, 0x31, 0xf5, 0x36, 0xa6, 0xee, 0xc1, 0x57}} +#define WSAID_GETACCEPTEXSOCKADDRS \ + {0xb5367df2,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}} +#define WSAID_TRANSMITFILE \ + {0xb5367df0,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}} +#define WSAID_TRANSMITPACKETS \ + {0xd9689da0,0x1f90,0x11d3,{0x99,0x71,0x00,0xc0,0x4f,0x68,0xc8,0x76}} +#define WSAID_WSARECVMSG \ + {0xf689d7c8,0x6f1f,0x436b,{0x8a,0x53,0xe5,0x4f,0xe3,0x51,0xc3,0x22}} + +typedef struct _TRANSMIT_FILE_BUFFERS { + LPVOID Head; + DWORD HeadLength; + LPVOID Tail; + DWORD TailLength; +} TRANSMIT_FILE_BUFFERS, *PTRANSMIT_FILE_BUFFERS, *LPTRANSMIT_FILE_BUFFERS; + +typedef struct _TRANSMIT_PACKETS_ELEMENT { + ULONG dwElFlags; + ULONG cLength; + union { + struct { + LARGE_INTEGER nFileOffset; + HANDLE hFile; + } DUMMYSTRUCTNAME; + PVOID pBuffer; + } DUMMYUNIONNAME; +} TRANSMIT_PACKETS_ELEMENT, *PTRANSMIT_PACKETS_ELEMENT, *LPTRANSMIT_PACKETS_ELEMENT; + +typedef struct _WSAMSG { + LPSOCKADDR name; + INT namelen; + LPWSABUF lpBuffers; + DWORD dwBufferCount; + WSABUF Control; + DWORD dwFlags; +} WSAMSG, *PWSAMSG, *LPWSAMSG; + +typedef struct _WSACMSGHDR { + SIZE_T cmsg_len; + INT cmsg_level; + INT cmsg_type; + /* followed by UCHAR cmsg_data[] */ +} WSACMSGHDR, *PWSACMSGHDR, *LPWSACMSGHDR; + +typedef BOOL (WINAPI * LPFN_ACCEPTEX)(SOCKET, SOCKET, PVOID, DWORD, DWORD, DWORD, LPDWORD, LPOVERLAPPED); +typedef BOOL (WINAPI * LPFN_CONNECTEX)(SOCKET, const struct sockaddr *, int, PVOID, DWORD, LPDWORD, LPOVERLAPPED); +typedef BOOL (WINAPI * LPFN_DISCONNECTEX)(SOCKET, LPOVERLAPPED, DWORD, DWORD); +typedef VOID (WINAPI * LPFN_GETACCEPTEXSOCKADDRS)(PVOID, DWORD, DWORD, DWORD, struct sockaddr **, LPINT, struct sockaddr **, LPINT); +typedef BOOL (WINAPI * LPFN_TRANSMITFILE)(SOCKET, HANDLE, DWORD, DWORD, LPOVERLAPPED, LPTRANSMIT_FILE_BUFFERS, DWORD); +typedef BOOL (WINAPI * LPFN_TRANSMITPACKETS)(SOCKET, LPTRANSMIT_PACKETS_ELEMENT, DWORD, DWORD, LPOVERLAPPED, DWORD); +typedef INT (WINAPI * LPFN_WSARECVMSG)(SOCKET, LPWSAMSG, LPDWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE); + +BOOL WINAPI AcceptEx(SOCKET, SOCKET, PVOID, DWORD, DWORD, DWORD, LPDWORD, LPOVERLAPPED); +VOID WINAPI GetAcceptExSockaddrs(PVOID, DWORD, DWORD, DWORD, struct sockaddr **, LPINT, struct sockaddr **, LPINT); +BOOL WINAPI TransmitFile(SOCKET, HANDLE, DWORD, DWORD, LPOVERLAPPED, LPTRANSMIT_FILE_BUFFERS, DWORD); +INT WINAPI WSARecvEx(SOCKET, char *, INT, INT *); #ifdef __cplusplus } diff --git a/include/winsock.h b/include/winsock.h index 77d6cd4d817..f23dbc20ed3 100644 --- a/include/winsock.h +++ b/include/winsock.h @@ -990,12 +990,6 @@ int WINAPI WS(setsockopt)(SOCKET,int,int,const char*,int); int WINAPI WS(shutdown)(SOCKET,int); SOCKET WINAPI WS(socket)(int,int,int); -#if defined(__WINESRC__) || !defined(__WINE_WINSOCK2__) -/* Stuff specific to winsock.h */ - -#include - -#endif /* __WINE_WINSOCK2__ */ #endif /* !defined(__WINE_WINSOCK2__) || WS_API_PROTOTYPES */