lock: Fixes suggested by w3seek:

protect the remaining MmProbeAndLockPages
don't return from the exception handler

read: Hopefully the last indecision in here:

Avoid using AFD_EVENT_CLOSE until the socket is really toast.
Use AFD_EVENT_DISCONNECT instead when we've got an EOF, but still have
buffered data.
I was doing this socket fiddling without a callout block.  Fixed.

svn path=/trunk/; revision=14584
This commit is contained in:
Art Yerkes 2005-04-11 06:03:20 +00:00
parent 7bbf6258d7
commit 9166ff8f34
2 changed files with 13 additions and 14 deletions

View file

@ -59,15 +59,6 @@ PAFD_WSABUF LockBuffers( PAFD_WSABUF Buf, UINT Count,
_SEH_TRY { _SEH_TRY {
RtlCopyMemory( NewBuf, Buf, sizeof(AFD_WSABUF) * Count ); RtlCopyMemory( NewBuf, Buf, sizeof(AFD_WSABUF) * Count );
NewBufferLen = *AddressLen;
} _SEH_HANDLE {
AFD_DbgPrint(MIN_TRACE,("Access violation copying buffer info "
"from userland (%x %x)\n",
Buf, AddressLen));
ExFreePool( NewBuf );
return NULL;
} _SEH_END;
if( LockAddress ) { if( LockAddress ) {
NewBuf[Count].buf = AddressBuf; NewBuf[Count].buf = AddressBuf;
NewBuf[Count].len = NewBufferLen; NewBuf[Count].len = NewBufferLen;
@ -76,6 +67,13 @@ PAFD_WSABUF LockBuffers( PAFD_WSABUF Buf, UINT Count,
NewBuf[Count].len = sizeof(*AddressLen); NewBuf[Count].len = sizeof(*AddressLen);
Count++; Count++;
} }
} _SEH_HANDLE {
AFD_DbgPrint(MIN_TRACE,("Access violation copying buffer info "
"from userland (%x %x)\n",
Buf, AddressLen));
ExFreePool( NewBuf );
return NULL;
} _SEH_END;
for( i = 0; i < Count; i++ ) { for( i = 0; i < Count; i++ ) {
AFD_DbgPrint(MID_TRACE,("Locking buffer %d (%x:%d)\n", AFD_DbgPrint(MID_TRACE,("Locking buffer %d (%x:%d)\n",

View file

@ -36,7 +36,7 @@ BOOLEAN CantReadMore( PAFD_FCB FCB ) {
VOID HandleEOFOnIrp( PAFD_FCB FCB, NTSTATUS Status, UINT Information ) { VOID HandleEOFOnIrp( PAFD_FCB FCB, NTSTATUS Status, UINT Information ) {
if( Status == STATUS_SUCCESS && Information == 0 ) { if( Status == STATUS_SUCCESS && Information == 0 ) {
AFD_DbgPrint(MID_TRACE,("Looks like an EOF\n")); AFD_DbgPrint(MID_TRACE,("Looks like an EOF\n"));
FCB->PollState |= AFD_EVENT_CLOSE /*| AFD_EVENT_DISCONNECT */; FCB->PollState |= AFD_EVENT_DISCONNECT;
PollReeval( FCB->DeviceExt, FCB->FileObject ); PollReeval( FCB->DeviceExt, FCB->FileObject );
} }
} }
@ -109,10 +109,11 @@ NTSTATUS TryToSatisfyRecvRequestFromBuffer( PAFD_FCB FCB,
ReceiveComplete, ReceiveComplete,
FCB ); FCB );
SocketCalloutLeave( FCB );
if( Status == STATUS_SUCCESS ) if( Status == STATUS_SUCCESS )
FCB->Recv.Content = FCB->ReceiveIrp.Iosb.Information; FCB->Recv.Content = FCB->ReceiveIrp.Iosb.Information;
HandleEOFOnIrp( FCB, Status, FCB->Recv.Content ); HandleEOFOnIrp( FCB, Status, FCB->ReceiveIrp.Iosb.Information );
SocketCalloutLeave( FCB );
} }
} }