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. Modified: trunk/reactos/drivers/net/afd/afd/lock.c Modified: trunk/reactos/drivers/net/afd/afd/read.c _____
Modified: trunk/reactos/drivers/net/afd/afd/lock.c --- trunk/reactos/drivers/net/afd/afd/lock.c 2005-04-10 21:01:13 UTC (rev 14583) +++ trunk/reactos/drivers/net/afd/afd/lock.c 2005-04-11 06:03:20 UTC (rev 14584) @@ -59,7 +59,14 @@
_SEH_TRY { RtlCopyMemory( NewBuf, Buf, sizeof(AFD_WSABUF) * Count ); - NewBufferLen = *AddressLen; + if( LockAddress ) { + NewBuf[Count].buf = AddressBuf; + NewBuf[Count].len = NewBufferLen; + Count++; + NewBuf[Count].buf = (PVOID)AddressLen; + NewBuf[Count].len = sizeof(*AddressLen); + Count++; + } } _SEH_HANDLE { AFD_DbgPrint(MIN_TRACE,("Access violation copying buffer info " "from userland (%x %x)\n", @@ -68,15 +75,6 @@ return NULL; } _SEH_END;
- if( LockAddress ) { - NewBuf[Count].buf = AddressBuf; - NewBuf[Count].len = NewBufferLen; - Count++; - NewBuf[Count].buf = (PVOID)AddressLen; - NewBuf[Count].len = sizeof(*AddressLen); - Count++; - } - for( i = 0; i < Count; i++ ) { AFD_DbgPrint(MID_TRACE,("Locking buffer %d (%x:%d)\n", i, NewBuf[i].buf, NewBuf[i].len)); _____
Modified: trunk/reactos/drivers/net/afd/afd/read.c --- trunk/reactos/drivers/net/afd/afd/read.c 2005-04-10 21:01:13 UTC (rev 14583) +++ trunk/reactos/drivers/net/afd/afd/read.c 2005-04-11 06:03:20 UTC (rev 14584) @@ -36,7 +36,7 @@
VOID HandleEOFOnIrp( PAFD_FCB FCB, NTSTATUS Status, UINT Information ) { if( Status == STATUS_SUCCESS && Information == 0 ) { 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 ); } } @@ -109,10 +109,11 @@ ReceiveComplete, FCB );
- if( Status == STATUS_SUCCESS ) + SocketCalloutLeave( FCB ); + + if( Status == STATUS_SUCCESS ) FCB->Recv.Content = FCB->ReceiveIrp.Iosb.Information; - HandleEOFOnIrp( FCB, Status, FCB->Recv.Content ); - SocketCalloutLeave( FCB ); + HandleEOFOnIrp( FCB, Status, FCB->ReceiveIrp.Iosb.Information ); } }