Implement support for FIONREAD in WSPIoctl. (hope I did it properly)

It works correctly with the wininet I'll commit later and a test app I wrote myself.

svn path=/trunk/; revision=33787
This commit is contained in:
Colin Finck
2008-05-31 12:53:55 +00:00
parent 923017639c
commit c446f5ff58
3 changed files with 12 additions and 0 deletions

View File

@@ -1517,6 +1517,9 @@ WSPIoctl(
Handle, Socket->SharedData.NonBlocking));
return 0;
case FIONREAD:
return GetSocketInformation(Socket, AFD_INFO_RECEIVE_CONTENT_SIZE, (PULONG)lpvOutBuffer, NULL);
default:
*lpErrno = WSAEINVAL;
return SOCKET_ERROR;

View File

@@ -48,6 +48,14 @@ AfdGetInfo( PDEVICE_OBJECT DeviceObject, PIRP Irp,
InfoReq->Information.Ulong = 0;
break;
case AFD_INFO_RECEIVE_CONTENT_SIZE:
/* Only touch InfoReq if we actually have a valid connection.
Behaviour was verified under WinXP SP2. */
if(FCB->Connection.Handle)
InfoReq->Information.Ulong = FCB->Recv.Content - FCB->Recv.BytesUsed;
break;
default:
AFD_DbgPrint(MID_TRACE,("Unknown info id %x\n",
InfoReq->InformationClass));

View File

@@ -149,6 +149,7 @@ typedef struct _AFD_DISCONNECT_INFO {
#define AFD_INFO_RECEIVE_WINDOW_SIZE 0x06L
#define AFD_INFO_SEND_WINDOW_SIZE 0x07L
#define AFD_INFO_GROUP_ID_TYPE 0x10L
#define AFD_INFO_RECEIVE_CONTENT_SIZE 0x11L
/* AFD Share Flags */
#define AFD_SHARE_UNIQUE 0x0L