mirror of
https://github.com/reactos/reactos.git
synced 2024-06-15 17:11:52 +00:00
- Remove a useless parameter from UnlockAndMaybeComplete
- Fix a few listening bugs svn path=/trunk/; revision=40267
This commit is contained in:
parent
82d4f0afe3
commit
a5d8c32124
|
@ -56,7 +56,7 @@ AfdBindSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
|
||||
if( !(BindReq = LockRequest( Irp, IrpSp )) )
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY,
|
||||
Irp, 0, NULL );
|
||||
Irp, 0 );
|
||||
|
||||
if( FCB->LocalAddress ) ExFreePool( FCB->LocalAddress );
|
||||
FCB->LocalAddress = TaCopyTransportAddress( &BindReq->Address );
|
||||
|
@ -67,7 +67,7 @@ AfdBindSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
|
||||
if( NT_SUCCESS(Status) )
|
||||
FCB->State = SOCKET_STATE_BOUND;
|
||||
else return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
|
||||
else return UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
|
||||
|
||||
AFD_DbgPrint(MID_TRACE,("FCB->Flags %x\n", FCB->Flags));
|
||||
|
||||
|
@ -76,7 +76,7 @@ AfdBindSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
TdiBuildConnectionInfo( &FCB->AddressFrom,
|
||||
FCB->LocalAddress );
|
||||
|
||||
if( !FCB->AddressFrom ) return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0, NULL );
|
||||
if( !FCB->AddressFrom ) return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0 );
|
||||
|
||||
AFD_DbgPrint(MID_TRACE,("Calling TdiReceiveDatagram\n"));
|
||||
|
||||
|
@ -95,6 +95,6 @@ AfdBindSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
if( Status == STATUS_PENDING ) Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
|
||||
return UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
|
||||
}
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ AfdStreamSocketConnect(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
|
||||
if( !(ConnectReq = LockRequest( Irp, IrpSp )) )
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp,
|
||||
0, NULL );
|
||||
0 );
|
||||
|
||||
AFD_DbgPrint(MID_TRACE,("Connect request:\n"));
|
||||
#if 0
|
||||
|
@ -207,10 +207,10 @@ AfdStreamSocketConnect(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
if( NT_SUCCESS(Status) )
|
||||
FCB->State = SOCKET_STATE_BOUND;
|
||||
else
|
||||
return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
|
||||
return UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
|
||||
} else
|
||||
return UnlockAndMaybeComplete
|
||||
( FCB, STATUS_NO_MEMORY, Irp, 0, NULL );
|
||||
( FCB, STATUS_NO_MEMORY, Irp, 0 );
|
||||
|
||||
/* Drop through to SOCKET_STATE_BOUND */
|
||||
|
||||
|
@ -264,5 +264,5 @@ AfdStreamSocketConnect(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
break;
|
||||
}
|
||||
|
||||
return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
|
||||
return UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ AfdGetContext( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
|
||||
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
|
||||
|
||||
return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
|
||||
return UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
|
||||
}
|
||||
|
||||
NTSTATUS NTAPI
|
||||
|
@ -52,7 +52,7 @@ AfdSetContext( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
FCB->Context = ExAllocatePool( PagedPool,
|
||||
IrpSp->Parameters.DeviceIoControl.InputBufferLength );
|
||||
|
||||
if( !FCB->Context ) return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0, NULL );
|
||||
if( !FCB->Context ) return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0 );
|
||||
|
||||
FCB->ContextSize = IrpSp->Parameters.DeviceIoControl.InputBufferLength;
|
||||
|
||||
|
@ -60,5 +60,5 @@ AfdSetContext( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
IrpSp->Parameters.DeviceIoControl.Type3InputBuffer,
|
||||
FCB->ContextSize );
|
||||
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_SUCCESS, Irp, 0, NULL );
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_SUCCESS, Irp, 0 );
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ AfdGetInfo( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
|
||||
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
|
||||
|
||||
return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
|
||||
return UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
|
||||
}
|
||||
|
||||
NTSTATUS NTAPI
|
||||
|
@ -80,8 +80,7 @@ AfdGetSockName( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
|
||||
|
||||
if( FCB->AddressFile.Object == NULL && FCB->Connection.Object == NULL ) {
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_INVALID_PARAMETER, Irp, 0,
|
||||
NULL );
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_INVALID_PARAMETER, Irp, 0 );
|
||||
}
|
||||
|
||||
Mdl = IoAllocateMdl
|
||||
|
@ -108,7 +107,7 @@ AfdGetSockName( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
} else
|
||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
|
||||
return UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
|
||||
}
|
||||
|
||||
NTSTATUS NTAPI
|
||||
|
@ -124,7 +123,7 @@ AfdGetPeerName( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
|
||||
|
||||
if (FCB->RemoteAddress == NULL || FCB->Connection.Object == NULL) {
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_INVALID_PARAMETER, Irp, 0, NULL );
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_INVALID_PARAMETER, Irp, 0 );
|
||||
}
|
||||
|
||||
if(NT_SUCCESS(Status = TdiBuildNullConnectionInfo
|
||||
|
@ -164,5 +163,5 @@ AfdGetPeerName( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
ExFreePool(ConnInfo);
|
||||
}
|
||||
|
||||
return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
|
||||
return UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
|
||||
}
|
||||
|
|
|
@ -41,15 +41,7 @@ static NTSTATUS SatisfyAccept( PAFD_DEVICE_EXTENSION DeviceExt,
|
|||
PollReeval( DeviceExt, NewFileObject );
|
||||
}
|
||||
|
||||
if( Irp->MdlAddress ) UnlockRequest( Irp, IoGetCurrentIrpStackLocation( Irp ) );
|
||||
|
||||
Irp->IoStatus.Information = 0;
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest( Irp, IO_NETWORK_INCREMENT );
|
||||
|
||||
SocketStateUnlock( FCB );
|
||||
|
||||
return Status;
|
||||
return UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
|
||||
}
|
||||
|
||||
static NTSTATUS SatisfyPreAccept( PIRP Irp, PAFD_TDI_OBJECT_QELT Qelt ) {
|
||||
|
@ -197,12 +189,12 @@ NTSTATUS AfdListenSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
|
||||
if( !(ListenReq = LockRequest( Irp, IrpSp )) )
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp,
|
||||
0, NULL );
|
||||
0 );
|
||||
|
||||
if( FCB->State != SOCKET_STATE_BOUND ) {
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
AFD_DbgPrint(MID_TRACE,("Could not listen an unbound socket\n"));
|
||||
return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
|
||||
return UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
|
||||
}
|
||||
|
||||
FCB->DelayedAccept = ListenReq->UseDelayedAcceptance;
|
||||
|
@ -213,7 +205,7 @@ NTSTATUS AfdListenSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
|
||||
AFD_DbgPrint(MID_TRACE,("Status from warmsocket %x\n", Status));
|
||||
|
||||
if( !NT_SUCCESS(Status) ) return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
|
||||
if( !NT_SUCCESS(Status) ) return UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
|
||||
|
||||
TdiBuildNullConnectionInfo
|
||||
( &FCB->ListenIrp.ConnectionCallInfo,
|
||||
|
@ -223,7 +215,7 @@ NTSTATUS AfdListenSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
FCB->LocalAddress->Address[0].AddressType );
|
||||
|
||||
if( !FCB->ListenIrp.ConnectionReturnInfo || !FCB->ListenIrp.ConnectionCallInfo )
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0, NULL );
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0 );
|
||||
|
||||
FCB->State = SOCKET_STATE_LISTENING;
|
||||
|
||||
|
@ -235,11 +227,11 @@ NTSTATUS AfdListenSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
ListenComplete,
|
||||
FCB );
|
||||
|
||||
if( NT_SUCCESS(Status) || Status == STATUS_PENDING )
|
||||
if( Status == STATUS_PENDING )
|
||||
Status = STATUS_SUCCESS;
|
||||
|
||||
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
|
||||
return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
|
||||
return UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
|
||||
}
|
||||
|
||||
NTSTATUS AfdWaitForListen( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||
|
@ -298,11 +290,15 @@ NTSTATUS AfdAccept( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
Status = WarmSocketForConnection( FCB );
|
||||
|
||||
if( Status == STATUS_SUCCESS ) {
|
||||
TdiBuildNullConnectionInfo
|
||||
( &FCB->ListenIrp.ConnectionReturnInfo,
|
||||
FCB->LocalAddress->Address[0].AddressType );
|
||||
TdiBuildNullConnectionInfo
|
||||
( &FCB->ListenIrp.ConnectionCallInfo,
|
||||
FCB->LocalAddress->Address[0].AddressType );
|
||||
TdiBuildNullConnectionInfo
|
||||
( &FCB->ListenIrp.ConnectionReturnInfo,
|
||||
FCB->LocalAddress->Address[0].AddressType );
|
||||
|
||||
if( !FCB->ListenIrp.ConnectionReturnInfo ) return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0, NULL );
|
||||
if( !FCB->ListenIrp.ConnectionReturnInfo || !FCB->ListenIrp.ConnectionCallInfo )
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0 );
|
||||
|
||||
Status = TdiListen( &FCB->ListenIrp.InFlightRequest,
|
||||
FCB->Connection.Object,
|
||||
|
@ -311,8 +307,15 @@ NTSTATUS AfdAccept( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
&FCB->ListenIrp.Iosb,
|
||||
ListenComplete,
|
||||
FCB );
|
||||
} else return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
|
||||
FCB->NeedsNewListen = FALSE;
|
||||
|
||||
if( Status == STATUS_PENDING )
|
||||
Status = STATUS_SUCCESS;
|
||||
|
||||
if( !NT_SUCCESS(Status) )
|
||||
return UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
|
||||
|
||||
FCB->NeedsNewListen = FALSE;
|
||||
} else return UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
|
||||
}
|
||||
|
||||
for( PendingConn = FCB->PendingConnections.Flink;
|
||||
|
@ -338,7 +341,7 @@ NTSTATUS AfdAccept( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
(PVOID *)&NewFileObject,
|
||||
NULL );
|
||||
|
||||
if( !NT_SUCCESS(Status) ) UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
|
||||
if( !NT_SUCCESS(Status) ) UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
|
||||
|
||||
ASSERT(NewFileObject != FileObject);
|
||||
ASSERT(NewFileObject->FsContext != FCB);
|
||||
|
@ -362,5 +365,5 @@ NTSTATUS AfdAccept( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
}
|
||||
}
|
||||
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_UNSUCCESSFUL, Irp, 0, NULL );
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_UNSUCCESSFUL, Irp, 0 );
|
||||
}
|
||||
|
|
|
@ -285,8 +285,7 @@ VOID SocketStateUnlock( PAFD_FCB FCB ) {
|
|||
|
||||
NTSTATUS NTAPI UnlockAndMaybeComplete
|
||||
( PAFD_FCB FCB, NTSTATUS Status, PIRP Irp,
|
||||
UINT Information,
|
||||
PIO_COMPLETION_ROUTINE Completion ) {
|
||||
UINT Information ) {
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = Information;
|
||||
|
@ -300,8 +299,6 @@ NTSTATUS NTAPI UnlockAndMaybeComplete
|
|||
} else {
|
||||
if ( Irp->MdlAddress ) UnlockRequest( Irp, IoGetCurrentIrpStackLocation( Irp ) );
|
||||
SocketStateUnlock( FCB );
|
||||
if( Completion )
|
||||
Completion( FCB->DeviceExt->DeviceObject, Irp, FCB );
|
||||
IoCompleteRequest( Irp, IO_NETWORK_INCREMENT );
|
||||
}
|
||||
return Status;
|
||||
|
@ -323,5 +320,5 @@ NTSTATUS LeaveIrpUntilLater( PAFD_FCB FCB, PIRP Irp, UINT Function ) {
|
|||
&Irp->Tail.Overlay.ListEntry );
|
||||
IoMarkIrpPending(Irp);
|
||||
Irp->IoStatus.Status = STATUS_PENDING;
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_PENDING, Irp, 0, NULL );
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_PENDING, Irp, 0 );
|
||||
}
|
||||
|
|
|
@ -270,7 +270,7 @@ AfdDisconnect(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
|
||||
if( !(DisReq = LockRequest( Irp, IrpSp )) )
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY,
|
||||
Irp, 0, NULL );
|
||||
Irp, 0 );
|
||||
|
||||
if (NULL == FCB->RemoteAddress)
|
||||
{
|
||||
|
@ -283,7 +283,7 @@ AfdDisconnect(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
|
||||
if( !NT_SUCCESS(Status) || !ConnInfo )
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY,
|
||||
Irp, 0, NULL );
|
||||
Irp, 0 );
|
||||
}
|
||||
|
||||
if( DisReq->DisconnectType & AFD_DISCONNECT_SEND )
|
||||
|
@ -303,7 +303,7 @@ AfdDisconnect(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
|
||||
if (ConnInfo) ExFreePool( ConnInfo );
|
||||
|
||||
return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
|
||||
return UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
|
||||
}
|
||||
|
||||
static NTSTATUS NTAPI
|
||||
|
|
|
@ -284,14 +284,14 @@ AfdConnectedSocketReadData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
AFD_DbgPrint(MID_TRACE,("Called recv on wrong kind of socket (s%x)\n",
|
||||
FCB->State));
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_INVALID_PARAMETER,
|
||||
Irp, 0, NULL );
|
||||
Irp, 0 );
|
||||
}
|
||||
|
||||
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 );
|
||||
Irp, 0 );
|
||||
}
|
||||
|
||||
FCB->EventsFired &= ~AFD_EVENT_RECEIVE;
|
||||
|
@ -299,7 +299,7 @@ AfdConnectedSocketReadData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
|
||||
if( !(RecvReq = LockRequest( Irp, IrpSp )) )
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY,
|
||||
Irp, 0, NULL );
|
||||
Irp, 0 );
|
||||
|
||||
AFD_DbgPrint(MID_TRACE,("Recv flags %x\n", RecvReq->AfdFlags));
|
||||
|
||||
|
@ -310,7 +310,7 @@ AfdConnectedSocketReadData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
|
||||
if( !RecvReq->BufferArray ) {
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_ACCESS_VIOLATION,
|
||||
Irp, 0, NULL );
|
||||
Irp, 0 );
|
||||
}
|
||||
|
||||
Irp->IoStatus.Status = STATUS_PENDING;
|
||||
|
@ -330,7 +330,7 @@ AfdConnectedSocketReadData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
RemoveEntryList( &Irp->Tail.Overlay.ListEntry );
|
||||
UnlockBuffers( RecvReq->BufferArray, RecvReq->BufferCount, FALSE );
|
||||
return UnlockAndMaybeComplete( FCB, Status, Irp,
|
||||
TotalBytesCopied, NULL );
|
||||
TotalBytesCopied );
|
||||
} else if( Status == STATUS_PENDING ) {
|
||||
AFD_DbgPrint(MID_TRACE,("Leaving read irp\n"));
|
||||
IoMarkIrpPending( Irp );
|
||||
|
@ -576,10 +576,10 @@ AfdPacketSocketReadData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
/* Check that the socket is bound */
|
||||
if( FCB->State != SOCKET_STATE_BOUND )
|
||||
return UnlockAndMaybeComplete
|
||||
( FCB, STATUS_INVALID_PARAMETER, Irp, 0, NULL );
|
||||
( FCB, STATUS_INVALID_PARAMETER, Irp, 0 );
|
||||
if( !(RecvReq = LockRequest( Irp, IrpSp )) )
|
||||
return UnlockAndMaybeComplete
|
||||
( FCB, STATUS_NO_MEMORY, Irp, 0, NULL );
|
||||
( FCB, STATUS_NO_MEMORY, Irp, 0 );
|
||||
|
||||
AFD_DbgPrint(MID_TRACE,("Recv flags %x\n", RecvReq->AfdFlags));
|
||||
|
||||
|
@ -591,7 +591,7 @@ AfdPacketSocketReadData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
|
||||
if( !RecvReq->BufferArray ) { /* access violation in userspace */
|
||||
return UnlockAndMaybeComplete
|
||||
( FCB, STATUS_ACCESS_VIOLATION, Irp, 0, NULL );
|
||||
( FCB, STATUS_ACCESS_VIOLATION, Irp, 0 );
|
||||
}
|
||||
|
||||
if( !IsListEmpty( &FCB->DatagramList ) ) {
|
||||
|
@ -615,7 +615,7 @@ AfdPacketSocketReadData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
UnlockBuffers( RecvReq->BufferArray, RecvReq->BufferCount, TRUE );
|
||||
|
||||
return UnlockAndMaybeComplete
|
||||
( FCB, Status, Irp, Irp->IoStatus.Information, NULL );
|
||||
( FCB, Status, Irp, Irp->IoStatus.Information );
|
||||
} else {
|
||||
Status = SatisfyPacketRecvRequest
|
||||
( FCB, Irp, DatagramRecv,
|
||||
|
@ -631,14 +631,14 @@ AfdPacketSocketReadData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
UnlockBuffers( RecvReq->BufferArray, RecvReq->BufferCount, TRUE );
|
||||
|
||||
return UnlockAndMaybeComplete
|
||||
( FCB, Status, Irp, Irp->IoStatus.Information, NULL );
|
||||
( FCB, Status, Irp, Irp->IoStatus.Information );
|
||||
}
|
||||
} else if( RecvReq->AfdFlags & AFD_IMMEDIATE ) {
|
||||
AFD_DbgPrint(MID_TRACE,("Nonblocking\n"));
|
||||
Status = STATUS_CANT_WAIT;
|
||||
PollReeval( FCB->DeviceExt, FCB->FileObject );
|
||||
UnlockBuffers( RecvReq->BufferArray, RecvReq->BufferCount, TRUE );
|
||||
return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
|
||||
return UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
|
||||
} else {
|
||||
PollReeval( FCB->DeviceExt, FCB->FileObject );
|
||||
return LeaveIrpUntilLater( FCB, Irp, FUNCTION_RECV );
|
||||
|
|
|
@ -281,7 +281,7 @@ AfdEventSelect( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
|
||||
if ( !EventSelectInfo ) {
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp,
|
||||
0, NULL );
|
||||
0 );
|
||||
}
|
||||
AFD_DbgPrint(MID_TRACE,("Called (Event %x Triggers %x)\n",
|
||||
EventSelectInfo->EventObject,
|
||||
|
@ -310,7 +310,7 @@ AfdEventSelect( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
|
||||
|
||||
return UnlockAndMaybeComplete( FCB, Status, Irp,
|
||||
0, NULL );
|
||||
0 );
|
||||
}
|
||||
|
||||
NTSTATUS NTAPI
|
||||
|
@ -329,14 +329,14 @@ AfdEnumEvents( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
|
||||
if ( !EnumReq ) {
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp,
|
||||
0, NULL );
|
||||
0 );
|
||||
}
|
||||
|
||||
EnumReq->PollEvents = FCB->PollState;
|
||||
RtlZeroMemory( EnumReq->EventStatus, sizeof(EnumReq->EventStatus) );
|
||||
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_SUCCESS, Irp,
|
||||
0, NULL );
|
||||
0 );
|
||||
}
|
||||
|
||||
/* * * NOTE ALWAYS CALLED AT DISPATCH_LEVEL * * */
|
||||
|
|
|
@ -148,8 +148,7 @@ static NTSTATUS NTAPI SendComplete
|
|||
|
||||
AFD_DbgPrint(MID_TRACE,("Dismissing request: %x\n", Status));
|
||||
|
||||
return UnlockAndMaybeComplete( FCB, Status, NextIrp, TotalBytesCopied,
|
||||
NULL );
|
||||
return UnlockAndMaybeComplete( FCB, Status, NextIrp, TotalBytesCopied );
|
||||
} else if( NextIrp ) {
|
||||
AFD_DbgPrint(MID_TRACE,("Could not do any more with Irp %x\n",
|
||||
NextIrp));
|
||||
|
@ -220,11 +219,10 @@ AfdConnectedSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
/* Check that the socket is bound */
|
||||
if( FCB->State != SOCKET_STATE_BOUND )
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_INVALID_PARAMETER, Irp,
|
||||
0, NULL );
|
||||
0 );
|
||||
|
||||
if( !(SendReq = LockRequest( Irp, IrpSp )) )
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0,
|
||||
NULL );
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0 );
|
||||
|
||||
/* Must lock buffers before handing off user data */
|
||||
SendReq->BufferArray = LockBuffers( SendReq->BufferArray,
|
||||
|
@ -234,7 +232,7 @@ AfdConnectedSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
|
||||
if( !SendReq->BufferArray ) {
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_ACCESS_VIOLATION,
|
||||
Irp, 0, NULL );
|
||||
Irp, 0 );
|
||||
}
|
||||
|
||||
TdiBuildConnectionInfo( &TargetAddress, FCB->RemoteAddress );
|
||||
|
@ -258,13 +256,12 @@ AfdConnectedSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
AFD_DbgPrint(MID_TRACE,("Dismissing request: %x\n", Status));
|
||||
|
||||
return UnlockAndMaybeComplete( FCB, Status, Irp,
|
||||
SendReq->BufferArray[0].len,
|
||||
NULL );
|
||||
SendReq->BufferArray[0].len );
|
||||
}
|
||||
|
||||
if( !(SendReq = LockRequest( Irp, IrpSp )) )
|
||||
return UnlockAndMaybeComplete
|
||||
( FCB, STATUS_NO_MEMORY, Irp, TotalBytesCopied, NULL );
|
||||
( FCB, STATUS_NO_MEMORY, Irp, TotalBytesCopied );
|
||||
|
||||
SendReq->BufferArray = LockBuffers( SendReq->BufferArray,
|
||||
SendReq->BufferCount,
|
||||
|
@ -273,7 +270,7 @@ AfdConnectedSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
|
||||
if( !SendReq->BufferArray ) {
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_ACCESS_VIOLATION,
|
||||
Irp, 0, NULL );
|
||||
Irp, 0 );
|
||||
}
|
||||
|
||||
AFD_DbgPrint(MID_TRACE,("Socket state %d\n", FCB->State));
|
||||
|
@ -283,7 +280,7 @@ AfdConnectedSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
AFD_DbgPrint(MID_TRACE,("Nonblocking\n"));
|
||||
UnlockBuffers( SendReq->BufferArray, SendReq->BufferCount, FALSE );
|
||||
return UnlockAndMaybeComplete
|
||||
( FCB, STATUS_CANT_WAIT, Irp, 0, NULL );
|
||||
( FCB, STATUS_CANT_WAIT, Irp, 0 );
|
||||
} else {
|
||||
AFD_DbgPrint(MID_TRACE,("Queuing request\n"));
|
||||
return LeaveIrpUntilLater( FCB, Irp, FUNCTION_SEND );
|
||||
|
@ -326,7 +323,7 @@ AfdConnectedSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
|
||||
AFD_DbgPrint(MID_TRACE,("Empty send\n"));
|
||||
return UnlockAndMaybeComplete
|
||||
( FCB, Status, Irp, TotalBytesCopied, NULL );
|
||||
( FCB, Status, Irp, TotalBytesCopied );
|
||||
}
|
||||
|
||||
AFD_DbgPrint(MID_TRACE,("Completed %d bytes\n", TotalBytesCopied));
|
||||
|
@ -350,7 +347,7 @@ AfdConnectedSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
Status, TotalBytesCopied));
|
||||
|
||||
return UnlockAndMaybeComplete
|
||||
( FCB, Status, Irp, TotalBytesCopied, NULL );
|
||||
( FCB, Status, Irp, TotalBytesCopied );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -358,7 +355,7 @@ AfdConnectedSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
AFD_DbgPrint(MID_TRACE,("Nonblocking\n"));
|
||||
UnlockBuffers( SendReq->BufferArray, SendReq->BufferCount, FALSE );
|
||||
return UnlockAndMaybeComplete
|
||||
( FCB, STATUS_CANT_WAIT, Irp, 0, NULL );
|
||||
( FCB, STATUS_CANT_WAIT, Irp, 0 );
|
||||
} else {
|
||||
AFD_DbgPrint(MID_TRACE,("Queuing request\n"));
|
||||
return LeaveIrpUntilLater( FCB, Irp, FUNCTION_SEND );
|
||||
|
@ -386,10 +383,10 @@ AfdPacketSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
/* Check that the socket is bound */
|
||||
if( FCB->State != SOCKET_STATE_BOUND )
|
||||
return UnlockAndMaybeComplete
|
||||
( FCB, STATUS_INVALID_PARAMETER, Irp, 0, NULL );
|
||||
( FCB, STATUS_INVALID_PARAMETER, Irp, 0 );
|
||||
if( !(SendReq = LockRequest( Irp, IrpSp )) )
|
||||
return UnlockAndMaybeComplete
|
||||
( FCB, STATUS_NO_MEMORY, Irp, 0, NULL );
|
||||
( FCB, STATUS_NO_MEMORY, Irp, 0 );
|
||||
|
||||
SendReq->BufferArray = LockBuffers( SendReq->BufferArray,
|
||||
SendReq->BufferCount,
|
||||
|
@ -398,7 +395,7 @@ AfdPacketSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
|
||||
if( !SendReq->BufferArray )
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_ACCESS_VIOLATION,
|
||||
Irp, 0, NULL );
|
||||
Irp, 0 );
|
||||
|
||||
AFD_DbgPrint
|
||||
(MID_TRACE,("RemoteAddress #%d Type %d\n",
|
||||
|
@ -431,6 +428,6 @@ AfdPacketSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
AFD_DbgPrint(MID_TRACE,("Dismissing request: %x\n", Status));
|
||||
|
||||
return UnlockAndMaybeComplete
|
||||
( FCB, Status, Irp, SendReq->BufferArray[0].len, NULL );
|
||||
( FCB, Status, Irp, SendReq->BufferArray[0].len );
|
||||
}
|
||||
|
||||
|
|
|
@ -263,8 +263,7 @@ VOID UnlockBuffers( PAFD_WSABUF Buf, UINT Count, BOOL Address );
|
|||
UINT SocketAcquireStateLock( PAFD_FCB FCB );
|
||||
NTSTATUS NTAPI UnlockAndMaybeComplete
|
||||
( PAFD_FCB FCB, NTSTATUS Status, PIRP Irp,
|
||||
UINT Information,
|
||||
PIO_COMPLETION_ROUTINE Completion );
|
||||
UINT Information );
|
||||
VOID SocketStateUnlock( PAFD_FCB FCB );
|
||||
NTSTATUS LostSocket( PIRP Irp );
|
||||
PAFD_HANDLE LockHandles( PAFD_HANDLE HandleArray, UINT HandleCount );
|
||||
|
|
Loading…
Reference in a new issue