Created an initial Winsock 2 (ws2_32) DLL. Makes use of the Winsock 1
functions already implemented.
This commit is contained in:
parent
dd15b2fc4b
commit
829405af93
|
@ -109,6 +109,7 @@ EXTRADLLNAMES = \
|
|||
win32s16 \
|
||||
winaspi \
|
||||
winsock \
|
||||
ws2_32 \
|
||||
wow32 \
|
||||
wprocs
|
||||
|
||||
|
@ -341,7 +342,7 @@ libwinspool.drv.@LIBEXT@: winspool/libwinspool.drv.@LIBEXT@
|
|||
libwnaspi32.@LIBEXT@ libwinaspi.@LIBEXT@: winaspi/libwnaspi32.@LIBEXT@
|
||||
$(RM) $@ && $(LN_S) winaspi/libwnaspi32.@LIBEXT@ $@
|
||||
|
||||
libwsock32.@LIBEXT@ libwinsock.@LIBEXT@: winsock/libwsock32.@LIBEXT@
|
||||
libwsock32.@LIBEXT@ libwinsock.@LIBEXT@ libws2_32.@LIBEXT@: winsock/libwsock32.@LIBEXT@
|
||||
$(RM) $@ && $(LN_S) winsock/libwsock32.@LIBEXT@ $@
|
||||
|
||||
libx11drv.@LIBEXT@: x11drv/libx11drv.@LIBEXT@
|
||||
|
|
|
@ -4,9 +4,9 @@ SRCDIR = @srcdir@
|
|||
VPATH = @srcdir@
|
||||
MODULE = wsock32
|
||||
SOVERSION = 1.0
|
||||
ALTNAMES = winsock
|
||||
ALTNAMES = winsock ws2_32
|
||||
|
||||
SPEC_SRCS = winsock.spec wsock32.spec
|
||||
SPEC_SRCS = winsock.spec wsock32.spec ws2_32.spec
|
||||
|
||||
C_SRCS = \
|
||||
async.c \
|
||||
|
|
|
@ -611,6 +611,67 @@ INT WINAPI WSAStartup(UINT wVersionRequested, LPWSADATA lpWSAData)
|
|||
return WSAStartup16( wVersionRequested, lpWSAData );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* WS2_WSAStartup() (WS2_32.115)
|
||||
*/
|
||||
INT WINAPI WS2_WSAStartup(UINT wVersionRequested, LPWSADATA lpWSAData)
|
||||
{
|
||||
WSADATA WINSOCK_data = { 0x0202, 0x0202,
|
||||
"WINE Sockets 2.0",
|
||||
#ifdef linux
|
||||
"Linux/i386",
|
||||
#elif defined(__NetBSD__)
|
||||
"NetBSD/i386",
|
||||
#elif defined(sunos)
|
||||
"SunOS",
|
||||
#elif defined(__FreeBSD__)
|
||||
"FreeBSD",
|
||||
#elif defined(__OpenBSD__)
|
||||
"OpenBSD/i386",
|
||||
#else
|
||||
"Unknown",
|
||||
#endif
|
||||
WS_MAX_SOCKETS_PER_PROCESS,
|
||||
WS_MAX_UDP_DATAGRAM, (SEGPTR)NULL };
|
||||
LPWSINFO pwsi;
|
||||
|
||||
TRACE("verReq=%x\n", wVersionRequested);
|
||||
|
||||
if (LOBYTE(wVersionRequested) < 2)
|
||||
return WSAVERNOTSUPPORTED;
|
||||
|
||||
if (!lpWSAData) return WSAEINVAL;
|
||||
|
||||
/* initialize socket heap */
|
||||
|
||||
if( !_WSHeap )
|
||||
{
|
||||
_WSHeap = HeapCreate(HEAP_ZERO_MEMORY, 8120, 32768);
|
||||
if( !_WSHeap )
|
||||
{
|
||||
ERR("Fatal: failed to create WinSock heap\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if( _WSHeap == 0 ) return WSASYSNOTREADY;
|
||||
|
||||
pwsi = WINSOCK_GetIData();
|
||||
if( pwsi == NULL )
|
||||
{
|
||||
WINSOCK_CreateIData();
|
||||
pwsi = WINSOCK_GetIData();
|
||||
if (!pwsi) return WSASYSNOTREADY;
|
||||
}
|
||||
pwsi->num_startup++;
|
||||
|
||||
/* return winsock information */
|
||||
memcpy(lpWSAData, &WINSOCK_data, sizeof(WINSOCK_data));
|
||||
|
||||
TRACE("succeeded\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* WSACleanup() (WINSOCK.116)
|
||||
*/
|
||||
|
@ -2327,6 +2388,49 @@ INT16 WINAPI WSARecvEx16(SOCKET16 s, char *buf, INT16 len, INT16 *flags) {
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* WSACreateEvent() (WS2_32.???)
|
||||
*
|
||||
*/
|
||||
WSAEVENT WINAPI WSACreateEvent(void)
|
||||
{
|
||||
/* Create a manual-reset event, with initial state: unsignealed */
|
||||
TRACE("\n");
|
||||
|
||||
return CreateEventA(NULL, TRUE, FALSE, NULL);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* WSACloseEvent() (WS2_32.???)
|
||||
*
|
||||
*/
|
||||
BOOL WINAPI WSACloseEvent(WSAEVENT event)
|
||||
{
|
||||
TRACE ("event=0x%x\n", event);
|
||||
|
||||
return CloseHandle(event);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* WSASocketA() (WS2_32.???)
|
||||
*
|
||||
*/
|
||||
SOCKET WINAPI WSASocketA(int af, int type, int protocol,
|
||||
LPWSAPROTOCOL_INFOA lpProtocolInfo,
|
||||
GROUP g, DWORD dwFlags)
|
||||
{
|
||||
/*
|
||||
FIXME: The "advanced" parameters of WSASocketA (lpProtocolInfo,
|
||||
g, dwFlags) are ignored.
|
||||
*/
|
||||
|
||||
TRACE("af=%d type=%d protocol=%d protocol_info=%p group=%d flags=0x%lx\n",
|
||||
af, type, protocol, lpProtocolInfo, g, dwFlags );
|
||||
|
||||
return ( WSOCK32_socket (af, type, protocol) );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* __WSAFDIsSet() (WINSOCK.151)
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,127 @@
|
|||
# Winsock 2 DLL ~ ws2_32.dll
|
||||
#
|
||||
# Export table information obtained from Windows 2000 ws2_32.dll
|
||||
|
||||
name ws2_32
|
||||
type win32
|
||||
init WSOCK32_LibMain
|
||||
|
||||
# EXPORTS ***********
|
||||
1 stdcall accept(long ptr ptr) WSOCK32_accept
|
||||
2 stdcall bind(long ptr long) WSOCK32_bind
|
||||
3 stdcall closesocket(long) WSOCK32_closesocket
|
||||
4 stdcall connect(long ptr long) WSOCK32_connect
|
||||
5 stdcall getpeername(long ptr ptr) WSOCK32_getpeername
|
||||
6 stdcall getsockname(long ptr ptr) WSOCK32_getsockname
|
||||
7 stdcall getsockopt(long long long ptr ptr) WSOCK32_getsockopt
|
||||
8 stdcall htonl(long) WINSOCK_htonl
|
||||
9 stdcall htons(long) WINSOCK_htons
|
||||
10 stdcall ioctlsocket(long long ptr) WSOCK32_ioctlsocket
|
||||
11 stdcall inet_addr(str) WINSOCK_inet_addr
|
||||
12 stdcall inet_ntoa(ptr) WSOCK32_inet_ntoa
|
||||
13 stdcall listen(long long) WSOCK32_listen
|
||||
14 stdcall ntohl(long) WINSOCK_ntohl
|
||||
15 stdcall ntohs(long) WINSOCK_ntohs
|
||||
16 stdcall recv(long ptr long long) WSOCK32_recv
|
||||
17 stdcall recvfrom(long ptr long long ptr ptr) WSOCK32_recvfrom
|
||||
18 stdcall select(long ptr ptr ptr ptr) WSOCK32_select
|
||||
19 stdcall send(long ptr long long) WSOCK32_send
|
||||
20 stdcall sendto(long ptr long long ptr long) WSOCK32_sendto
|
||||
21 stdcall setsockopt(long long long ptr long) WSOCK32_setsockopt
|
||||
22 stdcall shutdown(long long) WSOCK32_shutdown
|
||||
23 stdcall socket(long long long) WSOCK32_socket
|
||||
24 stub WSApSetPostRoutine
|
||||
25 stub WPUCompleteOverlappedRequest
|
||||
26 stub WSAAccept
|
||||
27 stub WSAAddressToStringA
|
||||
28 stub WSAAddressToStringW
|
||||
29 stdcall WSACloseEvent(long) WSACloseEvent
|
||||
30 stub WSAConnect
|
||||
31 stdcall WSACreateEvent () WSACreateEvent
|
||||
32 stub WSADuplicateSocketA
|
||||
33 stub WSADuplicateSocketW
|
||||
34 stub WSAEnumNameSpaceProvidersA
|
||||
35 stub WSAEnumNameSpaceProvidersW
|
||||
36 stdcall WSAEnumNetworkEvents(long long ptr) WSAEnumNetworkEvents
|
||||
37 stub WSAEnumProtocolsA
|
||||
38 stub WSAEnumProtocolsW
|
||||
39 stdcall WSAEventSelect(long long long) WSAEventSelect
|
||||
40 stub WSAGetOverlappedResult
|
||||
41 stub WSAGetQOSByName
|
||||
42 stub WSAGetServiceClassInfoA
|
||||
43 stub WSAGetServiceClassInfoW
|
||||
44 stub WSAGetServiceClassNameByClassIdA
|
||||
45 stub WSAGetServiceClassNameByClassIdW
|
||||
46 stub WSAHtonl
|
||||
47 stub WSAHtons
|
||||
48 stub WSAInstallServiceClassA
|
||||
49 stub WSAInstallServiceClassW
|
||||
50 stub WSAIoctl
|
||||
51 stdcall gethostbyaddr(ptr long long) WSOCK32_gethostbyaddr
|
||||
52 stdcall gethostbyname(str) WSOCK32_gethostbyname
|
||||
53 stdcall getprotobyname(str) WSOCK32_getprotobyname
|
||||
54 stdcall getprotobynumber(long) WSOCK32_getprotobynumber
|
||||
55 stdcall getservbyname(str str) WSOCK32_getservbyname
|
||||
56 stdcall getservbyport(long str) WSOCK32_getservbyport
|
||||
57 stdcall gethostname(ptr long) WSOCK32_gethostname
|
||||
58 stub WSAJoinLeaf
|
||||
59 stub WSALookupServiceBeginA
|
||||
60 stub WSALookupServiceBeginW
|
||||
61 stub WSALookupServiceEnd
|
||||
62 stub WSALookupServiceNextA
|
||||
63 stub WSALookupServiceNextW
|
||||
64 stub WSANtohl
|
||||
65 stub WSANtohs
|
||||
66 stub WSAProviderConfigChange
|
||||
67 stub WSARecv
|
||||
68 stub WSARecvDisconnect
|
||||
69 stub WSARecvFrom
|
||||
70 stub WSARemoveServiceClass
|
||||
71 stub WSAResetEvent
|
||||
72 stub WSASend
|
||||
73 stub WSASendDisconnect
|
||||
74 stub WSASendTo
|
||||
75 stub WSASetEvent
|
||||
76 stub WSASetServiceA
|
||||
77 stub WSASetServiceW
|
||||
78 stdcall WSASocketA(long long long ptr long long) WSASocketA
|
||||
79 stub WSASocketW
|
||||
80 stub WSAStringToAddressA
|
||||
81 stub WSAStringToAddressW
|
||||
82 stub WSAWaitForMultipleEvents
|
||||
83 stub WSCDeinstallProvider
|
||||
84 stub WSCEnableNSProvider
|
||||
85 stub WSCEnumProtocols
|
||||
86 stub WSCGetProviderPath
|
||||
87 stub WSCInstallNameSpace
|
||||
88 stub WSCInstallProvider
|
||||
89 stub WSCUnInstallNameSpace
|
||||
90 stub WSCWriteNameSpaceOrder
|
||||
91 stub WSCWriteProviderOrder
|
||||
|
||||
# 92 ~ 100 UNKNOWN
|
||||
|
||||
101 stdcall WSAAsyncSelect(long long long long) WSAAsyncSelect
|
||||
102 stdcall WSAAsyncGetHostByAddr(long long ptr long long ptr long) WSAAsyncGetHostByAddr
|
||||
103 stdcall WSAAsyncGetHostByName(long long str ptr long) WSAAsyncGetHostByName
|
||||
104 stdcall WSAAsyncGetProtoByNumber(long long long ptr long) WSAAsyncGetProtoByNumber
|
||||
105 stdcall WSAAsyncGetProtoByName(long long str ptr long) WSAAsyncGetProtoByName
|
||||
106 stdcall WSAAsyncGetServByPort(long long long str ptr long) WSAAsyncGetServByPort
|
||||
107 stdcall WSAAsyncGetServByName(long long str str ptr long) WSAAsyncGetServByName
|
||||
108 stdcall WSACancelAsyncRequest(long) WSACancelAsyncRequest
|
||||
109 stdcall WSASetBlockingHook(ptr) WSASetBlockingHook
|
||||
110 stdcall WSAUnhookBlockingHook() WSAUnhookBlockingHook
|
||||
111 stdcall WSAGetLastError() WSAGetLastError
|
||||
112 stdcall WSASetLastError(long) WSASetLastError
|
||||
113 stdcall WSACancelBlockingCall() WSACancelBlockingCall
|
||||
114 stdcall WSAIsBlocking() WSAIsBlocking
|
||||
115 stdcall WSAStartup (long ptr) WS2_WSAStartup
|
||||
116 stdcall WSACleanup () WSACleanup
|
||||
|
||||
# 117 ~ 150 UNKNOWN
|
||||
|
||||
151 stdcall __WSAFDIsSet(long ptr) __WSAFDIsSet
|
||||
|
||||
# 152 ~ 499 UNKNOWN
|
||||
|
||||
500 stub WEP
|
|
@ -1,16 +1,16 @@
|
|||
/*
|
||||
* Winsock 2 definitions
|
||||
* Winsock 2 definitions - used for ws2_32.dll
|
||||
*
|
||||
* FIXME!!!!
|
||||
* FIXME: Still missing required Winsock 2 definitions.
|
||||
*/
|
||||
|
||||
#ifndef __WINSOCK2API__
|
||||
#define __WINSOCK2API__
|
||||
|
||||
#include "winsock.h"
|
||||
#include "wtypes.h"
|
||||
|
||||
#define FD_MAX_EVENTS 10
|
||||
|
||||
#define FD_MAX_EVENTS 10
|
||||
#define FD_READ_BIT 0
|
||||
#define FD_WRITE_BIT 1
|
||||
#define FD_OOB_BIT 2
|
||||
|
@ -18,17 +18,147 @@
|
|||
#define FD_CONNECT_BIT 4
|
||||
#define FD_CLOSE_BIT 5
|
||||
|
||||
typedef struct _WSANETWORKEVENTS {
|
||||
/*
|
||||
* Constants for WSAIoctl()
|
||||
*/
|
||||
#define IOC_UNIX 0x00000000
|
||||
#define IOC_WS2 0x08000000
|
||||
#define IOC_PROTOCOL 0x10000000
|
||||
#define IOC_VENDOR 0x18000000
|
||||
#define _WSAIO(x,y) (IOC_VOID|(x)|(y))
|
||||
#define _WSAIOR(x,y) (IOC_OUT|(x)|(y))
|
||||
#define _WSAIOW(x,y) (IOC_IN|(x)|(y))
|
||||
#define _WSAIORW(x,y) (IOC_INOUT|(x)|(y))
|
||||
#define SIO_ASSOCIATE_HANDLE _WSAIOW(IOC_WS2,1)
|
||||
#define SIO_ENABLE_CIRCULAR_QUEUEING _WSAIO(IOC_WS2,2)
|
||||
#define SIO_FIND_ROUTE _WSAIOR(IOC_WS2,3)
|
||||
#define SIO_FLUSH _WSAIO(IOC_WS2,4)
|
||||
#define SIO_GET_BROADCAST_ADDRESS _WSAIOR(IOC_WS2,5)
|
||||
#define SIO_GET_EXTENSION_FUNCTION_POINTER _WSAIORW(IOC_WS2,6)
|
||||
#define SIO_GET_QOS _WSAIORW(IOC_WS2,7)
|
||||
#define SIO_GET_GROUP_QOS _WSAIORW(IOC_WS2,8)
|
||||
#define SIO_MULTIPOINT_LOOPBACK _WSAIOW(IOC_WS2,9)
|
||||
#define SIO_MULTICAST_SCOPE _WSAIOW(IOC_WS2,10)
|
||||
#define SIO_SET_QOS _WSAIOW(IOC_WS2,11)
|
||||
#define SIO_SET_GROUP_QOS _WSAIOW(IOC_WS2,12)
|
||||
#define SIO_TRANSLATE_HANDLE _WSAIORW(IOC_WS2,13)
|
||||
#define SIO_ROUTING_INTERFACE_QUERY _WSAIORW(IOC_WS2,20)
|
||||
#define SIO_ROUTING_INTERFACE_CHANGE _WSAIOW(IOC_WS2,21)
|
||||
#define SIO_ADDRESS_LIST_QUERY _WSAIOR(IOC_WS2,22)
|
||||
#define SIO_ADDRESS_LIST_CHANGE _WSAIO(IOC_WS2,23)
|
||||
#define SIO_QUERY_TARGET_PNP_HANDLE _WSAIOR(IOC_W32,24)
|
||||
#define SIO_GET_INTERFACE_LIST WS_IOR ('t', 127, u_long)
|
||||
|
||||
/* Unfortunately the sockaddr_in6 structure doesn't
|
||||
seem to be defined in a standard place, even across
|
||||
different Linux distributions. Until IPv6 support settles
|
||||
down, let's do our own here so the sockaddr_gen
|
||||
union is the correct size.*/
|
||||
#ifdef s6_addr
|
||||
#undef s6_addr
|
||||
#endif
|
||||
struct ws_in_addr6
|
||||
{
|
||||
unsigned char s6_addr[16]; /* IPv6 address */
|
||||
};
|
||||
struct ws_sockaddr_in6
|
||||
{
|
||||
short sin6_family; /* AF_INET6 */
|
||||
u_short sin6_port; /* Transport level port number */
|
||||
u_long sin6_flowinfo; /* IPv6 flow information */
|
||||
struct ws_in_addr6 sin6_addr; /* IPv6 address */
|
||||
};
|
||||
|
||||
typedef union sockaddr_gen
|
||||
{
|
||||
struct sockaddr Address;
|
||||
struct ws_sockaddr_in AddressIn;
|
||||
struct ws_sockaddr_in6 AddressIn6;
|
||||
} sockaddr_gen;
|
||||
|
||||
/* Structure to keep interface specific information */
|
||||
typedef struct _INTERFACE_INFO
|
||||
{
|
||||
u_long iiFlags; /* Interface flags */
|
||||
sockaddr_gen iiAddress; /* Interface address */
|
||||
sockaddr_gen iiBroadcastAddress; /* Broadcast address */
|
||||
sockaddr_gen iiNetmask; /* Network mask */
|
||||
} INTERFACE_INFO, * LPINTERFACE_INFO;
|
||||
|
||||
/* Possible flags for the iiFlags - bitmask */
|
||||
#ifndef HAVE_NET_IF_H
|
||||
# define IFF_UP 0x00000001 /* Interface is up */
|
||||
# define IFF_BROADCAST 0x00000002 /* Broadcast is supported */
|
||||
# define IFF_LOOPBACK 0x00000004 /* this is loopback interface */
|
||||
# define IFF_POINTTOPOINT 0x00000008 /* this is point-to-point interface */
|
||||
# define IFF_MULTICAST 0x00000010 /* multicast is supported */
|
||||
#endif
|
||||
|
||||
#define MAX_PROTOCOL_CHAIN 7
|
||||
#define BASE_PROTOCOL 1
|
||||
#define LAYERED_PROTOCOL 0
|
||||
|
||||
typedef struct _WSAPROTOCOLCHAIN
|
||||
{
|
||||
int ChainLen; /* the length of the chain, */
|
||||
/* length = 0 means layered protocol, */
|
||||
/* length = 1 means base protocol, */
|
||||
/* length > 1 means protocol chain */
|
||||
DWORD ChainEntries[MAX_PROTOCOL_CHAIN]; /* a list of dwCatalogEntryIds */
|
||||
} WSAPROTOCOLCHAIN, * LPWSAPROTOCOLCHAIN;
|
||||
#define WSAPROTOCOL_LEN 255
|
||||
|
||||
typedef struct _WSAPROTOCOL_INFOA
|
||||
{
|
||||
DWORD dwServiceFlags1;
|
||||
DWORD dwServiceFlags2;
|
||||
DWORD dwServiceFlags3;
|
||||
DWORD dwServiceFlags4;
|
||||
DWORD dwProviderFlags;
|
||||
GUID ProviderId;
|
||||
DWORD dwCatalogEntryId;
|
||||
WSAPROTOCOLCHAIN ProtocolChain;
|
||||
int iVersion;
|
||||
int iAddressFamily;
|
||||
int iMaxSockAddr;
|
||||
int iMinSockAddr;
|
||||
int iSocketType;
|
||||
int iProtocol;
|
||||
int iProtocolMaxOffset;
|
||||
int iNetworkByteOrder;
|
||||
int iSecurityScheme;
|
||||
DWORD dwMessageSize;
|
||||
DWORD dwProviderReserved;
|
||||
CHAR szProtocol[WSAPROTOCOL_LEN+1];
|
||||
} WSAPROTOCOL_INFOA, * LPWSAPROTOCOL_INFOA;
|
||||
|
||||
typedef struct _WSANETWORKEVENTS
|
||||
{
|
||||
long lNetworkEvents;
|
||||
int iErrorCode[FD_MAX_EVENTS];
|
||||
} WSANETWORKEVENTS, *LPWSANETWORKEVENTS;
|
||||
|
||||
typedef struct _OVERLAPPED * LPWSAOVERLAPPED;
|
||||
typedef HANDLE WSAEVENT;
|
||||
typedef unsigned int GROUP;
|
||||
|
||||
#define WSACreateEvent() CreateEvent(NULL, TRUE, FALSE, NULL)
|
||||
/* etc */
|
||||
typedef void
|
||||
(CALLBACK * LPWSAOVERLAPPED_COMPLETION_ROUTINE)
|
||||
(
|
||||
DWORD dwError,
|
||||
DWORD cbTransferred,
|
||||
LPWSAOVERLAPPED lpOverlapped,
|
||||
DWORD dwFlags
|
||||
);
|
||||
|
||||
|
||||
/* Function declarations */
|
||||
int WINAPI WSAEnumNetworkEvents(SOCKET s, WSAEVENT hEventObject, LPWSANETWORKEVENTS lpNetworkEvents);
|
||||
int WINAPI WSAEventSelect(SOCKET s, WSAEVENT hEventObject, long lNetworkEvents);
|
||||
WSAEVENT WINAPI WSACreateEvent(void);
|
||||
BOOL WINAPI WSACloseEvent(WSAEVENT event);
|
||||
SOCKET WINAPI WSASocketA(int af, int type, int protocol,
|
||||
LPWSAPROTOCOL_INFOA lpProtocolInfo,
|
||||
GROUP g, DWORD dwFlags);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue