mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 01:15:09 +00:00
Merge aicom-network-fixes up to 35398
svn path=/trunk/; revision=35399
This commit is contained in:
parent
0860be6816
commit
7fd0c1eb30
6 changed files with 34 additions and 23 deletions
|
@ -39,27 +39,30 @@ AfdGetContext( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
NTSTATUS STDCALL
|
||||
AfdSetContext( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||
PIO_STACK_LOCATION IrpSp ) {
|
||||
NTSTATUS Status = STATUS_NO_MEMORY;
|
||||
NTSTATUS Status = STATUS_BUFFER_TOO_SMALL;
|
||||
PFILE_OBJECT FileObject = IrpSp->FileObject;
|
||||
PAFD_FCB FCB = FileObject->FsContext;
|
||||
|
||||
if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
|
||||
|
||||
if( FCB->Context ) {
|
||||
ExFreePool( FCB->Context );
|
||||
FCB->Context = NULL;
|
||||
}
|
||||
|
||||
if( FCB->ContextSize <
|
||||
IrpSp->Parameters.DeviceIoControl.InputBufferLength ) {
|
||||
if( FCB->Context )
|
||||
ExFreePool( FCB->Context );
|
||||
FCB->Context =
|
||||
ExAllocatePool
|
||||
( PagedPool,
|
||||
IrpSp->Parameters.DeviceIoControl.InputBufferLength );
|
||||
}
|
||||
|
||||
if( FCB->Context ) {
|
||||
Status = STATUS_SUCCESS;
|
||||
if( !FCB->Context ) return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0, NULL );
|
||||
|
||||
RtlCopyMemory( FCB->Context,
|
||||
IrpSp->Parameters.DeviceIoControl.Type3InputBuffer,
|
||||
IrpSp->Parameters.DeviceIoControl.InputBufferLength );
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
|
||||
|
|
|
@ -24,12 +24,9 @@ AfdGetInfo( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
AFD_DbgPrint(MID_TRACE,("Called %x %x\n", InfoReq,
|
||||
InfoReq ? InfoReq->InformationClass : 0));
|
||||
|
||||
_SEH_TRY {
|
||||
if( !SocketAcquireStateLock( FCB ) ) {
|
||||
Status = LostSocket( Irp );
|
||||
_SEH_YIELD(return Status);
|
||||
}
|
||||
if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
|
||||
|
||||
_SEH_TRY {
|
||||
switch( InfoReq->InformationClass ) {
|
||||
case AFD_INFO_RECEIVE_WINDOW_SIZE:
|
||||
InfoReq->Information.Ulong = FCB->Recv.Size;
|
||||
|
@ -113,7 +110,7 @@ AfdGetSockOrPeerName( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
TDI_QUERY_ADDRESS_INFO,
|
||||
Mdl );
|
||||
} else {
|
||||
if( !NT_SUCCESS
|
||||
if( NT_SUCCESS
|
||||
( Status = TdiBuildNullConnectionInfo
|
||||
( &ConnInfo,
|
||||
FCB->LocalAddress->Address[0].AddressType ) ) ) {
|
||||
|
@ -148,11 +145,11 @@ AfdGetSockOrPeerName( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
|
||||
if( ConnInfo ) ExFreePool( ConnInfo );
|
||||
if( SysMdl ) IoFreeMdl( SysMdl );
|
||||
if( TransAddr ) MmUnmapLockedPages( TransAddr, Mdl );
|
||||
}
|
||||
/* MmUnlockPages( Mdl ); */
|
||||
}
|
||||
|
||||
/* MmUnlockPages( Mdl ); */
|
||||
/* IoFreeMdl( Mdl ); */
|
||||
/* IoFreeMdl( Mdl ); */
|
||||
} else {
|
||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
|
|
@ -188,8 +188,6 @@ NTSTATUS AfdListenSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
|
||||
if( !NT_SUCCESS(Status) ) return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
|
||||
|
||||
FCB->State = SOCKET_STATE_LISTENING;
|
||||
|
||||
TdiBuildNullConnectionInfo
|
||||
( &FCB->ListenIrp.ConnectionCallInfo,
|
||||
FCB->LocalAddress->Address[0].AddressType );
|
||||
|
@ -197,6 +195,11 @@ NTSTATUS AfdListenSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
( &FCB->ListenIrp.ConnectionReturnInfo,
|
||||
FCB->LocalAddress->Address[0].AddressType );
|
||||
|
||||
if( !FCB->ListenIrp.ConnectionReturnInfo || !FCB->ListenIrp.ConnectionCallInfo )
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0, NULL );
|
||||
|
||||
FCB->State = SOCKET_STATE_LISTENING;
|
||||
|
||||
Status = TdiListen( &FCB->ListenIrp.InFlightRequest,
|
||||
FCB->Connection.Object,
|
||||
&FCB->ListenIrp.ConnectionCallInfo,
|
||||
|
@ -272,6 +275,8 @@ NTSTATUS AfdAccept( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
( &FCB->ListenIrp.ConnectionReturnInfo,
|
||||
FCB->LocalAddress->Address[0].AddressType );
|
||||
|
||||
if( !FCB->ListenIrp.ConnectionReturnInfo ) return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0, NULL );
|
||||
|
||||
Status = TdiListen( &FCB->ListenIrp.InFlightRequest,
|
||||
FCB->Connection.Object,
|
||||
&FCB->ListenIrp.ConnectionCallInfo,
|
||||
|
@ -306,6 +311,8 @@ NTSTATUS AfdAccept( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
(PVOID *)&NewFileObject,
|
||||
NULL );
|
||||
|
||||
if( !NT_SUCCESS(Status) ) UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
|
||||
|
||||
ASSERT(NewFileObject != FileObject);
|
||||
ASSERT(NewFileObject->FsContext != FCB);
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ UINT SocketAcquireStateLock( PAFD_FCB FCB ) {
|
|||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
PVOID CurrentThread = KeGetCurrentThread();
|
||||
|
||||
ASSERT(KeGetCurrentIrql() == PASSIVE_LEVEL);
|
||||
ASSERT(KeGetCurrentIrql() <= APC_LEVEL);
|
||||
|
||||
AFD_DbgPrint(MAX_TRACE,("Called on %x, attempting to lock\n", FCB));
|
||||
|
||||
|
@ -218,7 +218,7 @@ VOID SocketStateUnlock( PAFD_FCB FCB ) {
|
|||
PVOID CurrentThread = KeGetCurrentThread();
|
||||
#endif
|
||||
ASSERT(FCB->LockCount > 0);
|
||||
ASSERT(KeGetCurrentIrql() == PASSIVE_LEVEL);
|
||||
ASSERT(KeGetCurrentIrql() <= APC_LEVEL);
|
||||
|
||||
ExAcquireFastMutex( &FCB->Mutex );
|
||||
FCB->LockCount--;
|
||||
|
|
|
@ -210,8 +210,12 @@ VOID DestroySocket( PAFD_FCB FCB ) {
|
|||
ExFreePool( FCB->LocalAddress );
|
||||
if( FCB->RemoteAddress )
|
||||
ExFreePool( FCB->RemoteAddress );
|
||||
|
||||
ExFreePool(FCB->TdiDeviceName.Buffer);
|
||||
if( FCB->ListenIrp.ConnectionReturnInfo )
|
||||
ExFreePool( FCB->ListenIrp.ConnectionReturnInfo );
|
||||
if( FCB->ListenIrp.ConnectionCallInfo )
|
||||
ExFreePool( FCB->ListenIrp.ConnectionCallInfo );
|
||||
if( FCB->TdiDeviceName.Buffer )
|
||||
ExFreePool(FCB->TdiDeviceName.Buffer);
|
||||
|
||||
ExFreePool(FCB);
|
||||
AFD_DbgPrint(MIN_TRACE,("Deleted (%x)\n", FCB));
|
||||
|
|
|
@ -27,14 +27,14 @@ NTSTATUS IRPFinish( PIRP Irp, NTSTATUS Status ) {
|
|||
UntrackFL( __FILE__, __LINE__, Irp );
|
||||
#endif
|
||||
|
||||
(void)IoSetCancelRoutine( Irp, NULL );
|
||||
Irp->IoStatus.Status = Status;
|
||||
|
||||
if( Status == STATUS_PENDING )
|
||||
IoMarkIrpPending( Irp );
|
||||
else {
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irql = KeGetCurrentIrql();
|
||||
|
||||
(void)IoSetCancelRoutine( Irp, NULL );
|
||||
IoCompleteRequest( Irp, IO_NETWORK_INCREMENT );
|
||||
if (KeGetCurrentIrql() != Irql) {
|
||||
DbgPrint("WARNING: IO COMPLETION RETURNED AT WRONG IRQL:\n");
|
||||
|
|
Loading…
Reference in a new issue