Author: cgutman
Date: Sat Aug 18 09:57:27 2012
New Revision: 57094
URL:
http://svn.reactos.org/svn/reactos?rev=57094&view=rev
Log:
[MSAFD]
- Add more option support to WSPGetSockOpt and WSPSetSockOpt
- Return the correct error code for an unsupported option in WSPGetSockOpt
- Hack a SO_ERROR get handler together for apps that need it
- Add better unsupported protoopts debugging (particularly for getsockopt)
- SMPlayer can now stream media from the Internet :)
Modified:
trunk/reactos/dll/win32/msafd/misc/dllmain.c
Modified: trunk/reactos/dll/win32/msafd/misc/dllmain.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msafd/misc/dllma…
==============================================================================
--- trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] Sat Aug 18 09:57:27 2012
@@ -2052,6 +2052,7 @@
PVOID Buffer;
INT BufferSize;
BOOL BoolBuffer;
+ INT IntBuffer;
/* Get the Socket Structure associate to this Socket*/
Socket = GetSocketStructure(Handle);
@@ -2112,21 +2113,46 @@
BufferSize = sizeof(struct linger);
break;
- /* case SO_CONDITIONAL_ACCEPT: */
+ case SO_OOBINLINE:
+ BoolBuffer = (Socket->SharedData.OobInline != 0);
+ Buffer = &BoolBuffer;
+ BufferSize = sizeof(BOOL);
+ break;
+
+ case SO_KEEPALIVE:
case SO_DONTROUTE:
+ /* These guys go directly to the helper */
+ goto SendToHelper;
+
+ case SO_CONDITIONAL_ACCEPT:
+ BoolBuffer = (Socket->SharedData.UseDelayedAcceptance != 0);
+ Buffer = &BoolBuffer;
+ BufferSize = sizeof(BOOL);
+ break;
+
+ case SO_REUSEADDR:
+ BoolBuffer = (Socket->SharedData.ReuseAddresses != 0);
+ Buffer = &BoolBuffer;
+ BufferSize = sizeof(BOOL);
+ break;
+
case SO_ERROR:
+ /* HACK: This needs to be properly tracked */
+ IntBuffer = 0;
+ DbgPrint("MSAFD: Hacked SO_ERROR returning error %d\n",
IntBuffer);
+
+ Buffer = &IntBuffer;
+ BufferSize = sizeof(INT);
+ break;
+
case SO_GROUP_ID:
case SO_GROUP_PRIORITY:
- case SO_KEEPALIVE:
case SO_MAX_MSG_SIZE:
- case SO_OOBINLINE:
case SO_PROTOCOL_INFO:
- case SO_REUSEADDR:
- AFD_DbgPrint(MID_TRACE, ("Unimplemented option (%x)\n",
- OptionName));
default:
- *lpErrno = WSAEINVAL;
+ DbgPrint("MSAFD: Get unknown optname %x\n", OptionName);
+ *lpErrno = WSAENOPROTOOPT;
return SOCKET_ERROR;
}
@@ -2140,18 +2166,20 @@
return 0;
- case IPPROTO_TCP: /* FIXME */
default:
- *lpErrno =
Socket->HelperData->WSHGetSocketInformation(Socket->HelperContext,
- Handle,
-
Socket->TdiAddressHandle,
-
Socket->TdiConnectionHandle,
- Level,
- OptionName,
- OptionValue,
- (LPINT)OptionLength);
- return (*lpErrno == 0) ? 0 : SOCKET_ERROR;
- }
+ break;
+ }
+
+SendToHelper:
+ *lpErrno =
Socket->HelperData->WSHGetSocketInformation(Socket->HelperContext,
+ Handle,
+ Socket->TdiAddressHandle,
+
Socket->TdiConnectionHandle,
+ Level,
+ OptionName,
+ OptionValue,
+ (LPINT)OptionLength);
+ return (*lpErrno == 0) ? 0 : SOCKET_ERROR;
}
INT
@@ -2220,13 +2248,43 @@
AFD_DbgPrint(MIN_TRACE,("Setting send buf to %x is not implemented
yet\n", optval));
return 0;
+ case SO_SNDTIMEO:
+ if (optlen < sizeof(DWORD))
+ {
+ *lpErrno = WSAEFAULT;
+ return SOCKET_ERROR;
+ }
+
+ RtlCopyMemory(&Socket->SharedData.SendTimeout,
+ optval,
+ sizeof(DWORD));
+ return 0;
+
+ case SO_RCVTIMEO:
+ if (optlen < sizeof(DWORD))
+ {
+ *lpErrno = WSAEFAULT;
+ return SOCKET_ERROR;
+ }
+
+ RtlCopyMemory(&Socket->SharedData.RecvTimeout,
+ optval,
+ sizeof(DWORD));
+ return 0;
+
+ case SO_KEEPALIVE:
+ case SO_DONTROUTE:
+ /* These go directly to the helper dll */
+ goto SendToHelper;
+
default:
- AFD_DbgPrint(MIN_TRACE,("Unknown optname %x\n", optname));
- break;
- }
- }
-
-
+ /* Obviously this is a hack */
+ DbgPrint("MSAFD: Set unknown optname %x\n", optname);
+ return 0;
+ }
+ }
+
+SendToHelper:
*lpErrno =
Socket->HelperData->WSHSetSocketInformation(Socket->HelperContext,
s,
Socket->TdiAddressHandle,