[MSWSOCK] Unstub AcceptEx and GetAcceptExSockaddrs. Note that real implementation...
authorPeter Hater <7element@mail.bg>
Thu, 1 Jun 2017 15:25:25 +0000 (15:25 +0000)
committerPeter Hater <7element@mail.bg>
Thu, 1 Jun 2017 15:25:25 +0000 (15:25 +0000)
svn path=/trunk/; revision=74731

reactos/dll/win32/mswsock/extensions.c
reactos/dll/win32/mswsock/stubs.c

index f6b857b..2ec3301 100644 (file)
@@ -12,6 +12,9 @@
 #include <winsock2.h>
 #include <mswsock.h>
 
+LPFN_TRANSMITFILE pfnTransmitFile = NULL;
+LPFN_GETACCEPTEXSOCKADDRS pfnGetAcceptExSockaddrs = NULL;
+LPFN_ACCEPTEX pfnAcceptEx = NULL;
 /*
  * @implemented
  */
@@ -25,30 +28,111 @@ TransmitFile(SOCKET Socket,
              LPTRANSMIT_FILE_BUFFERS TransmitBuffers,
              DWORD Flags)
 {
-  static GUID TransmitFileGUID = WSAID_TRANSMITFILE;
-  LPFN_TRANSMITFILE pfnTransmitFile;
-  DWORD cbBytesReturned;
-
-  if (WSAIoctl(Socket,
-               SIO_GET_EXTENSION_FUNCTION_POINTER,
-               &TransmitFileGUID,
-               sizeof(TransmitFileGUID),
-               &pfnTransmitFile,
-               sizeof(pfnTransmitFile),
-               &cbBytesReturned,
-               NULL,
-               NULL) == SOCKET_ERROR)
-  {
-    return FALSE;
-  }
-
-  return pfnTransmitFile(Socket,
-                         File,
-                         NumberOfBytesToWrite,
-                         NumberOfBytesPerSend,
-                         Overlapped,
-                         TransmitBuffers,
-                         Flags);
+    GUID TransmitFileGUID = WSAID_TRANSMITFILE;
+    DWORD cbBytesReturned;
+
+    if (WSAIoctl(Socket,
+                 SIO_GET_EXTENSION_FUNCTION_POINTER,
+                 &TransmitFileGUID,
+                 sizeof(TransmitFileGUID),
+                 &pfnTransmitFile,
+                 sizeof(pfnTransmitFile),
+                 &cbBytesReturned,
+                 NULL,
+                 NULL) == SOCKET_ERROR)
+    {
+        return FALSE;
+    }
+
+    return pfnTransmitFile(Socket,
+                           File,
+                           NumberOfBytesToWrite,
+                           NumberOfBytesPerSend,
+                           Overlapped,
+                           TransmitBuffers,
+                           Flags);
+}
+
+/*
+* @implemented
+*/
+BOOL
+WINAPI
+AcceptEx(SOCKET ListenSocket,
+         SOCKET AcceptSocket,
+         PVOID OutputBuffer,
+         DWORD ReceiveDataLength,
+         DWORD LocalAddressLength,
+         DWORD RemoteAddressLength,
+         LPDWORD BytesReceived,
+         LPOVERLAPPED Overlapped)
+{
+    GUID AcceptExGUID = WSAID_ACCEPTEX;
+    GUID GetAcceptExSockaddrsGUID = WSAID_GETACCEPTEXSOCKADDRS;
+    DWORD cbBytesReturned;
+
+    if (WSAIoctl(ListenSocket,
+                 SIO_GET_EXTENSION_FUNCTION_POINTER,
+                 &AcceptExGUID,
+                 sizeof(AcceptExGUID),
+                 &pfnAcceptEx,
+                 sizeof(pfnAcceptEx),
+                 &cbBytesReturned,
+                 NULL,
+                 NULL) == SOCKET_ERROR)
+    {
+        return FALSE;
+    }
+
+    if (WSAIoctl(ListenSocket,
+                 SIO_GET_EXTENSION_FUNCTION_POINTER,
+                 &GetAcceptExSockaddrsGUID,
+                 sizeof(GetAcceptExSockaddrsGUID),
+                 &pfnGetAcceptExSockaddrs,
+                 sizeof(pfnGetAcceptExSockaddrs),
+                 &cbBytesReturned,
+                 NULL,
+                 NULL) == SOCKET_ERROR)
+    {
+        pfnAcceptEx = NULL;
+        return FALSE;
+    }
+
+    return pfnAcceptEx(ListenSocket,
+                       AcceptSocket,
+                       OutputBuffer,
+                       ReceiveDataLength,
+                       LocalAddressLength,
+                       RemoteAddressLength,
+                       BytesReceived,
+                       Overlapped);
 }
 
+
+/*
+* @implemented
+*/
+VOID
+WINAPI
+GetAcceptExSockaddrs(PVOID OutputBuffer,
+                     DWORD ReceiveDataLength,
+                     DWORD LocalAddressLength,
+                     DWORD RemoteAddressLength,
+                     LPSOCKADDR* LocalSockaddr,
+                     LPINT LocalSockaddrLength,
+                     LPSOCKADDR* RemoteSockaddr,
+                     LPINT RemoteSockaddrLength)
+{
+    if (pfnGetAcceptExSockaddrs)
+    {
+        pfnGetAcceptExSockaddrs(OutputBuffer,
+                                ReceiveDataLength,
+                                LocalAddressLength,
+                                RemoteAddressLength,
+                                LocalSockaddr,
+                                LocalSockaddrLength,
+                                RemoteSockaddr,
+                                RemoteSockaddrLength);
+    }
+}
 /* EOF */
index 45ac75e..a05284c 100644 (file)
@@ -21,25 +21,6 @@ typedef struct _NS_ROUTINE {
     DWORD        dwPriority;
 } NS_ROUTINE, *PNS_ROUTINE, * FAR LPNS_ROUTINE;
 
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-AcceptEx(SOCKET ListenSocket,
-         SOCKET AcceptSocket,
-         PVOID OutputBuffer,
-         DWORD ReceiveDataLength,
-         DWORD LocalAddressLength,
-         DWORD RemoteAddressLength,
-         LPDWORD BytesReceived,
-         LPOVERLAPPED Overlapped)
-{
-  OutputDebugStringW(L"w32sock AcceptEx stub called\n");
-
-  return FALSE;
-}
-
 
 /*
  * @unimplemented
@@ -71,24 +52,6 @@ EnumProtocolsW(LPINT ProtocolCount,
 }
 
 
-/*
- * @unimplemented
- */
-VOID
-WINAPI
-GetAcceptExSockaddrs(PVOID OutputBuffer,
-                     DWORD ReceiveDataLength,
-                     DWORD LocalAddressLength,
-                     DWORD RemoteAddressLength,
-                     LPSOCKADDR* LocalSockaddr,
-                     LPINT LocalSockaddrLength,
-                     LPSOCKADDR* RemoteSockaddr,
-                     LPINT RemoteSockaddrLength)
-{
-  OutputDebugStringW(L"w32sock GetAcceptExSockaddrs stub called\n");
-}
-
-
 /*
  * @unimplemented
  */