mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 17:12:57 +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 );
|
FCB->LocalAddress = TaCopyTransportAddress( &BindReq->Address );
|
||||||
|
|
||||||
if( FCB->LocalAddress )
|
if( FCB->LocalAddress )
|
||||||
TdiBuildConnectionInfo( &FCB->AddressFrom,
|
Status = TdiBuildConnectionInfo( &FCB->AddressFrom,
|
||||||
FCB->LocalAddress );
|
FCB->LocalAddress );
|
||||||
|
|
||||||
if( FCB->AddressFrom )
|
if( NT_SUCCESS(Status) )
|
||||||
Status = WarmSocketForBind( FCB );
|
Status = WarmSocketForBind( FCB );
|
||||||
else return UnlockAndMaybeComplete(FCB, STATUS_NO_MEMORY, Irp, 0);
|
|
||||||
|
|
||||||
AFD_DbgPrint(MID_TRACE,("FCB->Flags %x\n", FCB->Flags));
|
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 ) {
|
if( FCB->Flags & AFD_ENDPOINT_CONNECTIONLESS ) {
|
||||||
AFD_DbgPrint(MID_TRACE,("Calling TdiReceiveDatagram\n"));
|
AFD_DbgPrint(MID_TRACE,("Calling TdiReceiveDatagram\n"));
|
||||||
|
|
||||||
|
|
|
@ -423,16 +423,17 @@ AfdStreamSocketConnect(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||||
if( !NT_SUCCESS(Status) )
|
if( !NT_SUCCESS(Status) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
TdiBuildConnectionInfo
|
Status = TdiBuildConnectionInfo
|
||||||
( &FCB->ConnectInfo,
|
( &FCB->ConnectInfo,
|
||||||
&ConnectReq->RemoteAddress );
|
&ConnectReq->RemoteAddress );
|
||||||
|
|
||||||
if( FCB->ConnectInfo )
|
if( NT_SUCCESS(Status) )
|
||||||
TdiBuildConnectionInfo(&TargetAddress,
|
Status = TdiBuildConnectionInfo(&TargetAddress,
|
||||||
&ConnectReq->RemoteAddress);
|
&ConnectReq->RemoteAddress);
|
||||||
|
else break;
|
||||||
|
|
||||||
|
|
||||||
if( TargetAddress ) {
|
if( NT_SUCCESS(Status) ) {
|
||||||
TargetAddress->UserData = FCB->ConnectData;
|
TargetAddress->UserData = FCB->ConnectData;
|
||||||
TargetAddress->UserDataLength = FCB->ConnectDataSize;
|
TargetAddress->UserDataLength = FCB->ConnectDataSize;
|
||||||
TargetAddress->Options = FCB->ConnectOptions;
|
TargetAddress->Options = FCB->ConnectOptions;
|
||||||
|
@ -454,7 +455,7 @@ AfdStreamSocketConnect(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||||
FCB->State = SOCKET_STATE_CONNECTING;
|
FCB->State = SOCKET_STATE_CONNECTING;
|
||||||
return LeaveIrpUntilLater( FCB, Irp, FUNCTION_CONNECT );
|
return LeaveIrpUntilLater( FCB, Irp, FUNCTION_CONNECT );
|
||||||
}
|
}
|
||||||
} else Status = STATUS_NO_MEMORY;
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -156,13 +156,13 @@ static NTSTATUS NTAPI ListenComplete
|
||||||
FCB->ListenIrp.
|
FCB->ListenIrp.
|
||||||
ConnectionReturnInfo->RemoteAddress));
|
ConnectionReturnInfo->RemoteAddress));
|
||||||
|
|
||||||
TdiBuildNullConnectionInfo( &Qelt->ConnInfo, AddressType );
|
Status = TdiBuildNullConnectionInfo( &Qelt->ConnInfo, AddressType );
|
||||||
if( Qelt->ConnInfo ) {
|
if( NT_SUCCESS(Status) ) {
|
||||||
TaCopyTransportAddressInPlace
|
TaCopyTransportAddressInPlace
|
||||||
( Qelt->ConnInfo->RemoteAddress,
|
( Qelt->ConnInfo->RemoteAddress,
|
||||||
FCB->ListenIrp.ConnectionReturnInfo->RemoteAddress );
|
FCB->ListenIrp.ConnectionReturnInfo->RemoteAddress );
|
||||||
InsertTailList( &FCB->PendingConnections, &Qelt->ListEntry );
|
InsertTailList( &FCB->PendingConnections, &Qelt->ListEntry );
|
||||||
} else Status = STATUS_NO_MEMORY;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Satisfy a pre-accept request if one is available */
|
/* 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 );
|
if( !NT_SUCCESS(Status) ) return UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
|
||||||
|
|
||||||
TdiBuildNullConnectionInfo
|
Status = TdiBuildNullConnectionInfo
|
||||||
( &FCB->ListenIrp.ConnectionCallInfo,
|
( &FCB->ListenIrp.ConnectionCallInfo,
|
||||||
FCB->LocalAddress->Address[0].AddressType );
|
FCB->LocalAddress->Address[0].AddressType );
|
||||||
TdiBuildNullConnectionInfo
|
|
||||||
|
if (!NT_SUCCESS(Status)) return UnlockAndMaybeComplete(FCB, Status, Irp, 0);
|
||||||
|
|
||||||
|
Status = TdiBuildNullConnectionInfo
|
||||||
( &FCB->ListenIrp.ConnectionReturnInfo,
|
( &FCB->ListenIrp.ConnectionReturnInfo,
|
||||||
FCB->LocalAddress->Address[0].AddressType );
|
FCB->LocalAddress->Address[0].AddressType );
|
||||||
|
|
||||||
if( !FCB->ListenIrp.ConnectionReturnInfo || !FCB->ListenIrp.ConnectionCallInfo )
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
if (FCB->ListenIrp.ConnectionReturnInfo)
|
ExFreePool(FCB->ListenIrp.ConnectionCallInfo);
|
||||||
{
|
FCB->ListenIrp.ConnectionCallInfo = NULL;
|
||||||
ExFreePool(FCB->ListenIrp.ConnectionReturnInfo);
|
return UnlockAndMaybeComplete(FCB, Status, Irp, 0);
|
||||||
FCB->ListenIrp.ConnectionReturnInfo = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FCB->ListenIrp.ConnectionCallInfo)
|
|
||||||
{
|
|
||||||
ExFreePool(FCB->ListenIrp.ConnectionCallInfo);
|
|
||||||
FCB->ListenIrp.ConnectionCallInfo = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FCB->State = SOCKET_STATE_LISTENING;
|
FCB->State = SOCKET_STATE_LISTENING;
|
||||||
|
@ -337,29 +330,22 @@ NTSTATUS AfdAccept( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||||
Status = WarmSocketForConnection( FCB );
|
Status = WarmSocketForConnection( FCB );
|
||||||
|
|
||||||
if( Status == STATUS_SUCCESS ) {
|
if( Status == STATUS_SUCCESS ) {
|
||||||
TdiBuildNullConnectionInfo
|
Status = TdiBuildNullConnectionInfo
|
||||||
( &FCB->ListenIrp.ConnectionCallInfo,
|
( &FCB->ListenIrp.ConnectionCallInfo,
|
||||||
FCB->LocalAddress->Address[0].AddressType );
|
FCB->LocalAddress->Address[0].AddressType );
|
||||||
TdiBuildNullConnectionInfo
|
|
||||||
( &FCB->ListenIrp.ConnectionReturnInfo,
|
|
||||||
FCB->LocalAddress->Address[0].AddressType );
|
|
||||||
|
|
||||||
if( !FCB->ListenIrp.ConnectionReturnInfo || !FCB->ListenIrp.ConnectionCallInfo )
|
if (!NT_SUCCESS(Status)) return UnlockAndMaybeComplete(FCB, Status, Irp, 0);
|
||||||
{
|
|
||||||
if (FCB->ListenIrp.ConnectionReturnInfo)
|
|
||||||
{
|
|
||||||
ExFreePool(FCB->ListenIrp.ConnectionReturnInfo);
|
|
||||||
FCB->ListenIrp.ConnectionReturnInfo = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FCB->ListenIrp.ConnectionCallInfo)
|
Status = TdiBuildNullConnectionInfo
|
||||||
{
|
( &FCB->ListenIrp.ConnectionReturnInfo,
|
||||||
ExFreePool(FCB->ListenIrp.ConnectionCallInfo);
|
FCB->LocalAddress->Address[0].AddressType );
|
||||||
FCB->ListenIrp.ConnectionCallInfo = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
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,
|
Status = TdiListen( &FCB->ListenIrp.InFlightRequest,
|
||||||
FCB->Connection.Object,
|
FCB->Connection.Object,
|
||||||
|
|
|
@ -498,7 +498,7 @@ AfdDisconnect(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||||
( &ConnectionReturnInfo, FCB->RemoteAddress->Address[0].AddressType );
|
( &ConnectionReturnInfo, FCB->RemoteAddress->Address[0].AddressType );
|
||||||
|
|
||||||
if( !NT_SUCCESS(Status) )
|
if( !NT_SUCCESS(Status) )
|
||||||
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY,
|
return UnlockAndMaybeComplete( FCB, Status,
|
||||||
Irp, 0 );
|
Irp, 0 );
|
||||||
|
|
||||||
if( DisReq->DisconnectType & AFD_DISCONNECT_SEND )
|
if( DisReq->DisconnectType & AFD_DISCONNECT_SEND )
|
||||||
|
|
|
@ -14,13 +14,21 @@
|
||||||
|
|
||||||
UINT TdiAddressSizeFromType( UINT AddressType ) {
|
UINT TdiAddressSizeFromType( UINT AddressType ) {
|
||||||
switch( AddressType ) {
|
switch( AddressType ) {
|
||||||
case AF_INET:
|
case TDI_ADDRESS_TYPE_IP:
|
||||||
return sizeof(TA_IP_ADDRESS);
|
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:
|
default:
|
||||||
AFD_DbgPrint(MID_TRACE,("TdiAddressSizeFromType - invalid type: %x\n", AddressType));
|
DbgPrint("TdiAddressSizeFromType - invalid type: %x\n", AddressType);
|
||||||
KeBugCheck( 0 );
|
return 0;
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT TaLengthOfAddress( PTA_ADDRESS Addr ) {
|
UINT TaLengthOfAddress( PTA_ADDRESS Addr ) {
|
||||||
|
@ -85,6 +93,8 @@ static NTSTATUS TdiBuildNullConnectionInfoInPlace
|
||||||
PTRANSPORT_ADDRESS TransportAddress;
|
PTRANSPORT_ADDRESS TransportAddress;
|
||||||
|
|
||||||
TdiAddressSize = TdiAddressSizeFromType(Type);
|
TdiAddressSize = TdiAddressSizeFromType(Type);
|
||||||
|
if (!TdiAddressSize)
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
RtlZeroMemory(ConnInfo,
|
RtlZeroMemory(ConnInfo,
|
||||||
sizeof(TDI_CONNECTION_INFORMATION) +
|
sizeof(TDI_CONNECTION_INFORMATION) +
|
||||||
|
@ -118,6 +128,10 @@ NTSTATUS TdiBuildNullConnectionInfo
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
TdiAddressSize = TdiAddressSizeFromType(Type);
|
TdiAddressSize = TdiAddressSizeFromType(Type);
|
||||||
|
if (!TdiAddressSize) {
|
||||||
|
*ConnectionInfo = NULL;
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
ConnInfo = (PTDI_CONNECTION_INFORMATION)
|
ConnInfo = (PTDI_CONNECTION_INFORMATION)
|
||||||
ExAllocatePool(NonPagedPool,
|
ExAllocatePool(NonPagedPool,
|
||||||
|
@ -199,6 +213,9 @@ TdiBuildConnectionInfoPair
|
||||||
|
|
||||||
/* FIXME: Get from socket information */
|
/* FIXME: Get from socket information */
|
||||||
TdiAddressSize = TdiAddressSizeFromType(From->Address[0].AddressType);
|
TdiAddressSize = TdiAddressSizeFromType(From->Address[0].AddressType);
|
||||||
|
if (!TdiAddressSize)
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
SizeOfEntry = TdiAddressSize + sizeof(TDI_CONNECTION_INFORMATION);
|
SizeOfEntry = TdiAddressSize + sizeof(TDI_CONNECTION_INFORMATION);
|
||||||
|
|
||||||
LayoutFrame = (PCHAR)ExAllocatePool(NonPagedPool, 2 * SizeOfEntry);
|
LayoutFrame = (PCHAR)ExAllocatePool(NonPagedPool, 2 * SizeOfEntry);
|
||||||
|
|
|
@ -247,9 +247,9 @@ AfdConnectedSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||||
Irp, 0 );
|
Irp, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
TdiBuildConnectionInfo( &TargetAddress, FCB->RemoteAddress );
|
Status = TdiBuildConnectionInfo( &TargetAddress, FCB->RemoteAddress );
|
||||||
|
|
||||||
if( TargetAddress ) {
|
if( NT_SUCCESS(Status) ) {
|
||||||
Status = TdiSendDatagram
|
Status = TdiSendDatagram
|
||||||
( &FCB->SendIrp.InFlightRequest,
|
( &FCB->SendIrp.InFlightRequest,
|
||||||
FCB->AddressFile.Object,
|
FCB->AddressFile.Object,
|
||||||
|
@ -261,7 +261,7 @@ AfdConnectedSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||||
FCB );
|
FCB );
|
||||||
|
|
||||||
ExFreePool( TargetAddress );
|
ExFreePool( TargetAddress );
|
||||||
} else Status = STATUS_NO_MEMORY;
|
}
|
||||||
|
|
||||||
if( Status == STATUS_PENDING ) Status = STATUS_SUCCESS;
|
if( Status == STATUS_PENDING ) Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
@ -419,12 +419,12 @@ AfdPacketSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||||
((PTRANSPORT_ADDRESS)SendReq->TdiConnection.RemoteAddress)->
|
((PTRANSPORT_ADDRESS)SendReq->TdiConnection.RemoteAddress)->
|
||||||
Address[0].AddressType));
|
Address[0].AddressType));
|
||||||
|
|
||||||
TdiBuildConnectionInfo( &TargetAddress,
|
Status = TdiBuildConnectionInfo( &TargetAddress,
|
||||||
((PTRANSPORT_ADDRESS)SendReq->TdiConnection.RemoteAddress) );
|
((PTRANSPORT_ADDRESS)SendReq->TdiConnection.RemoteAddress) );
|
||||||
|
|
||||||
/* Check the size of the Address given ... */
|
/* Check the size of the Address given ... */
|
||||||
|
|
||||||
if( TargetAddress ) {
|
if( NT_SUCCESS(Status) ) {
|
||||||
Status = TdiSendDatagram
|
Status = TdiSendDatagram
|
||||||
( &FCB->SendIrp.InFlightRequest,
|
( &FCB->SendIrp.InFlightRequest,
|
||||||
FCB->AddressFile.Object,
|
FCB->AddressFile.Object,
|
||||||
|
@ -436,7 +436,7 @@ AfdPacketSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||||
FCB );
|
FCB );
|
||||||
|
|
||||||
ExFreePool( TargetAddress );
|
ExFreePool( TargetAddress );
|
||||||
} else Status = STATUS_NO_MEMORY;
|
}
|
||||||
|
|
||||||
if( Status == STATUS_PENDING ) Status = STATUS_SUCCESS;
|
if( Status == STATUS_PENDING ) Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue