https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2b1f6c8b0d73b80c9aeaf…
commit 2b1f6c8b0d73b80c9aeaf8808c66c0c52eb1f320
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Sat Feb 16 13:46:40 2019 +0100
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Sat Feb 16 13:51:32 2019 +0100
[MSAFD] Add an initial implementation of SIO_GET_EXTENSION_FUNCTION_POINTER IOCTL
Also stub the related functions the IOCTL will return, namely: WSAID_ACCEPTEX,
WSAID_CONNECTEX, WSAID_DISCONNECTEX, WSAID_GETACCEPTEXSOCKADDRS
This will allow Steam client not to fail in an ASSERT
related to the Steam client PlatformSocketsInit function.
Even though, this doesn't fix Steam running on ReactOS since its UI requires
a Windows 7 API from Kernel32: SetThreadErrorMode().
Nota: its crash got fixed thanks to the Wine sync done recently.
CORE-14966
---
dll/win32/msafd/misc/dllmain.c | 57 ++++++++++++++++++++++++++++++++++++++-
dll/win32/msafd/misc/stubs.c | 61 ++++++++++++++++++++++++++++++++++++++++++
dll/win32/msafd/msafd.h | 42 +++++++++++++++++++++++++++++
3 files changed, 159 insertions(+), 1 deletion(-)
diff --git a/dll/win32/msafd/misc/dllmain.c b/dll/win32/msafd/misc/dllmain.c
index 5ec1bc151a..e604d2f15a 100644
--- a/dll/win32/msafd/misc/dllmain.c
+++ b/dll/win32/msafd/misc/dllmain.c
@@ -5,6 +5,7 @@
* PURPOSE: DLL entry point
* PROGRAMMERS: Casper S. Hornstrup (chorns(a)users.sourceforge.net)
* Alex Ionescu (alex(a)relsoft.net)
+ * Pierre Schweitzer (pierre(a)reactos.org)
* REVISIONS:
* CSH 01/09-2000 Created
* Alex 16/07/2004 - Complete Rewrite
@@ -2466,7 +2467,61 @@ WSPIoctl(IN SOCKET Handle,
Ret = NO_ERROR;
break;
case SIO_GET_EXTENSION_FUNCTION_POINTER:
- Errno = WSAEINVAL;
+ if (cbOutBuffer == 0)
+ {
+ cbRet = sizeof(PVOID);
+ Errno = WSAEFAULT;
+ break;
+ }
+
+ if (cbInBuffer < sizeof(GUID) ||
+ cbOutBuffer < sizeof(PVOID))
+ {
+ Errno = WSAEINVAL;
+ break;
+ }
+
+ {
+ GUID AcceptExGUID = WSAID_ACCEPTEX;
+ GUID ConnectExGUID = WSAID_CONNECTEX;
+ GUID DisconnectExGUID = WSAID_DISCONNECTEX;
+ GUID GetAcceptExSockaddrsGUID = WSAID_GETACCEPTEXSOCKADDRS;
+
+ if (IsEqualGUID(&AcceptExGUID, lpvInBuffer))
+ {
+ *((PVOID *)lpvOutBuffer) = WSPAcceptEx;
+ cbRet = sizeof(PVOID);
+ Errno = NO_ERROR;
+ Ret = NO_ERROR;
+ }
+ else if (IsEqualGUID(&ConnectExGUID, lpvInBuffer))
+ {
+ *((PVOID *)lpvOutBuffer) = WSPConnectEx;
+ cbRet = sizeof(PVOID);
+ Errno = NO_ERROR;
+ Ret = NO_ERROR;
+ }
+ else if (IsEqualGUID(&DisconnectExGUID, lpvInBuffer))
+ {
+ *((PVOID *)lpvOutBuffer) = WSPDisconnectEx;
+ cbRet = sizeof(PVOID);
+ Errno = NO_ERROR;
+ Ret = NO_ERROR;
+ }
+ else if (IsEqualGUID(&GetAcceptExSockaddrsGUID, lpvInBuffer))
+ {
+ *((PVOID *)lpvOutBuffer) = WSPGetAcceptExSockaddrs;
+ cbRet = sizeof(PVOID);
+ Errno = NO_ERROR;
+ Ret = NO_ERROR;
+ }
+ else
+ {
+ ERR("Querying unknown extension function: %x\n",
((GUID*)lpvInBuffer)->Data1);
+ Errno = WSAEOPNOTSUPP;
+ }
+ }
+
break;
case SIO_ADDRESS_LIST_QUERY:
if (IS_INTRESOURCE(lpvOutBuffer) || cbOutBuffer == 0)
diff --git a/dll/win32/msafd/misc/stubs.c b/dll/win32/msafd/misc/stubs.c
index 2ee41289cd..74d13c188b 100644
--- a/dll/win32/msafd/misc/stubs.c
+++ b/dll/win32/msafd/misc/stubs.c
@@ -53,4 +53,65 @@ WSPJoinLeaf(
return (SOCKET)0;
}
+BOOL
+WSPAPI
+WSPAcceptEx(
+ IN SOCKET sListenSocket,
+ IN SOCKET sAcceptSocket,
+ OUT PVOID lpOutputBuffer,
+ IN DWORD dwReceiveDataLength,
+ IN DWORD dwLocalAddressLength,
+ IN DWORD dwRemoteAddressLength,
+ OUT LPDWORD lpdwBytesReceived,
+ IN OUT LPOVERLAPPED lpOverlapped)
+{
+ UNIMPLEMENTED;
+
+ return FALSE;
+}
+
+BOOL
+WSPAPI
+WSPConnectEx(
+ IN SOCKET s,
+ IN const struct sockaddr *name,
+ IN int namelen,
+ IN PVOID lpSendBuffer,
+ IN DWORD dwSendDataLength,
+ OUT LPDWORD lpdwBytesSent,
+ IN OUT LPOVERLAPPED lpOverlapped)
+{
+ UNIMPLEMENTED;
+
+ return FALSE;
+}
+
+BOOL
+WSPAPI
+WSPDisconnectEx(
+ IN SOCKET hSocket,
+ IN LPOVERLAPPED lpOverlapped,
+ IN DWORD dwFlags,
+ IN DWORD reserved)
+{
+ UNIMPLEMENTED;
+
+ return FALSE;
+}
+
+VOID
+WSPAPI
+WSPGetAcceptExSockaddrs(
+ IN PVOID lpOutputBuffer,
+ IN DWORD dwReceiveDataLength,
+ IN DWORD dwLocalAddressLength,
+ IN DWORD dwRemoteAddressLength,
+ OUT struct sockaddr **LocalSockaddr,
+ OUT LPINT LocalSockaddrLength,
+ OUT struct sockaddr **RemoteSockaddr,
+ OUT LPINT RemoteSockaddrLength)
+{
+ UNIMPLEMENTED;
+}
+
/* EOF */
diff --git a/dll/win32/msafd/msafd.h b/dll/win32/msafd/msafd.h
index 07ed1657fc..87b0125cc4 100644
--- a/dll/win32/msafd/msafd.h
+++ b/dll/win32/msafd/msafd.h
@@ -426,6 +426,48 @@ WSPStringToAddress(
IN OUT LPINT lpAddressLength,
OUT LPINT lpErrno);
+BOOL
+WSPAPI
+WSPAcceptEx(
+ IN SOCKET sListenSocket,
+ IN SOCKET sAcceptSocket,
+ OUT PVOID lpOutputBuffer,
+ IN DWORD dwReceiveDataLength,
+ IN DWORD dwLocalAddressLength,
+ IN DWORD dwRemoteAddressLength,
+ OUT LPDWORD lpdwBytesReceived,
+ IN OUT LPOVERLAPPED lpOverlapped);
+
+BOOL
+WSPAPI
+WSPConnectEx(
+ IN SOCKET s,
+ IN const struct sockaddr *name,
+ IN int namelen,
+ IN PVOID lpSendBuffer,
+ IN DWORD dwSendDataLength,
+ OUT LPDWORD lpdwBytesSent,
+ IN OUT LPOVERLAPPED lpOverlapped);
+
+BOOL
+WSPAPI
+WSPDisconnectEx(
+ IN SOCKET hSocket,
+ IN LPOVERLAPPED lpOverlapped,
+ IN DWORD dwFlags,
+ IN DWORD reserved);
+
+VOID
+WSPAPI
+WSPGetAcceptExSockaddrs(
+ IN PVOID lpOutputBuffer,
+ IN DWORD dwReceiveDataLength,
+ IN DWORD dwLocalAddressLength,
+ IN DWORD dwRemoteAddressLength,
+ OUT struct sockaddr **LocalSockaddr,
+ OUT LPINT LocalSockaddrLength,
+ OUT struct sockaddr **RemoteSockaddr,
+ OUT LPINT RemoteSockaddrLength);
PSOCKET_INFORMATION GetSocketStructure(
SOCKET Handle