mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 18:02:05 +00:00
Merge aicom-network-fixes up to 35155
svn path=/trunk/; revision=35156
This commit is contained in:
parent
d1884b0cf8
commit
7fa9c85299
6 changed files with 35 additions and 16 deletions
|
@ -286,7 +286,9 @@ DWORD MsafdReturnWithErrno( NTSTATUS Status, LPINT Errno, DWORD Received,
|
|||
case STATUS_END_OF_FILE: *Errno = WSAESHUTDOWN; break;
|
||||
case STATUS_PENDING: *Errno = WSA_IO_PENDING; break;
|
||||
case STATUS_BUFFER_OVERFLOW: *Errno = WSAEMSGSIZE; break;
|
||||
case STATUS_INSUFFICIENT_RESOURCES: *Errno = WSA_NOT_ENOUGH_MEMORY; break;
|
||||
case STATUS_INVALID_CONNECTION: *Errno = WSAEAFNOSUPPORT; break;
|
||||
case STATUS_REMOTE_NOT_LISTENING: *Errno = WSAECONNRESET; break;
|
||||
default:
|
||||
DbgPrint("MSAFD: Error %x is unknown\n", Status);
|
||||
*Errno = WSAEINVAL; break;
|
||||
|
@ -513,6 +515,7 @@ WSPBind(
|
|||
/* Wait for return */
|
||||
if (Status == STATUS_PENDING) {
|
||||
WaitForSingleObject(SockEvent, INFINITE);
|
||||
Status = IOSB.Status;
|
||||
}
|
||||
|
||||
/* Set up Socket Data */
|
||||
|
@ -522,7 +525,7 @@ WSPBind(
|
|||
NtClose( SockEvent );
|
||||
|
||||
return MsafdReturnWithErrno
|
||||
( IOSB.Status, lpErrno, IOSB.Information, NULL );
|
||||
( Status, lpErrno, 0, NULL );
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -566,6 +569,7 @@ WSPListen(
|
|||
/* Wait for return */
|
||||
if (Status == STATUS_PENDING) {
|
||||
WaitForSingleObject(SockEvent, INFINITE);
|
||||
Status = IOSB.Status;
|
||||
}
|
||||
|
||||
/* Set to Listening */
|
||||
|
@ -574,7 +578,7 @@ WSPListen(
|
|||
NtClose( SockEvent );
|
||||
|
||||
return MsafdReturnWithErrno
|
||||
( IOSB.Status, lpErrno, IOSB.Information, NULL );
|
||||
( Status, lpErrno, 0, NULL );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1247,7 +1251,7 @@ WSPConnect(
|
|||
|
||||
NtClose( SockEvent );
|
||||
|
||||
return MsafdReturnWithErrno( IOSB.Status, lpErrno, 0, NULL );
|
||||
return MsafdReturnWithErrno( Status, lpErrno, 0, NULL );
|
||||
}
|
||||
int
|
||||
WSPAPI
|
||||
|
@ -1310,13 +1314,14 @@ WSPShutdown(
|
|||
/* Wait for return */
|
||||
if (Status == STATUS_PENDING) {
|
||||
WaitForSingleObject(SockEvent, INFINITE);
|
||||
Status = IOSB.Status;
|
||||
}
|
||||
|
||||
AFD_DbgPrint(MID_TRACE,("Ending\n"));
|
||||
|
||||
NtClose( SockEvent );
|
||||
|
||||
return MsafdReturnWithErrno( IOSB.Status, lpErrno, 0, NULL );
|
||||
return MsafdReturnWithErrno( Status, lpErrno, 0, NULL );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1401,7 +1406,7 @@ WSPGetSockName(
|
|||
}
|
||||
|
||||
return MsafdReturnWithErrno
|
||||
( IOSB.Status, lpErrno, 0, NULL );
|
||||
( Status, lpErrno, 0, NULL );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1486,7 +1491,7 @@ WSPGetPeerName(
|
|||
}
|
||||
|
||||
return MsafdReturnWithErrno
|
||||
( IOSB.Status, lpErrno, 0, NULL );
|
||||
( Status, lpErrno, 0, NULL );
|
||||
}
|
||||
|
||||
INT
|
||||
|
|
|
@ -95,6 +95,7 @@ static NTSTATUS NTAPI StreamSocketConnectComplete
|
|||
AFD_DbgPrint(MID_TRACE,("Completing connect %x\n", NextIrp));
|
||||
NextIrp->IoStatus.Status = Status;
|
||||
NextIrp->IoStatus.Information = 0;
|
||||
if( NextIrp->MdlAddress ) UnlockRequest( NextIrp, IoGetCurrentIrpStackLocation( NextIrp ) );
|
||||
IoCompleteRequest( NextIrp, IO_NETWORK_INCREMENT );
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,8 @@ static VOID SatisfyAccept( PAFD_DEVICE_EXTENSION DeviceExt,
|
|||
FCB->RemoteAddress =
|
||||
TaCopyTransportAddress( Qelt->ConnInfo->RemoteAddress );
|
||||
|
||||
if( Irp->MdlAddress ) UnlockRequest( Irp, IoGetCurrentIrpStackLocation( Irp ) );
|
||||
|
||||
Irp->IoStatus.Information = 0;
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
IoCompleteRequest( Irp, IO_NETWORK_INCREMENT );
|
||||
|
@ -70,6 +72,8 @@ static VOID SatisfyPreAccept( PIRP Irp, PAFD_TDI_OBJECT_QELT Qelt ) {
|
|||
AFD_DbgPrint(MID_TRACE,("IPAddr->Address[0].Address[0].sin_addr %x\n",
|
||||
IPAddr->Address[0].Address[0].in_addr));
|
||||
|
||||
if( Irp->MdlAddress ) UnlockRequest( Irp, IoGetCurrentIrpStackLocation( Irp ) );
|
||||
|
||||
Irp->IoStatus.Information = ((PCHAR)&IPAddr[1]) - ((PCHAR)ListenReceive);
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
IoCompleteRequest( Irp, IO_NETWORK_INCREMENT );
|
||||
|
|
|
@ -168,11 +168,8 @@ static NTSTATUS ReceiveActivity( PAFD_FCB FCB, PIRP Irp ) {
|
|||
FCB, FCB->Recv.Content));
|
||||
/*OskitDumpBuffer( FCB->Recv.Window, FCB->Recv.Content );*/
|
||||
|
||||
Status = STATUS_SUCCESS;
|
||||
|
||||
/* Try to clear some requests */
|
||||
while( !IsListEmpty( &FCB->PendingIrpList[FUNCTION_RECV] ) &&
|
||||
NT_SUCCESS(Status) ) {
|
||||
while( !IsListEmpty( &FCB->PendingIrpList[FUNCTION_RECV] ) ) {
|
||||
NextIrpEntry =
|
||||
RemoveHeadList(&FCB->PendingIrpList[FUNCTION_RECV]);
|
||||
NextIrp =
|
||||
|
@ -476,10 +473,14 @@ PacketSocketRecvComplete(
|
|||
InsertTailList( &FCB->DatagramList, &DatagramRecv->ListEntry );
|
||||
} else Status = STATUS_NO_MEMORY;
|
||||
|
||||
if( !NT_SUCCESS( Status ) ) {
|
||||
SocketStateUnlock( FCB );
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Satisfy as many requests as we can */
|
||||
|
||||
while( NT_SUCCESS(Status) &&
|
||||
!IsListEmpty( &FCB->DatagramList ) &&
|
||||
while( !IsListEmpty( &FCB->DatagramList ) &&
|
||||
!IsListEmpty( &FCB->PendingIrpList[FUNCTION_RECV] ) ) {
|
||||
AFD_DbgPrint(MID_TRACE,("Looping trying to satisfy request\n"));
|
||||
ListEntry = RemoveHeadList( &FCB->DatagramList );
|
||||
|
|
|
@ -85,8 +85,7 @@ static NTSTATUS NTAPI SendComplete
|
|||
FCB->Send.BytesUsed -= Irp->IoStatus.Information;
|
||||
|
||||
if( !FCB->Send.BytesUsed &&
|
||||
!IsListEmpty( &FCB->PendingIrpList[FUNCTION_SEND] ) &&
|
||||
NT_SUCCESS(Status) ) {
|
||||
!IsListEmpty( &FCB->PendingIrpList[FUNCTION_SEND] ) ) {
|
||||
NextIrpEntry =
|
||||
RemoveHeadList(&FCB->PendingIrpList[FUNCTION_SEND]);
|
||||
NextIrp =
|
||||
|
|
|
@ -839,20 +839,25 @@ static NTSTATUS FindDeviceDescForAdapter( PUNICODE_STRING Name,
|
|||
ExAllocatePool(NonPagedPool, sizeof(KEY_BASIC_INFORMATION));
|
||||
ULONG KbioLength = sizeof(KEY_BASIC_INFORMATION), ResultLength;
|
||||
|
||||
if( !Kbio ) return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
RtlInitUnicodeString
|
||||
(&EnumKeyName, CCS_ROOT L"\\Control\\Class\\" TCPIP_GUID);
|
||||
|
||||
Status = OpenRegistryKey( &EnumKeyName, &EnumKey );
|
||||
|
||||
if( !NT_SUCCESS(Status) )
|
||||
if( !NT_SUCCESS(Status) ) {
|
||||
TI_DbgPrint(DEBUG_DATALINK,("Couldn't open Enum key %wZ: %x\n",
|
||||
&EnumKeyName, Status));
|
||||
ExFreePool( Kbio );
|
||||
return Status;
|
||||
}
|
||||
|
||||
for( i = 0; NT_SUCCESS(Status); i++ ) {
|
||||
Status = ZwEnumerateKey( EnumKey, i, KeyBasicInformation,
|
||||
Kbio, KbioLength, &ResultLength );
|
||||
|
||||
if( Status == STATUS_BUFFER_TOO_SMALL ) {
|
||||
if( Status == STATUS_BUFFER_TOO_SMALL || Status == STATUS_BUFFER_OVERFLOW ) {
|
||||
ExFreePool( Kbio );
|
||||
KbioLength = ResultLength;
|
||||
Kbio = ExAllocatePool( NonPagedPool, KbioLength );
|
||||
|
@ -862,6 +867,8 @@ static NTSTATUS FindDeviceDescForAdapter( PUNICODE_STRING Name,
|
|||
|
||||
if( !NT_SUCCESS(Status) ) {
|
||||
TI_DbgPrint(DEBUG_DATALINK,("Couldn't enum key child %d\n", i));
|
||||
NtClose( EnumKey );
|
||||
ExFreePool( Kbio );
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
@ -875,6 +882,7 @@ static NTSTATUS FindDeviceDescForAdapter( PUNICODE_STRING Name,
|
|||
( &EnumKeyName, &TargetKeyName, Name, DeviceDesc );
|
||||
if( NT_SUCCESS(Status) ) {
|
||||
NtClose( EnumKey );
|
||||
ExFreePool( Kbio );
|
||||
return Status;
|
||||
} else Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -883,6 +891,7 @@ static NTSTATUS FindDeviceDescForAdapter( PUNICODE_STRING Name,
|
|||
RtlInitUnicodeString( DeviceDesc, L"" );
|
||||
AppendUnicodeString( DeviceDesc, &TargetKeyName, FALSE );
|
||||
NtClose( EnumKey );
|
||||
ExFreePool( Kbio );
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue