mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 13:35:47 +00:00
- Merge r45400 from aicom-network-branch to fix the crash that occurs when Steam starts
svn path=/trunk/; revision=45404
This commit is contained in:
parent
09504f4242
commit
4f21767b6a
6 changed files with 66 additions and 61 deletions
|
@ -71,15 +71,16 @@ AfdBindSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
FCB->LocalAddress = TaCopyTransportAddress( &BindReq->Address );
|
||||
|
||||
if( FCB->LocalAddress )
|
||||
TdiBuildConnectionInfo( &FCB->AddressFrom,
|
||||
FCB->LocalAddress );
|
||||
Status = TdiBuildConnectionInfo( &FCB->AddressFrom,
|
||||
FCB->LocalAddress );
|
||||
|
||||
if( FCB->AddressFrom )
|
||||
if( NT_SUCCESS(Status) )
|
||||
Status = WarmSocketForBind( FCB );
|
||||
else return UnlockAndMaybeComplete(FCB, STATUS_NO_MEMORY, Irp, 0);
|
||||
|
||||
AFD_DbgPrint(MID_TRACE,("FCB->Flags %x\n", FCB->Flags));
|
||||
|
||||
if( !NT_SUCCESS(Status) )
|
||||
return UnlockAndMaybeComplete(FCB, Status, Irp, 0);
|
||||
|
||||
if( FCB->Flags & AFD_ENDPOINT_CONNECTIONLESS ) {
|
||||
AFD_DbgPrint(MID_TRACE,("Calling TdiReceiveDatagram\n"));
|
||||
|
||||
|
|
|
@ -423,16 +423,17 @@ AfdStreamSocketConnect(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
if( !NT_SUCCESS(Status) )
|
||||
break;
|
||||
|
||||
TdiBuildConnectionInfo
|
||||
Status = TdiBuildConnectionInfo
|
||||
( &FCB->ConnectInfo,
|
||||
&ConnectReq->RemoteAddress );
|
||||
|
||||
if( FCB->ConnectInfo )
|
||||
TdiBuildConnectionInfo(&TargetAddress,
|
||||
&ConnectReq->RemoteAddress);
|
||||
if( NT_SUCCESS(Status) )
|
||||
Status = TdiBuildConnectionInfo(&TargetAddress,
|
||||
&ConnectReq->RemoteAddress);
|
||||
else break;
|
||||
|
||||
|
||||
if( TargetAddress ) {
|
||||
if( NT_SUCCESS(Status) ) {
|
||||
TargetAddress->UserData = FCB->ConnectData;
|
||||
TargetAddress->UserDataLength = FCB->ConnectDataSize;
|
||||
TargetAddress->Options = FCB->ConnectOptions;
|
||||
|
@ -454,7 +455,7 @@ AfdStreamSocketConnect(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
FCB->State = SOCKET_STATE_CONNECTING;
|
||||
return LeaveIrpUntilLater( FCB, Irp, FUNCTION_CONNECT );
|
||||
}
|
||||
} else Status = STATUS_NO_MEMORY;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -156,13 +156,13 @@ static NTSTATUS NTAPI ListenComplete
|
|||
FCB->ListenIrp.
|
||||
ConnectionReturnInfo->RemoteAddress));
|
||||
|
||||
TdiBuildNullConnectionInfo( &Qelt->ConnInfo, AddressType );
|
||||
if( Qelt->ConnInfo ) {
|
||||
Status = TdiBuildNullConnectionInfo( &Qelt->ConnInfo, AddressType );
|
||||
if( NT_SUCCESS(Status) ) {
|
||||
TaCopyTransportAddressInPlace
|
||||
( Qelt->ConnInfo->RemoteAddress,
|
||||
FCB->ListenIrp.ConnectionReturnInfo->RemoteAddress );
|
||||
InsertTailList( &FCB->PendingConnections, &Qelt->ListEntry );
|
||||
} else Status = STATUS_NO_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
/* Satisfy a pre-accept request if one is available */
|
||||
|
@ -235,28 +235,21 @@ NTSTATUS AfdListenSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
|
||||
if( !NT_SUCCESS(Status) ) return UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
|
||||
|
||||
TdiBuildNullConnectionInfo
|
||||
Status = TdiBuildNullConnectionInfo
|
||||
( &FCB->ListenIrp.ConnectionCallInfo,
|
||||
FCB->LocalAddress->Address[0].AddressType );
|
||||
TdiBuildNullConnectionInfo
|
||||
|
||||
if (!NT_SUCCESS(Status)) return UnlockAndMaybeComplete(FCB, Status, Irp, 0);
|
||||
|
||||
Status = TdiBuildNullConnectionInfo
|
||||
( &FCB->ListenIrp.ConnectionReturnInfo,
|
||||
FCB->LocalAddress->Address[0].AddressType );
|
||||
|
||||
if( !FCB->ListenIrp.ConnectionReturnInfo || !FCB->ListenIrp.ConnectionCallInfo )
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
if (FCB->ListenIrp.ConnectionReturnInfo)
|
||||
{
|
||||
ExFreePool(FCB->ListenIrp.ConnectionReturnInfo);
|
||||
FCB->ListenIrp.ConnectionReturnInfo = NULL;
|
||||
}
|
||||
|
||||
if (FCB->ListenIrp.ConnectionCallInfo)
|
||||
{
|
||||
ExFreePool(FCB->ListenIrp.ConnectionCallInfo);
|
||||
FCB->ListenIrp.ConnectionCallInfo = NULL;
|
||||
}
|
||||
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0 );
|
||||
ExFreePool(FCB->ListenIrp.ConnectionCallInfo);
|
||||
FCB->ListenIrp.ConnectionCallInfo = NULL;
|
||||
return UnlockAndMaybeComplete(FCB, Status, Irp, 0);
|
||||
}
|
||||
|
||||
FCB->State = SOCKET_STATE_LISTENING;
|
||||
|
@ -337,29 +330,22 @@ NTSTATUS AfdAccept( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
Status = WarmSocketForConnection( FCB );
|
||||
|
||||
if( Status == STATUS_SUCCESS ) {
|
||||
TdiBuildNullConnectionInfo
|
||||
( &FCB->ListenIrp.ConnectionCallInfo,
|
||||
FCB->LocalAddress->Address[0].AddressType );
|
||||
TdiBuildNullConnectionInfo
|
||||
( &FCB->ListenIrp.ConnectionReturnInfo,
|
||||
FCB->LocalAddress->Address[0].AddressType );
|
||||
Status = TdiBuildNullConnectionInfo
|
||||
( &FCB->ListenIrp.ConnectionCallInfo,
|
||||
FCB->LocalAddress->Address[0].AddressType );
|
||||
|
||||
if( !FCB->ListenIrp.ConnectionReturnInfo || !FCB->ListenIrp.ConnectionCallInfo )
|
||||
{
|
||||
if (FCB->ListenIrp.ConnectionReturnInfo)
|
||||
{
|
||||
ExFreePool(FCB->ListenIrp.ConnectionReturnInfo);
|
||||
FCB->ListenIrp.ConnectionReturnInfo = NULL;
|
||||
}
|
||||
if (!NT_SUCCESS(Status)) return UnlockAndMaybeComplete(FCB, Status, Irp, 0);
|
||||
|
||||
if (FCB->ListenIrp.ConnectionCallInfo)
|
||||
{
|
||||
ExFreePool(FCB->ListenIrp.ConnectionCallInfo);
|
||||
FCB->ListenIrp.ConnectionCallInfo = NULL;
|
||||
}
|
||||
Status = TdiBuildNullConnectionInfo
|
||||
( &FCB->ListenIrp.ConnectionReturnInfo,
|
||||
FCB->LocalAddress->Address[0].AddressType );
|
||||
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0 );
|
||||
}
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ExFreePool(FCB->ListenIrp.ConnectionCallInfo);
|
||||
FCB->ListenIrp.ConnectionCallInfo = NULL;
|
||||
return UnlockAndMaybeComplete(FCB, Status, Irp, 0);
|
||||
}
|
||||
|
||||
Status = TdiListen( &FCB->ListenIrp.InFlightRequest,
|
||||
FCB->Connection.Object,
|
||||
|
|
|
@ -498,7 +498,7 @@ AfdDisconnect(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
( &ConnectionReturnInfo, FCB->RemoteAddress->Address[0].AddressType );
|
||||
|
||||
if( !NT_SUCCESS(Status) )
|
||||
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY,
|
||||
return UnlockAndMaybeComplete( FCB, Status,
|
||||
Irp, 0 );
|
||||
|
||||
if( DisReq->DisconnectType & AFD_DISCONNECT_SEND )
|
||||
|
|
|
@ -14,13 +14,21 @@
|
|||
|
||||
UINT TdiAddressSizeFromType( UINT AddressType ) {
|
||||
switch( AddressType ) {
|
||||
case AF_INET:
|
||||
case TDI_ADDRESS_TYPE_IP:
|
||||
return sizeof(TA_IP_ADDRESS);
|
||||
case TDI_ADDRESS_TYPE_APPLETALK:
|
||||
return sizeof(TA_APPLETALK_ADDRESS);
|
||||
case TDI_ADDRESS_TYPE_NETBIOS:
|
||||
return sizeof(TA_NETBIOS_ADDRESS);
|
||||
/* case TDI_ADDRESS_TYPE_NS: */
|
||||
case TDI_ADDRESS_TYPE_IPX:
|
||||
return sizeof(TA_IPX_ADDRESS);
|
||||
case TDI_ADDRESS_TYPE_VNS:
|
||||
return sizeof(TA_VNS_ADDRESS);
|
||||
default:
|
||||
AFD_DbgPrint(MID_TRACE,("TdiAddressSizeFromType - invalid type: %x\n", AddressType));
|
||||
KeBugCheck( 0 );
|
||||
DbgPrint("TdiAddressSizeFromType - invalid type: %x\n", AddressType);
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
UINT TaLengthOfAddress( PTA_ADDRESS Addr ) {
|
||||
|
@ -85,6 +93,8 @@ static NTSTATUS TdiBuildNullConnectionInfoInPlace
|
|||
PTRANSPORT_ADDRESS TransportAddress;
|
||||
|
||||
TdiAddressSize = TdiAddressSizeFromType(Type);
|
||||
if (!TdiAddressSize)
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
|
||||
RtlZeroMemory(ConnInfo,
|
||||
sizeof(TDI_CONNECTION_INFORMATION) +
|
||||
|
@ -118,6 +128,10 @@ NTSTATUS TdiBuildNullConnectionInfo
|
|||
NTSTATUS Status;
|
||||
|
||||
TdiAddressSize = TdiAddressSizeFromType(Type);
|
||||
if (!TdiAddressSize) {
|
||||
*ConnectionInfo = NULL;
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
ConnInfo = (PTDI_CONNECTION_INFORMATION)
|
||||
ExAllocatePool(NonPagedPool,
|
||||
|
@ -199,6 +213,9 @@ TdiBuildConnectionInfoPair
|
|||
|
||||
/* FIXME: Get from socket information */
|
||||
TdiAddressSize = TdiAddressSizeFromType(From->Address[0].AddressType);
|
||||
if (!TdiAddressSize)
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
|
||||
SizeOfEntry = TdiAddressSize + sizeof(TDI_CONNECTION_INFORMATION);
|
||||
|
||||
LayoutFrame = (PCHAR)ExAllocatePool(NonPagedPool, 2 * SizeOfEntry);
|
||||
|
|
|
@ -247,9 +247,9 @@ AfdConnectedSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
Irp, 0 );
|
||||
}
|
||||
|
||||
TdiBuildConnectionInfo( &TargetAddress, FCB->RemoteAddress );
|
||||
Status = TdiBuildConnectionInfo( &TargetAddress, FCB->RemoteAddress );
|
||||
|
||||
if( TargetAddress ) {
|
||||
if( NT_SUCCESS(Status) ) {
|
||||
Status = TdiSendDatagram
|
||||
( &FCB->SendIrp.InFlightRequest,
|
||||
FCB->AddressFile.Object,
|
||||
|
@ -261,7 +261,7 @@ AfdConnectedSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
FCB );
|
||||
|
||||
ExFreePool( TargetAddress );
|
||||
} else Status = STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
if( Status == STATUS_PENDING ) Status = STATUS_SUCCESS;
|
||||
|
||||
|
@ -419,12 +419,12 @@ AfdPacketSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
((PTRANSPORT_ADDRESS)SendReq->TdiConnection.RemoteAddress)->
|
||||
Address[0].AddressType));
|
||||
|
||||
TdiBuildConnectionInfo( &TargetAddress,
|
||||
Status = TdiBuildConnectionInfo( &TargetAddress,
|
||||
((PTRANSPORT_ADDRESS)SendReq->TdiConnection.RemoteAddress) );
|
||||
|
||||
/* Check the size of the Address given ... */
|
||||
|
||||
if( TargetAddress ) {
|
||||
if( NT_SUCCESS(Status) ) {
|
||||
Status = TdiSendDatagram
|
||||
( &FCB->SendIrp.InFlightRequest,
|
||||
FCB->AddressFile.Object,
|
||||
|
@ -436,7 +436,7 @@ AfdPacketSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
FCB );
|
||||
|
||||
ExFreePool( TargetAddress );
|
||||
} else Status = STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
if( Status == STATUS_PENDING ) Status = STATUS_SUCCESS;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue