Author: cgutman
Date: Thu Aug 12 04:42:54 2010
New Revision: 48521
URL:
http://svn.reactos.org/svn/reactos?rev=48521&view=rev
Log:
[MSWSOCK]
- Add another parameter check inside the FIONBIO code
- Implement FIONREAD
- Pass any unhandled I/O control codes to our helper DLL
- This commit should be backported to msafd
Modified:
branches/aicom-network-branch/dll/win32/mswsock/msafd/sockopt.c
Modified: branches/aicom-network-branch/dll/win32/mswsock/msafd/sockopt.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-branch/dll/win32/…
==============================================================================
--- branches/aicom-network-branch/dll/win32/mswsock/msafd/sockopt.c [iso-8859-1]
(original)
+++ branches/aicom-network-branch/dll/win32/mswsock/msafd/sockopt.c [iso-8859-1] Thu Aug
12 04:42:54 2010
@@ -213,7 +213,7 @@
PSOCKET_INFORMATION Socket;
INT ErrorCode;
PWINSOCK_TEB_DATA ThreadData;
- BOOLEAN Blocking;
+ BOOLEAN Blocking, NeedsCompletion;
/* Enter prolog */
ErrorCode = SockEnterApiFast(&ThreadData);
@@ -240,7 +240,7 @@
case FIONBIO:
/* Check if the Buffer is OK */
- if(cbInBuffer < sizeof(ULONG))
+ if(cbInBuffer < sizeof(ULONG) || IS_INTRESOURCE(lpvInBuffer))
{
/* Fail */
ErrorCode = WSAEFAULT;
@@ -258,10 +258,43 @@
NULL);
break;
+ case FIONREAD:
+ if(cbOutBuffer < sizeof(ULONG) || IS_INTRESOURCE(lpvOutBuffer))
+ {
+ *lpErrno = WSAEFAULT;
+ return SOCKET_ERROR;
+ }
+
+ ErrorCode = SockGetInformation(Socket,
+ AFD_INFO_RECEIVE_CONTENT_SIZE,
+ NULL,
+ 0,
+ NULL,
+ (PULONG)lpvOutBuffer,
+ NULL);
+
+ if (ErrorCode == NO_ERROR) *lpcbBytesReturned = sizeof(ULONG);
+ break;
+
default:
-
- /* Unsupported for now */
- ErrorCode = WSAEINVAL;
+ /* Unsupported by us, give it to the helper */
+ ErrorCode = SockGetTdiHandles(Socket);
+ if (ErrorCode != NO_ERROR) goto error;
+
+ /* Call the helper */
+ ErrorCode = Socket->HelperData->WSHIoctl(Socket->HelperContext,
+ Handle,
+ Socket->TdiAddressHandle,
+ Socket->TdiConnectionHandle,
+ dwIoControlCode,
+ lpvInBuffer,
+ cbInBuffer,
+ lpvOutBuffer,
+ cbOutBuffer,
+ lpcbBytesReturned,
+ lpOverlapped,
+ lpCompletionRoutine,
+ (LPBOOL)&NeedsCompletion);
break;
}