Author: arty
Date: Fri Aug 1 16:07:09 2008
New Revision: 35019
URL:
http://svn.reactos.org/svn/reactos?rev=35019&view=rev
Log:
Merge aicom-network-fixes up to
r35014 | cgutman | 2008-08-01 10:21:52 -0700 (Fri, 01 Aug 2008) | 2 lines
- These should no longer be needed now that TDI doesn't give back invalid IRPs
- I'll look into the canceling issue later
Modified:
trunk/reactos/dll/win32/msafd/misc/dllmain.c
trunk/reactos/drivers/network/afd/afd/bind.c
trunk/reactos/drivers/network/afd/afd/connect.c
trunk/reactos/drivers/network/afd/afd/context.c
trunk/reactos/drivers/network/afd/afd/info.c
trunk/reactos/drivers/network/afd/afd/listen.c
trunk/reactos/drivers/network/afd/afd/lock.c
trunk/reactos/drivers/network/afd/afd/main.c
trunk/reactos/drivers/network/afd/afd/read.c
trunk/reactos/drivers/network/afd/afd/select.c
trunk/reactos/drivers/network/afd/afd/write.c
trunk/reactos/drivers/network/afd/include/afd.h
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] Fri Aug 1 16:07:09 2008
@@ -279,17 +279,17 @@
if( Errno ) {
switch (Status) {
case STATUS_CANT_WAIT: *Errno = WSAEWOULDBLOCK; break;
- case STATUS_TIMEOUT:
+ case STATUS_TIMEOUT: *Errno = WSAETIMEDOUT; break;
case STATUS_SUCCESS:
/* Return Number of bytes Read */
if( ReturnedBytes ) *ReturnedBytes = Received; break;
- case STATUS_END_OF_FILE: *Errno = WSAESHUTDOWN; *ReturnedBytes = 0; break;
+ case STATUS_END_OF_FILE: *Errno = WSAESHUTDOWN; break;
case STATUS_PENDING: *Errno = WSA_IO_PENDING; break;
case STATUS_BUFFER_OVERFLOW: *Errno = WSAEMSGSIZE; break;
- default: {
+ case STATUS_INVALID_CONNECTION: *Errno = WSAEAFNOSUPPORT; break;
+ default:
DbgPrint("MSAFD: Error %x is unknown\n", Status);
*Errno = WSAEINVAL; break;
- } break;
}
}
Modified: trunk/reactos/drivers/network/afd/afd/bind.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/bi…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/bind.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/bind.c [iso-8859-1] Fri Aug 1 16:07:09 2008
@@ -48,10 +48,10 @@
AFD_DbgPrint(MID_TRACE,("Called\n"));
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
if( !(BindReq = LockRequest( Irp, IrpSp )) )
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY,
- Irp, 0, NULL, FALSE );
+ Irp, 0, NULL );
FCB->LocalAddress = TaCopyTransportAddress( &BindReq->Address );
@@ -61,7 +61,7 @@
if( NT_SUCCESS(Status) )
FCB->State = SOCKET_STATE_BOUND;
- else return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL, FALSE );
+ else return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
AFD_DbgPrint(MID_TRACE,("FCB->Flags %x\n", FCB->Flags));
@@ -87,6 +87,6 @@
if( Status == STATUS_PENDING ) Status = STATUS_SUCCESS;
}
- return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL, TRUE );
+ return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
}
Modified: trunk/reactos/drivers/network/afd/afd/connect.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/co…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/connect.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/connect.c [iso-8859-1] Fri Aug 1 16:07:09 2008
@@ -71,7 +71,7 @@
/* I was wrong about this before as we can have pending writes to a not
* yet connected socket */
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
AFD_DbgPrint(MID_TRACE,("Irp->IoStatus.Status = %x\n",
Irp->IoStatus.Status));
@@ -137,10 +137,10 @@
PAFD_CONNECT_INFO ConnectReq;
AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB));
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
if( !(ConnectReq = LockRequest( Irp, IrpSp )) )
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp,
- 0, NULL, FALSE );
+ 0, NULL );
AFD_DbgPrint(MID_TRACE,("Connect request:\n"));
#if 0
@@ -177,11 +177,10 @@
if( NT_SUCCESS(Status) )
FCB->State = SOCKET_STATE_BOUND;
else
- return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL,
- TRUE );
+ return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
} else
return UnlockAndMaybeComplete
- ( FCB, STATUS_NO_MEMORY, Irp, 0, NULL, TRUE );
+ ( FCB, STATUS_NO_MEMORY, Irp, 0, NULL );
} /* Drop through to SOCKET_STATE_BOUND */
case SOCKET_STATE_BOUND:
@@ -228,5 +227,5 @@
break;
}
- return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL, TRUE );
-}
+ return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
+}
Modified: trunk/reactos/drivers/network/afd/afd/context.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/co…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/context.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/context.c [iso-8859-1] Fri Aug 1 16:07:09 2008
@@ -20,7 +20,7 @@
PAFD_FCB FCB = FileObject->FsContext;
UINT ContextSize = IrpSp->Parameters.DeviceIoControl.OutputBufferLength;
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
if( FCB->ContextSize < ContextSize ) ContextSize = FCB->ContextSize;
@@ -33,7 +33,7 @@
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
- return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL, FALSE );
+ return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
}
NTSTATUS STDCALL
@@ -43,7 +43,7 @@
PFILE_OBJECT FileObject = IrpSp->FileObject;
PAFD_FCB FCB = FileObject->FsContext;
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
if( FCB->ContextSize <
IrpSp->Parameters.DeviceIoControl.InputBufferLength ) {
@@ -64,5 +64,5 @@
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
- return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL, FALSE );
+ return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
}
Modified: trunk/reactos/drivers/network/afd/afd/info.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/in…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/info.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/info.c [iso-8859-1] Fri Aug 1 16:07:09 2008
@@ -26,7 +26,7 @@
_SEH_TRY {
if( !SocketAcquireStateLock( FCB ) ) {
- Status = LostSocket( Irp, FALSE );
+ Status = LostSocket( Irp );
_SEH_YIELD(return Status);
}
@@ -69,7 +69,7 @@
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
- return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL, FALSE );
+ return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
}
NTSTATUS STDCALL
@@ -84,11 +84,11 @@
AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB));
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
if( FCB->AddressFile.Object == NULL) {
return UnlockAndMaybeComplete( FCB, STATUS_UNSUCCESSFUL, Irp, 0,
- NULL, FALSE );
+ NULL );
}
Mdl = IoAllocateMdl
@@ -159,5 +159,5 @@
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
- return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL, FALSE );
+ return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
}
Modified: trunk/reactos/drivers/network/afd/afd/listen.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/li…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/listen.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/listen.c [iso-8859-1] Fri Aug 1 16:07:09 2008
@@ -157,16 +157,16 @@
AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB));
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
if( !(ListenReq = LockRequest( Irp, IrpSp )) )
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp,
- 0, NULL, FALSE );
+ 0, NULL );
if( FCB->State != SOCKET_STATE_BOUND ) {
Status = STATUS_UNSUCCESSFUL;
AFD_DbgPrint(MID_TRACE,("Could not listen an unbound socket\n"));
- return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL, TRUE );
+ return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
}
FCB->DelayedAccept = ListenReq->UseDelayedAcceptance;
@@ -198,7 +198,7 @@
Status = STATUS_SUCCESS;
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
- return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL, TRUE );
+ return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
}
NTSTATUS AfdWaitForListen( PDEVICE_OBJECT DeviceObject, PIRP Irp,
@@ -209,7 +209,7 @@
AFD_DbgPrint(MID_TRACE,("Called\n"));
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
if( !IsListEmpty( &FCB->PendingConnections ) ) {
PLIST_ENTRY PendingConn = FCB->PendingConnections.Flink;
@@ -246,7 +246,7 @@
AFD_DbgPrint(MID_TRACE,("Called\n"));
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
FCB->EventsFired &= ~AFD_EVENT_ACCEPT;
Modified: trunk/reactos/drivers/network/afd/afd/lock.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/lo…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/lock.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/lock.c [iso-8859-1] Fri Aug 1 16:07:09 2008
@@ -235,8 +235,7 @@
NTSTATUS NTAPI UnlockAndMaybeComplete
( PAFD_FCB FCB, NTSTATUS Status, PIRP Irp,
UINT Information,
- PIO_COMPLETION_ROUTINE Completion,
- BOOL ShouldUnlock ) {
+ PIO_COMPLETION_ROUTINE Completion ) {
if( Status == STATUS_PENDING ) {
/* We should firstly mark this IRP as pending, because
@@ -244,29 +243,25 @@
before we return from SocketStateUnlock(). */
IoMarkIrpPending( Irp );
SocketStateUnlock( FCB );
- if( ShouldUnlock )
- UnlockRequest( Irp, IoGetCurrentIrpStackLocation( Irp ) );
} else {
+ if ( Irp->MdlAddress ) UnlockRequest( Irp, IoGetCurrentIrpStackLocation( Irp ) );
SocketStateUnlock( FCB );
Irp->IoStatus.Status = Status;
Irp->IoStatus.Information = Information;
if( Completion )
Completion( FCB->DeviceExt->DeviceObject, Irp, FCB );
- if( ShouldUnlock )
- UnlockRequest( Irp, IoGetCurrentIrpStackLocation( Irp ) );
IoCompleteRequest( Irp, IO_NETWORK_INCREMENT );
}
return Status;
}
-NTSTATUS LostSocket( PIRP Irp, BOOL ShouldUnlockIrp ) {
+NTSTATUS LostSocket( PIRP Irp ) {
NTSTATUS Status = STATUS_INVALID_PARAMETER;
AFD_DbgPrint(MIN_TRACE,("Called.\n"));
Irp->IoStatus.Information = 0;
Irp->IoStatus.Status = Status;
- if( ShouldUnlockIrp )
- UnlockRequest( Irp, IoGetCurrentIrpStackLocation( Irp ) );
+ if ( Irp->MdlAddress ) UnlockRequest( Irp, IoGetCurrentIrpStackLocation( Irp ) );
IoCompleteRequest( Irp, IO_NO_INCREMENT );
return Status;
}
@@ -274,7 +269,7 @@
NTSTATUS LeaveIrpUntilLater( PAFD_FCB FCB, PIRP Irp, UINT Function ) {
InsertTailList( &FCB->PendingIrpList[Function],
&Irp->Tail.Overlay.ListEntry );
- return UnlockAndMaybeComplete( FCB, STATUS_PENDING, Irp, 0, NULL, FALSE );
+ return UnlockAndMaybeComplete( FCB, STATUS_PENDING, Irp, 0, NULL );
}
VOID SocketCalloutEnter( PAFD_FCB FCB ) {
Modified: trunk/reactos/drivers/network/afd/afd/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/ma…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/main.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/main.c [iso-8859-1] Fri Aug 1 16:07:09 2008
@@ -257,11 +257,11 @@
NTSTATUS Status;
USHORT Flags = 0;
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
if( !(DisReq = LockRequest( Irp, IrpSp )) )
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY,
- Irp, 0, NULL, FALSE );
+ Irp, 0, NULL );
if (NULL == FCB->RemoteAddress)
{
@@ -274,7 +274,7 @@
if( !NT_SUCCESS(Status) || !ConnInfo )
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY,
- Irp, 0, NULL, TRUE );
+ Irp, 0, NULL );
}
if( DisReq->DisconnectType & AFD_DISCONNECT_SEND )
@@ -294,7 +294,7 @@
if (ConnInfo) ExFreePool( ConnInfo );
- return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL, TRUE );
+ return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
}
static NTSTATUS STDCALL
Modified: trunk/reactos/drivers/network/afd/afd/read.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/re…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/read.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/read.c [iso-8859-1] Fri Aug 1 16:07:09 2008
@@ -227,11 +227,6 @@
ASSERT_IRQL(APC_LEVEL);
- if (Irp->Cancel) {
- FCB->ReceiveIrp.InFlightRequest = NULL;
- return STATUS_SUCCESS;
- }
-
if( !SocketAcquireStateLock( FCB ) ) return Status;
FCB->ReceiveIrp.InFlightRequest = NULL;
@@ -273,21 +268,21 @@
AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB));
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
if( FCB->State != SOCKET_STATE_CONNECTED &&
FCB->State != SOCKET_STATE_CONNECTING ) {
AFD_DbgPrint(MID_TRACE,("Called recv on wrong kind of socket (s%x)\n",
FCB->State));
return UnlockAndMaybeComplete( FCB, STATUS_UNSUCCESSFUL,
- Irp, 0, NULL, FALSE );
+ Irp, 0, NULL );
}
if( FCB->Flags & AFD_ENDPOINT_CONNECTIONLESS )
{
AFD_DbgPrint(MID_TRACE,("Receive on connection-less sockets not
implemented\n"));
return UnlockAndMaybeComplete( FCB, STATUS_NOT_IMPLEMENTED,
- Irp, 0, NULL, FALSE );
+ Irp, 0, NULL );
}
FCB->EventsFired &= ~AFD_EVENT_RECEIVE;
@@ -295,7 +290,7 @@
if( !(RecvReq = LockRequest( Irp, IrpSp )) )
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY,
- Irp, 0, NULL, FALSE );
+ Irp, 0, NULL );
AFD_DbgPrint(MID_TRACE,("Recv flags %x\n", RecvReq->AfdFlags));
@@ -306,7 +301,7 @@
if( !RecvReq->BufferArray ) {
return UnlockAndMaybeComplete( FCB, STATUS_ACCESS_VIOLATION,
- Irp, 0, NULL, TRUE );
+ Irp, 0, NULL );
}
Irp->IoStatus.Status = STATUS_PENDING;
@@ -326,7 +321,7 @@
RemoveEntryList( &Irp->Tail.Overlay.ListEntry );
UnlockBuffers( RecvReq->BufferArray, RecvReq->BufferCount, FALSE );
return UnlockAndMaybeComplete( FCB, Status, Irp,
- TotalBytesCopied, NULL, TRUE );
+ TotalBytesCopied, NULL );
} else if( Status == STATUS_PENDING ) {
AFD_DbgPrint(MID_TRACE,("Leaving read irp\n"));
IoMarkIrpPending( Irp );
@@ -448,11 +443,6 @@
AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB));
- if (Irp->Cancel) {
- FCB->ReceiveIrp.InFlightRequest = NULL;
- return STATUS_SUCCESS;
- }
-
if( !SocketAcquireStateLock( FCB ) ) return STATUS_UNSUCCESSFUL;
FCB->ReceiveIrp.InFlightRequest = NULL;
@@ -501,6 +491,7 @@
Status = NextIrp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
NextIrp->IoStatus.Information = DatagramRecv->Len;
UnlockBuffers( RecvReq->BufferArray, RecvReq->BufferCount, TRUE );
+ if ( NextIrp->MdlAddress ) UnlockRequest( NextIrp,
IoGetCurrentIrpStackLocation( NextIrp ) );
IoCompleteRequest( NextIrp, IO_NETWORK_INCREMENT );
} else {
AFD_DbgPrint(MID_TRACE,("Satisfying\n"));
@@ -509,6 +500,7 @@
(PUINT)&NextIrp->IoStatus.Information );
AFD_DbgPrint(MID_TRACE,("Unlocking\n"));
UnlockBuffers( RecvReq->BufferArray, RecvReq->BufferCount, TRUE );
+ if ( NextIrp->MdlAddress ) UnlockRequest( NextIrp,
IoGetCurrentIrpStackLocation( NextIrp ) );
AFD_DbgPrint(MID_TRACE,("Completing\n"));
IoCompleteRequest( NextIrp, IO_NETWORK_INCREMENT );
}
@@ -557,17 +549,17 @@
AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB));
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
FCB->EventsFired &= ~AFD_EVENT_RECEIVE;
/* Check that the socket is bound */
if( FCB->State != SOCKET_STATE_BOUND )
return UnlockAndMaybeComplete
- ( FCB, STATUS_UNSUCCESSFUL, Irp, 0, NULL, FALSE );
+ ( FCB, STATUS_UNSUCCESSFUL, Irp, 0, NULL );
if( !(RecvReq = LockRequest( Irp, IrpSp )) )
return UnlockAndMaybeComplete
- ( FCB, STATUS_NO_MEMORY, Irp, 0, NULL, FALSE );
+ ( FCB, STATUS_NO_MEMORY, Irp, 0, NULL );
AFD_DbgPrint(MID_TRACE,("Recv flags %x\n", RecvReq->AfdFlags));
@@ -579,7 +571,7 @@
if( !RecvReq->BufferArray ) { /* access violation in userspace */
return UnlockAndMaybeComplete
- ( FCB, STATUS_ACCESS_VIOLATION, Irp, 0, NULL, FALSE );
+ ( FCB, STATUS_ACCESS_VIOLATION, Irp, 0, NULL );
}
if( !IsListEmpty( &FCB->DatagramList ) ) {
@@ -601,7 +593,7 @@
PollReeval( FCB->DeviceExt, FCB->FileObject );
return UnlockAndMaybeComplete
- ( FCB, Status, Irp, RecvReq->BufferArray[0].len, NULL, TRUE );
+ ( FCB, Status, Irp, RecvReq->BufferArray[0].len, NULL );
} else {
Status = SatisfyPacketRecvRequest
( FCB, Irp, DatagramRecv,
@@ -615,13 +607,13 @@
PollReeval( FCB->DeviceExt, FCB->FileObject );
return UnlockAndMaybeComplete
- ( FCB, Status, Irp, Irp->IoStatus.Information, NULL, TRUE );
+ ( FCB, Status, Irp, Irp->IoStatus.Information, NULL );
}
} else if( RecvReq->AfdFlags & AFD_IMMEDIATE ) {
AFD_DbgPrint(MID_TRACE,("Nonblocking\n"));
Status = STATUS_CANT_WAIT;
PollReeval( FCB->DeviceExt, FCB->FileObject );
- return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL, TRUE );
+ return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
} else {
PollReeval( FCB->DeviceExt, FCB->FileObject );
return LeaveIrpUntilLater( FCB, Irp, FUNCTION_RECV );
Modified: trunk/reactos/drivers/network/afd/afd/select.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/se…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/select.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/select.c [iso-8859-1] Fri Aug 1 16:07:09 2008
@@ -276,14 +276,14 @@
if ( !EventSelectInfo ) {
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp,
- 0, NULL, FALSE );
+ 0, NULL );
}
AFD_DbgPrint(MID_TRACE,("Called (Event %x Triggers %x)\n",
EventSelectInfo->EventObject,
EventSelectInfo->Events));
if( !SocketAcquireStateLock( FCB ) ) {
- return LostSocket( Irp, TRUE );
+ return LostSocket( Irp );
}
FCB->EventSelectTriggers = FCB->EventsFired = 0;
@@ -309,7 +309,7 @@
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
return UnlockAndMaybeComplete( FCB, STATUS_SUCCESS, Irp,
- 0, NULL, TRUE );
+ 0, NULL );
}
NTSTATUS STDCALL
@@ -324,18 +324,18 @@
if ( !EnumReq ) {
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp,
- 0, NULL, FALSE );
+ 0, NULL );
}
if( !SocketAcquireStateLock( FCB ) ) {
- return LostSocket( Irp, TRUE );
+ return LostSocket( Irp );
}
EnumReq->PollEvents = FCB->PollState;
RtlZeroMemory( EnumReq->EventStatus, sizeof(EnumReq->EventStatus) );
return UnlockAndMaybeComplete( FCB, STATUS_SUCCESS, Irp,
- 0, NULL, TRUE );
+ 0, NULL );
}
/* * * NOTE ALWAYS CALLED AT DISPATCH_LEVEL * * */
Modified: trunk/reactos/drivers/network/afd/afd/write.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/wr…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/write.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/write.c [iso-8859-1] Fri Aug 1 16:07:09 2008
@@ -40,11 +40,6 @@
ASSERT_IRQL(APC_LEVEL);
- if (Irp->Cancel) {
- FCB->SendIrp.InFlightRequest = NULL;
- return STATUS_SUCCESS;
- }
-
if( !SocketAcquireStateLock( FCB ) ) return Status;
FCB->SendIrp.InFlightRequest = NULL;
@@ -73,6 +68,8 @@
NextIrp->IoStatus.Status = Status;
NextIrp->IoStatus.Information = 0;
+
+ if ( NextIrp->MdlAddress ) UnlockRequest( NextIrp, IoGetCurrentIrpStackLocation(
NextIrp ) );
IoCompleteRequest( NextIrp, IO_NETWORK_INCREMENT );
}
@@ -151,7 +148,7 @@
AFD_DbgPrint(MID_TRACE,("Dismissing request: %x\n", Status));
return UnlockAndMaybeComplete( FCB, Status, NextIrp, TotalBytesCopied,
- NULL, TRUE );
+ NULL );
} else if( NextIrp ) {
AFD_DbgPrint(MID_TRACE,("Could not do any more with Irp %x\n",
NextIrp));
@@ -173,11 +170,6 @@
AFD_DbgPrint(MID_TRACE,("Called, status %x, %d bytes used\n",
Irp->IoStatus.Status,
Irp->IoStatus.Information));
-
- if (Irp->Cancel) {
- FCB->SendIrp.InFlightRequest = NULL;
- return STATUS_SUCCESS;
- }
/* It's ok if the FCB already died */
if( !SocketAcquireStateLock( FCB ) ) return STATUS_SUCCESS;
@@ -211,7 +203,7 @@
AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB));
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
FCB->EventsFired &= ~AFD_EVENT_SEND;
@@ -223,11 +215,11 @@
/* Check that the socket is bound */
if( FCB->State != SOCKET_STATE_BOUND )
return UnlockAndMaybeComplete( FCB, STATUS_UNSUCCESSFUL, Irp,
- 0, NULL, FALSE );
+ 0, NULL );
if( !(SendReq = LockRequest( Irp, IrpSp )) )
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0,
- NULL, FALSE );
+ NULL );
/* Must lock buffers before handing off user data */
SendReq->BufferArray = LockBuffers( SendReq->BufferArray,
@@ -259,12 +251,12 @@
return UnlockAndMaybeComplete( FCB, Status, Irp,
SendReq->BufferArray[0].len,
- NULL, TRUE );
+ NULL );
}
if( !(SendReq = LockRequest( Irp, IrpSp )) )
return UnlockAndMaybeComplete
- ( FCB, STATUS_NO_MEMORY, Irp, TotalBytesCopied, NULL, FALSE );
+ ( FCB, STATUS_NO_MEMORY, Irp, TotalBytesCopied, NULL );
AFD_DbgPrint(MID_TRACE,("Socket state %d\n", FCB->State));
@@ -272,7 +264,7 @@
if( SendReq->AfdFlags & AFD_IMMEDIATE ) {
AFD_DbgPrint(MID_TRACE,("Nonblocking\n"));
return UnlockAndMaybeComplete
- ( FCB, STATUS_CANT_WAIT, Irp, 0, NULL, TRUE );
+ ( FCB, STATUS_CANT_WAIT, Irp, 0, NULL );
} else {
AFD_DbgPrint(MID_TRACE,("Queuing request\n"));
return LeaveIrpUntilLater( FCB, Irp, FUNCTION_SEND );
@@ -323,7 +315,7 @@
AFD_DbgPrint(MID_TRACE,("Empty send\n"));
return UnlockAndMaybeComplete
- ( FCB, Status, Irp, TotalBytesCopied, NULL, TRUE );
+ ( FCB, Status, Irp, TotalBytesCopied, NULL );
}
AFD_DbgPrint(MID_TRACE,("Completed %d bytes\n", TotalBytesCopied));
@@ -353,14 +345,14 @@
Status, TotalBytesCopied));
return UnlockAndMaybeComplete
- ( FCB, Status, Irp, TotalBytesCopied, NULL, TRUE );
+ ( FCB, Status, Irp, TotalBytesCopied, NULL );
}
}
if( SendReq->AfdFlags & AFD_IMMEDIATE ) {
AFD_DbgPrint(MID_TRACE,("Nonblocking\n"));
return UnlockAndMaybeComplete
- ( FCB, STATUS_CANT_WAIT, Irp, 0, NULL, TRUE );
+ ( FCB, STATUS_CANT_WAIT, Irp, 0, NULL );
} else {
AFD_DbgPrint(MID_TRACE,("Queuing request\n"));
return LeaveIrpUntilLater( FCB, Irp, FUNCTION_SEND );
@@ -378,7 +370,7 @@
AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB));
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
FCB->EventsFired &= ~AFD_EVENT_SEND;
FCB->PollState &= ~AFD_EVENT_SEND;
@@ -386,10 +378,10 @@
/* Check that the socket is bound */
if( FCB->State != SOCKET_STATE_BOUND )
return UnlockAndMaybeComplete
- ( FCB, STATUS_UNSUCCESSFUL, Irp, 0, NULL, FALSE );
+ ( FCB, STATUS_UNSUCCESSFUL, Irp, 0, NULL );
if( !(SendReq = LockRequest( Irp, IrpSp )) )
return UnlockAndMaybeComplete
- ( FCB, STATUS_NO_MEMORY, Irp, 0, NULL, FALSE );
+ ( FCB, STATUS_NO_MEMORY, Irp, 0, NULL );
AFD_DbgPrint
(MID_TRACE,("RemoteAddress #%d Type %d\n",
@@ -426,6 +418,6 @@
AFD_DbgPrint(MID_TRACE,("Dismissing request: %x\n", Status));
return UnlockAndMaybeComplete
- ( FCB, Status, Irp, SendReq->BufferArray[0].len, NULL, TRUE );
+ ( FCB, Status, Irp, SendReq->BufferArray[0].len, NULL );
}
Modified: trunk/reactos/drivers/network/afd/include/afd.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/includ…
==============================================================================
--- trunk/reactos/drivers/network/afd/include/afd.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/include/afd.h [iso-8859-1] Fri Aug 1 16:07:09 2008
@@ -206,10 +206,9 @@
NTSTATUS NTAPI UnlockAndMaybeComplete
( PAFD_FCB FCB, NTSTATUS Status, PIRP Irp,
UINT Information,
- PIO_COMPLETION_ROUTINE Completion,
- BOOL ShouldUnlockIrp );
+ PIO_COMPLETION_ROUTINE Completion );
VOID SocketStateUnlock( PAFD_FCB FCB );
-NTSTATUS LostSocket( PIRP Irp, BOOL ShouldUnlockIrp );
+NTSTATUS LostSocket( PIRP Irp );
PAFD_HANDLE LockHandles( PAFD_HANDLE HandleArray, UINT HandleCount );
VOID UnlockHandles( PAFD_HANDLE HandleArray, UINT HandleCount );
PVOID LockRequest( PIRP Irp, PIO_STACK_LOCATION IrpSp );