mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 07:22:58 +00:00
- Merge aicom-network-fixes up to r36884
svn path=/trunk/; revision=36885
This commit is contained in:
parent
154df420fc
commit
e992027f42
1 changed files with 86 additions and 35 deletions
|
@ -50,7 +50,7 @@ NTSTATUS DispPrepareIrpForCancel(
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_IRP, ("Leaving (IRP was already cancelled).\n"));
|
TI_DbgPrint(DEBUG_IRP, ("Leaving (IRP was already cancelled).\n"));
|
||||||
|
|
||||||
return IRPFinish(Irp, STATUS_CANCELLED);
|
return Irp->IoStatus.Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID DispDataRequestComplete(
|
VOID DispDataRequestComplete(
|
||||||
|
@ -384,16 +384,20 @@ NTSTATUS DispTdiConnect(
|
||||||
|
|
||||||
/* Get associated connection endpoint file object. Quit if none exists */
|
/* Get associated connection endpoint file object. Quit if none exists */
|
||||||
|
|
||||||
|
TcpipRecursiveMutexEnter( &TCPLock, TRUE );
|
||||||
|
|
||||||
TranContext = IrpSp->FileObject->FsContext;
|
TranContext = IrpSp->FileObject->FsContext;
|
||||||
if (!TranContext) {
|
if (!TranContext) {
|
||||||
TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
|
TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
|
||||||
return STATUS_INVALID_CONNECTION;
|
Status = STATUS_INVALID_CONNECTION;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
Connection = (PCONNECTION_ENDPOINT)TranContext->Handle.ConnectionContext;
|
Connection = (PCONNECTION_ENDPOINT)TranContext->Handle.ConnectionContext;
|
||||||
if (!Connection) {
|
if (!Connection) {
|
||||||
TI_DbgPrint(MID_TRACE, ("No connection endpoint file object.\n"));
|
TI_DbgPrint(MID_TRACE, ("No connection endpoint file object.\n"));
|
||||||
return STATUS_INVALID_CONNECTION;
|
Status = STATUS_INVALID_CONNECTION;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
Parameters = (PTDI_REQUEST_KERNEL)&IrpSp->Parameters;
|
Parameters = (PTDI_REQUEST_KERNEL)&IrpSp->Parameters;
|
||||||
|
@ -405,6 +409,14 @@ NTSTATUS DispTdiConnect(
|
||||||
DispDataRequestComplete,
|
DispDataRequestComplete,
|
||||||
Irp );
|
Irp );
|
||||||
|
|
||||||
|
done:
|
||||||
|
if (Status != STATUS_PENDING) {
|
||||||
|
DispDataRequestComplete(Irp, Status, 0);
|
||||||
|
} else
|
||||||
|
IoMarkIrpPending(Irp);
|
||||||
|
|
||||||
|
TcpipRecursiveMutexLeave( &TCPLock );
|
||||||
|
|
||||||
TI_DbgPrint(MAX_TRACE, ("TCP Connect returned %08x\n", Status));
|
TI_DbgPrint(MAX_TRACE, ("TCP Connect returned %08x\n", Status));
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -523,18 +535,22 @@ NTSTATUS DispTdiListen(
|
||||||
|
|
||||||
/* Get associated connection endpoint file object. Quit if none exists */
|
/* Get associated connection endpoint file object. Quit if none exists */
|
||||||
|
|
||||||
|
TcpipRecursiveMutexEnter( &TCPLock, TRUE );
|
||||||
|
|
||||||
TranContext = IrpSp->FileObject->FsContext;
|
TranContext = IrpSp->FileObject->FsContext;
|
||||||
if (TranContext == NULL)
|
if (TranContext == NULL)
|
||||||
{
|
{
|
||||||
TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
|
TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
|
||||||
return STATUS_INVALID_CONNECTION;
|
Status = STATUS_INVALID_CONNECTION;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
Connection = (PCONNECTION_ENDPOINT)TranContext->Handle.ConnectionContext;
|
Connection = (PCONNECTION_ENDPOINT)TranContext->Handle.ConnectionContext;
|
||||||
if (Connection == NULL)
|
if (Connection == NULL)
|
||||||
{
|
{
|
||||||
TI_DbgPrint(MID_TRACE, ("No connection endpoint file object.\n"));
|
TI_DbgPrint(MID_TRACE, ("No connection endpoint file object.\n"));
|
||||||
return STATUS_INVALID_CONNECTION;
|
Status = STATUS_INVALID_CONNECTION;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
Parameters = (PTDI_REQUEST_KERNEL)&IrpSp->Parameters;
|
Parameters = (PTDI_REQUEST_KERNEL)&IrpSp->Parameters;
|
||||||
|
@ -588,6 +604,14 @@ NTSTATUS DispTdiListen(
|
||||||
Irp );
|
Irp );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
if (Status != STATUS_PENDING) {
|
||||||
|
DispDataRequestComplete(Irp, Status, 0);
|
||||||
|
} else
|
||||||
|
IoMarkIrpPending(Irp);
|
||||||
|
|
||||||
|
TcpipRecursiveMutexLeave( &TCPLock );
|
||||||
|
|
||||||
TI_DbgPrint(MID_TRACE,("Leaving %x\n", Status));
|
TI_DbgPrint(MID_TRACE,("Leaving %x\n", Status));
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -738,17 +762,21 @@ NTSTATUS DispTdiReceive(
|
||||||
IrpSp = IoGetCurrentIrpStackLocation(Irp);
|
IrpSp = IoGetCurrentIrpStackLocation(Irp);
|
||||||
ReceiveInfo = (PTDI_REQUEST_KERNEL_RECEIVE)&(IrpSp->Parameters);
|
ReceiveInfo = (PTDI_REQUEST_KERNEL_RECEIVE)&(IrpSp->Parameters);
|
||||||
|
|
||||||
|
TcpipRecursiveMutexEnter( &TCPLock, TRUE );
|
||||||
|
|
||||||
TranContext = IrpSp->FileObject->FsContext;
|
TranContext = IrpSp->FileObject->FsContext;
|
||||||
if (TranContext == NULL)
|
if (TranContext == NULL)
|
||||||
{
|
{
|
||||||
TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
|
TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
|
||||||
return STATUS_INVALID_CONNECTION;
|
Status = STATUS_INVALID_CONNECTION;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TranContext->Handle.ConnectionContext == NULL)
|
if (TranContext->Handle.ConnectionContext == NULL)
|
||||||
{
|
{
|
||||||
TI_DbgPrint(MID_TRACE, ("No connection endpoint file object.\n"));
|
TI_DbgPrint(MID_TRACE, ("No connection endpoint file object.\n"));
|
||||||
return STATUS_INVALID_CONNECTION;
|
Status = STATUS_INVALID_CONNECTION;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize a receive request */
|
/* Initialize a receive request */
|
||||||
|
@ -760,9 +788,6 @@ NTSTATUS DispTdiReceive(
|
||||||
TI_DbgPrint(MID_TRACE,("TCPIP<<< Got an MDL: %x\n", Irp->MdlAddress));
|
TI_DbgPrint(MID_TRACE,("TCPIP<<< Got an MDL: %x\n", Irp->MdlAddress));
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* Lock here so we're sure we've got the following 'mark pending' */
|
|
||||||
TcpipRecursiveMutexEnter( &TCPLock, TRUE );
|
|
||||||
|
|
||||||
Status = TCPReceiveData(
|
Status = TCPReceiveData(
|
||||||
TranContext->Handle.ConnectionContext,
|
TranContext->Handle.ConnectionContext,
|
||||||
(PNDIS_BUFFER)Irp->MdlAddress,
|
(PNDIS_BUFFER)Irp->MdlAddress,
|
||||||
|
@ -771,16 +796,16 @@ NTSTATUS DispTdiReceive(
|
||||||
ReceiveInfo->ReceiveFlags,
|
ReceiveInfo->ReceiveFlags,
|
||||||
DispDataRequestComplete,
|
DispDataRequestComplete,
|
||||||
Irp);
|
Irp);
|
||||||
if (Status != STATUS_PENDING)
|
|
||||||
{
|
|
||||||
DispDataRequestComplete(Irp, Status, BytesReceived);
|
|
||||||
} else {
|
|
||||||
IoMarkIrpPending(Irp);
|
|
||||||
}
|
|
||||||
|
|
||||||
TcpipRecursiveMutexLeave( &TCPLock );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
if (Status != STATUS_PENDING) {
|
||||||
|
DispDataRequestComplete(Irp, Status, BytesReceived);
|
||||||
|
} else
|
||||||
|
IoMarkIrpPending(Irp);
|
||||||
|
|
||||||
|
TcpipRecursiveMutexLeave( &TCPLock );
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_IRP, ("Leaving. Status is (0x%X)\n", Status));
|
TI_DbgPrint(DEBUG_IRP, ("Leaving. Status is (0x%X)\n", Status));
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -809,11 +834,14 @@ NTSTATUS DispTdiReceiveDatagram(
|
||||||
IrpSp = IoGetCurrentIrpStackLocation(Irp);
|
IrpSp = IoGetCurrentIrpStackLocation(Irp);
|
||||||
DgramInfo = (PTDI_REQUEST_KERNEL_RECEIVEDG)&(IrpSp->Parameters);
|
DgramInfo = (PTDI_REQUEST_KERNEL_RECEIVEDG)&(IrpSp->Parameters);
|
||||||
|
|
||||||
|
TcpipRecursiveMutexEnter( &TCPLock, TRUE );
|
||||||
|
|
||||||
TranContext = IrpSp->FileObject->FsContext;
|
TranContext = IrpSp->FileObject->FsContext;
|
||||||
if (TranContext == NULL)
|
if (TranContext == NULL)
|
||||||
{
|
{
|
||||||
TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
|
TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
|
||||||
return STATUS_INVALID_ADDRESS;
|
Status = STATUS_INVALID_CONNECTION;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize a receive request */
|
/* Initialize a receive request */
|
||||||
|
@ -846,12 +874,16 @@ NTSTATUS DispTdiReceiveDatagram(
|
||||||
(PDATAGRAM_COMPLETION_ROUTINE)DispDataRequestComplete,
|
(PDATAGRAM_COMPLETION_ROUTINE)DispDataRequestComplete,
|
||||||
Irp,
|
Irp,
|
||||||
Irp);
|
Irp);
|
||||||
if (Status != STATUS_PENDING) {
|
|
||||||
DispDataRequestComplete(Irp, Status, BytesReceived);
|
|
||||||
} else
|
|
||||||
IoMarkIrpPending(Irp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
if (Status != STATUS_PENDING) {
|
||||||
|
DispDataRequestComplete(Irp, Status, BytesReceived);
|
||||||
|
} else
|
||||||
|
IoMarkIrpPending(Irp);
|
||||||
|
|
||||||
|
TcpipRecursiveMutexLeave( &TCPLock );
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_IRP, ("Leaving. Status is (0x%X)\n", Status));
|
TI_DbgPrint(DEBUG_IRP, ("Leaving. Status is (0x%X)\n", Status));
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -879,17 +911,21 @@ NTSTATUS DispTdiSend(
|
||||||
IrpSp = IoGetCurrentIrpStackLocation(Irp);
|
IrpSp = IoGetCurrentIrpStackLocation(Irp);
|
||||||
SendInfo = (PTDI_REQUEST_KERNEL_SEND)&(IrpSp->Parameters);
|
SendInfo = (PTDI_REQUEST_KERNEL_SEND)&(IrpSp->Parameters);
|
||||||
|
|
||||||
|
TcpipRecursiveMutexEnter( &TCPLock, TRUE );
|
||||||
|
|
||||||
TranContext = IrpSp->FileObject->FsContext;
|
TranContext = IrpSp->FileObject->FsContext;
|
||||||
if (TranContext == NULL)
|
if (TranContext == NULL)
|
||||||
{
|
{
|
||||||
TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
|
TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
|
||||||
return STATUS_INVALID_CONNECTION;
|
Status = STATUS_INVALID_CONNECTION;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TranContext->Handle.ConnectionContext == NULL)
|
if (TranContext->Handle.ConnectionContext == NULL)
|
||||||
{
|
{
|
||||||
TI_DbgPrint(MID_TRACE, ("No connection endpoint file object.\n"));
|
TI_DbgPrint(MID_TRACE, ("No connection endpoint file object.\n"));
|
||||||
return STATUS_INVALID_CONNECTION;
|
Status = STATUS_INVALID_CONNECTION;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = DispPrepareIrpForCancel(
|
Status = DispPrepareIrpForCancel(
|
||||||
|
@ -914,13 +950,16 @@ NTSTATUS DispTdiSend(
|
||||||
SendInfo->SendFlags,
|
SendInfo->SendFlags,
|
||||||
DispDataRequestComplete,
|
DispDataRequestComplete,
|
||||||
Irp);
|
Irp);
|
||||||
if (Status != STATUS_PENDING)
|
|
||||||
{
|
|
||||||
DispDataRequestComplete(Irp, Status, BytesSent);
|
|
||||||
} else
|
|
||||||
IoMarkIrpPending( Irp );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
if (Status != STATUS_PENDING) {
|
||||||
|
DispDataRequestComplete(Irp, Status, BytesSent);
|
||||||
|
} else
|
||||||
|
IoMarkIrpPending(Irp);
|
||||||
|
|
||||||
|
TcpipRecursiveMutexLeave( &TCPLock );
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_IRP, ("Leaving. Status is (0x%X)\n", Status));
|
TI_DbgPrint(DEBUG_IRP, ("Leaving. Status is (0x%X)\n", Status));
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -947,7 +986,16 @@ NTSTATUS DispTdiSendDatagram(
|
||||||
|
|
||||||
IrpSp = IoGetCurrentIrpStackLocation(Irp);
|
IrpSp = IoGetCurrentIrpStackLocation(Irp);
|
||||||
DgramInfo = (PTDI_REQUEST_KERNEL_SENDDG)&(IrpSp->Parameters);
|
DgramInfo = (PTDI_REQUEST_KERNEL_SENDDG)&(IrpSp->Parameters);
|
||||||
|
|
||||||
|
TcpipRecursiveMutexEnter( &TCPLock, TRUE );
|
||||||
|
|
||||||
TranContext = IrpSp->FileObject->FsContext;
|
TranContext = IrpSp->FileObject->FsContext;
|
||||||
|
if (TranContext == NULL)
|
||||||
|
{
|
||||||
|
TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
|
||||||
|
Status = STATUS_INVALID_CONNECTION;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize a send request */
|
/* Initialize a send request */
|
||||||
Request.Handle.AddressHandle = TranContext->Handle.AddressHandle;
|
Request.Handle.AddressHandle = TranContext->Handle.AddressHandle;
|
||||||
|
@ -984,13 +1032,16 @@ NTSTATUS DispTdiSendDatagram(
|
||||||
&Irp->IoStatus.Information);
|
&Irp->IoStatus.Information);
|
||||||
else
|
else
|
||||||
Status = STATUS_UNSUCCESSFUL;
|
Status = STATUS_UNSUCCESSFUL;
|
||||||
|
|
||||||
if (Status != STATUS_PENDING) {
|
|
||||||
DispDataRequestComplete(Irp, Status, Irp->IoStatus.Information);
|
|
||||||
} else
|
|
||||||
IoMarkIrpPending( Irp );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
if (Status != STATUS_PENDING) {
|
||||||
|
DispDataRequestComplete(Irp, Status, Irp->IoStatus.Information);
|
||||||
|
} else
|
||||||
|
IoMarkIrpPending(Irp);
|
||||||
|
|
||||||
|
TcpipRecursiveMutexLeave( &TCPLock );
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_IRP, ("Leaving.\n"));
|
TI_DbgPrint(DEBUG_IRP, ("Leaving.\n"));
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue