Author: arty
Date: Thu Aug 7 01:04:49 2008
New Revision: 35156
URL:
http://svn.reactos.org/svn/reactos?rev=35156&view=rev
Log:
Merge aicom-network-fixes up to 35155
Modified:
trunk/reactos/dll/win32/msafd/misc/dllmain.c
trunk/reactos/drivers/network/afd/afd/connect.c
trunk/reactos/drivers/network/afd/afd/listen.c
trunk/reactos/drivers/network/afd/afd/read.c
trunk/reactos/drivers/network/afd/afd/write.c
trunk/reactos/drivers/network/tcpip/datalink/lan.c
Modified: trunk/reactos/dll/win32/msafd/misc/dllmain.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msafd/misc/dllma…
==============================================================================
--- trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] Thu Aug 7 01:04:49 2008
@@ -286,7 +286,9 @@
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 @@
/* Wait for return */
if (Status == STATUS_PENDING) {
WaitForSingleObject(SockEvent, INFINITE);
+ Status = IOSB.Status;
}
/* Set up Socket Data */
@@ -522,7 +525,7 @@
NtClose( SockEvent );
return MsafdReturnWithErrno
- ( IOSB.Status, lpErrno, IOSB.Information, NULL );
+ ( Status, lpErrno, 0, NULL );
}
int
@@ -566,6 +569,7 @@
/* Wait for return */
if (Status == STATUS_PENDING) {
WaitForSingleObject(SockEvent, INFINITE);
+ Status = IOSB.Status;
}
/* Set to Listening */
@@ -574,7 +578,7 @@
NtClose( SockEvent );
return MsafdReturnWithErrno
- ( IOSB.Status, lpErrno, IOSB.Information, NULL );
+ ( Status, lpErrno, 0, NULL );
}
@@ -1247,7 +1251,7 @@
NtClose( SockEvent );
- return MsafdReturnWithErrno( IOSB.Status, lpErrno, 0, NULL );
+ return MsafdReturnWithErrno( Status, lpErrno, 0, NULL );
}
int
WSPAPI
@@ -1310,13 +1314,14 @@
/* 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 @@
}
return MsafdReturnWithErrno
- ( IOSB.Status, lpErrno, 0, NULL );
+ ( Status, lpErrno, 0, NULL );
}
@@ -1486,7 +1491,7 @@
}
return MsafdReturnWithErrno
- ( IOSB.Status, lpErrno, 0, NULL );
+ ( Status, lpErrno, 0, NULL );
}
INT
Modified: trunk/reactos/drivers/network/afd/afd/connect.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/co…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/connect.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/connect.c [iso-8859-1] Thu Aug 7 01:04:49 2008
@@ -95,6 +95,7 @@
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 );
}
Modified: trunk/reactos/drivers/network/afd/afd/listen.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/li…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/listen.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/listen.c [iso-8859-1] Thu Aug 7 01:04:49 2008
@@ -31,6 +31,8 @@
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 );
@@ -69,6 +71,8 @@
IPAddr->Address[0].Address[0].sin_port));
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;
Modified: trunk/reactos/drivers/network/afd/afd/read.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/re…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/read.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/read.c [iso-8859-1] Thu Aug 7 01:04:49 2008
@@ -168,11 +168,8 @@
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 @@
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 );
Modified: trunk/reactos/drivers/network/afd/afd/write.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/wr…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/write.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/write.c [iso-8859-1] Thu Aug 7 01:04:49 2008
@@ -85,8 +85,7 @@
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 =
Modified: trunk/reactos/drivers/network/tcpip/datalink/lan.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/data…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/datalink/lan.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/tcpip/datalink/lan.c [iso-8859-1] Thu Aug 7 01:04:49
2008
@@ -839,20 +839,25 @@
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 @@
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 @@
( &EnumKeyName, &TargetKeyName, Name, DeviceDesc );
if( NT_SUCCESS(Status) ) {
NtClose( EnumKey );
+ ExFreePool( Kbio );
return Status;
} else Status = STATUS_SUCCESS;
}
@@ -883,6 +891,7 @@
RtlInitUnicodeString( DeviceDesc, L"" );
AppendUnicodeString( DeviceDesc, &TargetKeyName, FALSE );
NtClose( EnumKey );
+ ExFreePool( Kbio );
return STATUS_UNSUCCESSFUL;
}