mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 07:43:12 +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
|
NTSTATUS STDCALL
|
||||||
AfdSetContext( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
AfdSetContext( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||||
PIO_STACK_LOCATION IrpSp ) {
|
PIO_STACK_LOCATION IrpSp ) {
|
||||||
NTSTATUS Status = STATUS_NO_MEMORY;
|
NTSTATUS Status = STATUS_BUFFER_TOO_SMALL;
|
||||||
PFILE_OBJECT FileObject = IrpSp->FileObject;
|
PFILE_OBJECT FileObject = IrpSp->FileObject;
|
||||||
PAFD_FCB FCB = FileObject->FsContext;
|
PAFD_FCB FCB = FileObject->FsContext;
|
||||||
|
|
||||||
if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
|
if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
|
||||||
|
|
||||||
|
if( FCB->Context ) {
|
||||||
|
ExFreePool( FCB->Context );
|
||||||
|
FCB->Context = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if( FCB->ContextSize <
|
if( FCB->ContextSize <
|
||||||
IrpSp->Parameters.DeviceIoControl.InputBufferLength ) {
|
IrpSp->Parameters.DeviceIoControl.InputBufferLength ) {
|
||||||
if( FCB->Context )
|
|
||||||
ExFreePool( FCB->Context );
|
|
||||||
FCB->Context =
|
FCB->Context =
|
||||||
ExAllocatePool
|
ExAllocatePool
|
||||||
( PagedPool,
|
( PagedPool,
|
||||||
IrpSp->Parameters.DeviceIoControl.InputBufferLength );
|
IrpSp->Parameters.DeviceIoControl.InputBufferLength );
|
||||||
}
|
|
||||||
|
|
||||||
if( FCB->Context ) {
|
if( !FCB->Context ) return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0, NULL );
|
||||||
Status = STATUS_SUCCESS;
|
|
||||||
RtlCopyMemory( FCB->Context,
|
RtlCopyMemory( FCB->Context,
|
||||||
IrpSp->Parameters.DeviceIoControl.Type3InputBuffer,
|
IrpSp->Parameters.DeviceIoControl.Type3InputBuffer,
|
||||||
IrpSp->Parameters.DeviceIoControl.InputBufferLength );
|
IrpSp->Parameters.DeviceIoControl.InputBufferLength );
|
||||||
|
Status = STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
|
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,
|
AFD_DbgPrint(MID_TRACE,("Called %x %x\n", InfoReq,
|
||||||
InfoReq ? InfoReq->InformationClass : 0));
|
InfoReq ? InfoReq->InformationClass : 0));
|
||||||
|
|
||||||
_SEH_TRY {
|
if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
|
||||||
if( !SocketAcquireStateLock( FCB ) ) {
|
|
||||||
Status = LostSocket( Irp );
|
|
||||||
_SEH_YIELD(return Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
_SEH_TRY {
|
||||||
switch( InfoReq->InformationClass ) {
|
switch( InfoReq->InformationClass ) {
|
||||||
case AFD_INFO_RECEIVE_WINDOW_SIZE:
|
case AFD_INFO_RECEIVE_WINDOW_SIZE:
|
||||||
InfoReq->Information.Ulong = FCB->Recv.Size;
|
InfoReq->Information.Ulong = FCB->Recv.Size;
|
||||||
|
@ -113,7 +110,7 @@ AfdGetSockOrPeerName( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||||
TDI_QUERY_ADDRESS_INFO,
|
TDI_QUERY_ADDRESS_INFO,
|
||||||
Mdl );
|
Mdl );
|
||||||
} else {
|
} else {
|
||||||
if( !NT_SUCCESS
|
if( NT_SUCCESS
|
||||||
( Status = TdiBuildNullConnectionInfo
|
( Status = TdiBuildNullConnectionInfo
|
||||||
( &ConnInfo,
|
( &ConnInfo,
|
||||||
FCB->LocalAddress->Address[0].AddressType ) ) ) {
|
FCB->LocalAddress->Address[0].AddressType ) ) ) {
|
||||||
|
@ -148,11 +145,11 @@ AfdGetSockOrPeerName( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||||
|
|
||||||
if( ConnInfo ) ExFreePool( ConnInfo );
|
if( ConnInfo ) ExFreePool( ConnInfo );
|
||||||
if( SysMdl ) IoFreeMdl( SysMdl );
|
if( SysMdl ) IoFreeMdl( SysMdl );
|
||||||
|
if( TransAddr ) MmUnmapLockedPages( TransAddr, Mdl );
|
||||||
}
|
}
|
||||||
|
/* MmUnlockPages( Mdl ); */
|
||||||
}
|
}
|
||||||
|
/* IoFreeMdl( Mdl ); */
|
||||||
/* MmUnlockPages( Mdl ); */
|
|
||||||
/* IoFreeMdl( Mdl ); */
|
|
||||||
} else {
|
} else {
|
||||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
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 );
|
if( !NT_SUCCESS(Status) ) return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
|
||||||
|
|
||||||
FCB->State = SOCKET_STATE_LISTENING;
|
|
||||||
|
|
||||||
TdiBuildNullConnectionInfo
|
TdiBuildNullConnectionInfo
|
||||||
( &FCB->ListenIrp.ConnectionCallInfo,
|
( &FCB->ListenIrp.ConnectionCallInfo,
|
||||||
FCB->LocalAddress->Address[0].AddressType );
|
FCB->LocalAddress->Address[0].AddressType );
|
||||||
|
@ -197,6 +195,11 @@ NTSTATUS AfdListenSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||||
( &FCB->ListenIrp.ConnectionReturnInfo,
|
( &FCB->ListenIrp.ConnectionReturnInfo,
|
||||||
FCB->LocalAddress->Address[0].AddressType );
|
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,
|
Status = TdiListen( &FCB->ListenIrp.InFlightRequest,
|
||||||
FCB->Connection.Object,
|
FCB->Connection.Object,
|
||||||
&FCB->ListenIrp.ConnectionCallInfo,
|
&FCB->ListenIrp.ConnectionCallInfo,
|
||||||
|
@ -272,6 +275,8 @@ NTSTATUS AfdAccept( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||||
( &FCB->ListenIrp.ConnectionReturnInfo,
|
( &FCB->ListenIrp.ConnectionReturnInfo,
|
||||||
FCB->LocalAddress->Address[0].AddressType );
|
FCB->LocalAddress->Address[0].AddressType );
|
||||||
|
|
||||||
|
if( !FCB->ListenIrp.ConnectionReturnInfo ) return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0, NULL );
|
||||||
|
|
||||||
Status = TdiListen( &FCB->ListenIrp.InFlightRequest,
|
Status = TdiListen( &FCB->ListenIrp.InFlightRequest,
|
||||||
FCB->Connection.Object,
|
FCB->Connection.Object,
|
||||||
&FCB->ListenIrp.ConnectionCallInfo,
|
&FCB->ListenIrp.ConnectionCallInfo,
|
||||||
|
@ -306,6 +311,8 @@ NTSTATUS AfdAccept( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||||
(PVOID *)&NewFileObject,
|
(PVOID *)&NewFileObject,
|
||||||
NULL );
|
NULL );
|
||||||
|
|
||||||
|
if( !NT_SUCCESS(Status) ) UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
|
||||||
|
|
||||||
ASSERT(NewFileObject != FileObject);
|
ASSERT(NewFileObject != FileObject);
|
||||||
ASSERT(NewFileObject->FsContext != FCB);
|
ASSERT(NewFileObject->FsContext != FCB);
|
||||||
|
|
||||||
|
|
|
@ -167,7 +167,7 @@ UINT SocketAcquireStateLock( PAFD_FCB FCB ) {
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
PVOID CurrentThread = KeGetCurrentThread();
|
PVOID CurrentThread = KeGetCurrentThread();
|
||||||
|
|
||||||
ASSERT(KeGetCurrentIrql() == PASSIVE_LEVEL);
|
ASSERT(KeGetCurrentIrql() <= APC_LEVEL);
|
||||||
|
|
||||||
AFD_DbgPrint(MAX_TRACE,("Called on %x, attempting to lock\n", FCB));
|
AFD_DbgPrint(MAX_TRACE,("Called on %x, attempting to lock\n", FCB));
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ VOID SocketStateUnlock( PAFD_FCB FCB ) {
|
||||||
PVOID CurrentThread = KeGetCurrentThread();
|
PVOID CurrentThread = KeGetCurrentThread();
|
||||||
#endif
|
#endif
|
||||||
ASSERT(FCB->LockCount > 0);
|
ASSERT(FCB->LockCount > 0);
|
||||||
ASSERT(KeGetCurrentIrql() == PASSIVE_LEVEL);
|
ASSERT(KeGetCurrentIrql() <= APC_LEVEL);
|
||||||
|
|
||||||
ExAcquireFastMutex( &FCB->Mutex );
|
ExAcquireFastMutex( &FCB->Mutex );
|
||||||
FCB->LockCount--;
|
FCB->LockCount--;
|
||||||
|
|
|
@ -210,8 +210,12 @@ VOID DestroySocket( PAFD_FCB FCB ) {
|
||||||
ExFreePool( FCB->LocalAddress );
|
ExFreePool( FCB->LocalAddress );
|
||||||
if( FCB->RemoteAddress )
|
if( FCB->RemoteAddress )
|
||||||
ExFreePool( FCB->RemoteAddress );
|
ExFreePool( FCB->RemoteAddress );
|
||||||
|
if( FCB->ListenIrp.ConnectionReturnInfo )
|
||||||
ExFreePool(FCB->TdiDeviceName.Buffer);
|
ExFreePool( FCB->ListenIrp.ConnectionReturnInfo );
|
||||||
|
if( FCB->ListenIrp.ConnectionCallInfo )
|
||||||
|
ExFreePool( FCB->ListenIrp.ConnectionCallInfo );
|
||||||
|
if( FCB->TdiDeviceName.Buffer )
|
||||||
|
ExFreePool(FCB->TdiDeviceName.Buffer);
|
||||||
|
|
||||||
ExFreePool(FCB);
|
ExFreePool(FCB);
|
||||||
AFD_DbgPrint(MIN_TRACE,("Deleted (%x)\n", FCB));
|
AFD_DbgPrint(MIN_TRACE,("Deleted (%x)\n", FCB));
|
||||||
|
|
|
@ -27,14 +27,14 @@ NTSTATUS IRPFinish( PIRP Irp, NTSTATUS Status ) {
|
||||||
UntrackFL( __FILE__, __LINE__, Irp );
|
UntrackFL( __FILE__, __LINE__, Irp );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
(void)IoSetCancelRoutine( Irp, NULL );
|
Irp->IoStatus.Status = Status;
|
||||||
|
|
||||||
if( Status == STATUS_PENDING )
|
if( Status == STATUS_PENDING )
|
||||||
IoMarkIrpPending( Irp );
|
IoMarkIrpPending( Irp );
|
||||||
else {
|
else {
|
||||||
Irp->IoStatus.Status = Status;
|
|
||||||
Irql = KeGetCurrentIrql();
|
Irql = KeGetCurrentIrql();
|
||||||
|
|
||||||
|
(void)IoSetCancelRoutine( Irp, NULL );
|
||||||
IoCompleteRequest( Irp, IO_NETWORK_INCREMENT );
|
IoCompleteRequest( Irp, IO_NETWORK_INCREMENT );
|
||||||
if (KeGetCurrentIrql() != Irql) {
|
if (KeGetCurrentIrql() != Irql) {
|
||||||
DbgPrint("WARNING: IO COMPLETION RETURNED AT WRONG IRQL:\n");
|
DbgPrint("WARNING: IO COMPLETION RETURNED AT WRONG IRQL:\n");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue