Implement support for MSG_PEEK.

Patch by Art Yerkes with small fix by me to make it working correctly. (verified with a test app)

svn path=/trunk/; revision=33786
This commit is contained in:
Colin Finck 2008-05-31 12:51:22 +00:00
parent cb57056f4b
commit 923017639c

View file

@ -85,11 +85,14 @@ static NTSTATUS TryToSatisfyRecvRequestFromBuffer( PAFD_FCB FCB,
MmUnmapLockedPages( Map[i].BufferAddress, Map[i].Mdl ); MmUnmapLockedPages( Map[i].BufferAddress, Map[i].Mdl );
FCB->Recv.BytesUsed += BytesToCopy;
*TotalBytesCopied += BytesToCopy; *TotalBytesCopied += BytesToCopy;
if (!(RecvReq->TdiFlags & TDI_RECEIVE_PEEK)) {
FCB->Recv.BytesUsed += BytesToCopy;
BytesAvailable -= BytesToCopy; BytesAvailable -= BytesToCopy;
} }
} }
}
/* If there's nothing left in our buffer start a new request */ /* If there's nothing left in our buffer start a new request */
if( FCB->Recv.BytesUsed == FCB->Recv.Content ) { if( FCB->Recv.BytesUsed == FCB->Recv.Content ) {
@ -405,8 +408,11 @@ SatisfyPacketRecvRequest( PAFD_FCB FCB, PIRP Irp,
MmUnmapLockedPages( Map[0].BufferAddress, Map[0].Mdl ); MmUnmapLockedPages( Map[0].BufferAddress, Map[0].Mdl );
FCB->Recv.BytesUsed = 0;
*TotalBytesCopied = BytesToCopy; *TotalBytesCopied = BytesToCopy;
if (!RecvReq->TdiFlags & TDI_RECEIVE_PEEK) {
FCB->Recv.BytesUsed = 0;
}
} }
Status = Irp->IoStatus.Status = STATUS_SUCCESS; Status = Irp->IoStatus.Status = STATUS_SUCCESS;