Author: cgutman
Date: Thu Aug 12 13:13:19 2010
New Revision: 48522
URL:
http://svn.reactos.org/svn/reactos?rev=48522&view=rev
Log:
[MSAFD]
- Update lpcbBytesReturned when FIONREAD is called
- Fix the value inside lpErrno when XxxSocketInformation() fails
- Pass the unrecognized IOCTLs to the winsock helper (no behavior change for this yet
because wshtcpip's WSHIoctl is unimplemented)
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] Thu Aug 12 13:13:19 2010
@@ -1910,6 +1910,7 @@
OUT LPINT lpErrno)
{
PSOCKET_INFORMATION Socket = NULL;
+ BOOLEAN NeedsCompletion;
/* Get the Socket Structure associate to this Socket*/
Socket = GetSocketStructure(Handle);
@@ -1918,6 +1919,8 @@
*lpErrno = WSAENOTSOCK;
return SOCKET_ERROR;
}
+
+ *lpcbBytesReturned = 0;
switch( dwIoControlCode )
{
@@ -1928,17 +1931,44 @@
return SOCKET_ERROR;
}
Socket->SharedData.NonBlocking = *((PULONG)lpvInBuffer) ? 1 : 0;
- return SetSocketInformation(Socket, AFD_INFO_BLOCKING_MODE,
(PULONG)lpvInBuffer, NULL);
+ *lpErrno = SetSocketInformation(Socket, AFD_INFO_BLOCKING_MODE,
(PULONG)lpvInBuffer, NULL);
+ if (*lpErrno != NO_ERROR)
+ return SOCKET_ERROR;
+ else
+ return NO_ERROR;
case FIONREAD:
if( cbOutBuffer < sizeof(INT) || IS_INTRESOURCE(lpvOutBuffer) )
{
*lpErrno = WSAEFAULT;
return SOCKET_ERROR;
}
- return GetSocketInformation(Socket, AFD_INFO_RECEIVE_CONTENT_SIZE,
(PULONG)lpvOutBuffer, NULL);
+ *lpErrno = GetSocketInformation(Socket, AFD_INFO_RECEIVE_CONTENT_SIZE,
(PULONG)lpvOutBuffer, NULL);
+ if (*lpErrno != NO_ERROR)
+ {
+ *lpcbBytesReturned = sizeof(ULONG);
+ return SOCKET_ERROR;
+ }
+ else
+ return NO_ERROR;
default:
- *lpErrno = WSAEINVAL;
- return SOCKET_ERROR;
+ *lpErrno = Socket->HelperData->WSHIoctl(Socket->HelperContext,
+ Handle,
+ Socket->TdiAddressHandle,
+ Socket->TdiConnectionHandle,
+ dwIoControlCode,
+ lpvInBuffer,
+ cbInBuffer,
+ lpvOutBuffer,
+ cbOutBuffer,
+ lpcbBytesReturned,
+ lpOverlapped,
+ lpCompletionRoutine,
+ (LPBOOL)&NeedsCompletion);
+
+ if (*lpErrno != NO_ERROR)
+ return SOCKET_ERROR;
+ else
+ return NO_ERROR;
}
}