Author: arty
Date: Sat Aug 23 02:20:22 2008
New Revision: 35550
URL:
http://svn.reactos.org/svn/reactos?rev=35550&view=rev
Log:
Merge aicom-network-fixes up to 35538
Modified:
trunk/reactos/dll/win32/msafd/misc/dllmain.c
trunk/reactos/drivers/network/afd/afd/bind.c
trunk/reactos/drivers/network/afd/afd/info.c
trunk/reactos/drivers/network/afd/afd/lock.c
trunk/reactos/drivers/network/afd/afd/read.c
trunk/reactos/drivers/network/afd/afd/write.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] Sat Aug 23 02:20:22 2008
@@ -291,6 +291,7 @@
case STATUS_INVALID_CONNECTION: AFD_DbgPrint(MID_TRACE,("MSAFD:
STATUS_INVALID_CONNECTION\n")); *Errno = WSAEAFNOSUPPORT; break;
case STATUS_REMOTE_NOT_LISTENING: AFD_DbgPrint(MID_TRACE, ("MSAFD:
STATUS_REMOTE_NOT_LISTENING\n")); *Errno = WSAECONNRESET; break;
case STATUS_FILE_CLOSED: AFD_DbgPrint(MID_TRACE, ("MSAFD:
STATUS_FILE_CLOSED\n")); *Errno = WSAENOTSOCK; break;
+ case STATUS_INVALID_PARAMETER: DbgPrint("MSAFD: STATUS_INVALID_PARAMETER\n");
*Errno = WSAEINVAL; break;
default:
DbgPrint("MSAFD: Error %x is unknown\n", Status);
*Errno = WSAEINVAL; break;
Modified: trunk/reactos/drivers/network/afd/afd/bind.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/bi…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/bind.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/bind.c [iso-8859-1] Sat Aug 23 02:20:22 2008
@@ -25,7 +25,7 @@
}
if( !FCB->LocalAddress ) {
AFD_DbgPrint(MID_TRACE,("No local address\n"));
- return STATUS_UNSUCCESSFUL;
+ return STATUS_INVALID_PARAMETER;
}
Status = TdiOpenAddressFile(&FCB->TdiDeviceName,
Modified: trunk/reactos/drivers/network/afd/afd/info.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/in…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/info.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/info.c [iso-8859-1] Sat Aug 23 02:20:22 2008
@@ -84,7 +84,7 @@
if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
if( FCB->AddressFile.Object == NULL) {
- return UnlockAndMaybeComplete( FCB, STATUS_UNSUCCESSFUL, Irp, 0,
+ return UnlockAndMaybeComplete( FCB, STATUS_INVALID_PARAMETER, Irp, 0,
NULL );
}
Modified: trunk/reactos/drivers/network/afd/afd/lock.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/lo…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/lock.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/lock.c [iso-8859-1] Sat Aug 23 02:20:22 2008
@@ -37,7 +37,7 @@
}
IrpSp->Parameters.DeviceIoControl.Type3InputBuffer =
- MmMapLockedPages( Irp->MdlAddress, KernelMode );
+ MmGetSystemAddressForMdlSafe( Irp->MdlAddress, NormalPagePriority );
if( !IrpSp->Parameters.DeviceIoControl.Type3InputBuffer ) {
IoFreeMdl( Irp->MdlAddress );
@@ -50,12 +50,13 @@
}
VOID UnlockRequest( PIRP Irp, PIO_STACK_LOCATION IrpSp ) {
- if( !IrpSp->Parameters.DeviceIoControl.Type3InputBuffer || !Irp->MdlAddress )
return;
-
- MmUnmapLockedPages( IrpSp->Parameters.DeviceIoControl.Type3InputBuffer,
- Irp->MdlAddress );
- MmUnlockPages( Irp->MdlAddress );
- IoFreeMdl( Irp->MdlAddress );
+ PVOID Buffer = MmGetSystemAddressForMdlSafe( Irp->MdlAddress, NormalPagePriority
);
+ if( IrpSp->Parameters.DeviceIoControl.Type3InputBuffer == Buffer || Buffer == NULL
) {
+ MmUnmapLockedPages( IrpSp->Parameters.DeviceIoControl.Type3InputBuffer,
Irp->MdlAddress );
+ MmUnlockPages( Irp->MdlAddress );
+ IoFreeMdl( Irp->MdlAddress );
+ }
+
Irp->MdlAddress = NULL;
}
@@ -72,6 +73,7 @@
UINT Size = sizeof(AFD_WSABUF) * (Count + Lock);
PAFD_WSABUF NewBuf = ExAllocatePool( PagedPool, Size * 2 );
PMDL NewMdl;
+ BOOLEAN LockFailed = FALSE;
AFD_DbgPrint(MID_TRACE,("Called(%08x)\n", NewBuf));
@@ -117,9 +119,19 @@
if( MapBuf[i].Mdl ) {
AFD_DbgPrint(MID_TRACE,("Probe and lock pages\n"));
- MmProbeAndLockPages( MapBuf[i].Mdl, KernelMode,
- Write ? IoModifyAccess : IoReadAccess );
+ _SEH_TRY {
+ MmProbeAndLockPages( MapBuf[i].Mdl, KernelMode,
+ Write ? IoModifyAccess : IoReadAccess );
+ } _SEH_HANDLE {
+ LockFailed = TRUE;
+ } _SEH_END;
AFD_DbgPrint(MID_TRACE,("MmProbeAndLock finished\n"));
+
+ if( LockFailed ) {
+ IoFreeMdl( MapBuf[i].Mdl );
+ MapBuf[i].Mdl = NULL;
+ LockFailed = FALSE;
+ }
}
}
}
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] Sat Aug 23 02:20:22 2008
@@ -252,7 +252,7 @@
} else if( FCB->State == SOCKET_STATE_LISTENING ) {
AFD_DbgPrint(MIN_TRACE,("!!! LISTENER GOT A RECEIVE COMPLETE !!!\n"));
SocketStateUnlock( FCB );
- return STATUS_UNSUCCESSFUL;
+ return STATUS_INVALID_PARAMETER;
}
HandleEOFOnIrp( FCB, Irp->IoStatus.Status, Irp->IoStatus.Information );
@@ -285,7 +285,7 @@
FCB->State != SOCKET_STATE_CONNECTING ) {
AFD_DbgPrint(MID_TRACE,("Called recv on wrong kind of socket (s%x)\n",
FCB->State));
- return UnlockAndMaybeComplete( FCB, STATUS_UNSUCCESSFUL,
+ return UnlockAndMaybeComplete( FCB, STATUS_INVALID_PARAMETER,
Irp, 0, NULL );
}
@@ -576,7 +576,7 @@
/* Check that the socket is bound */
if( FCB->State != SOCKET_STATE_BOUND )
return UnlockAndMaybeComplete
- ( FCB, STATUS_UNSUCCESSFUL, Irp, 0, NULL );
+ ( FCB, STATUS_INVALID_PARAMETER, Irp, 0, NULL );
if( !(RecvReq = LockRequest( Irp, IrpSp )) )
return UnlockAndMaybeComplete
( FCB, STATUS_NO_MEMORY, Irp, 0, NULL );
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] Sat Aug 23 02:20:22 2008
@@ -223,7 +223,7 @@
/* Check that the socket is bound */
if( FCB->State != SOCKET_STATE_BOUND )
- return UnlockAndMaybeComplete( FCB, STATUS_UNSUCCESSFUL, Irp,
+ return UnlockAndMaybeComplete( FCB, STATUS_INVALID_PARAMETER, Irp,
0, NULL );
if( !(SendReq = LockRequest( Irp, IrpSp )) )
@@ -398,7 +398,7 @@
/* Check that the socket is bound */
if( FCB->State != SOCKET_STATE_BOUND )
return UnlockAndMaybeComplete
- ( FCB, STATUS_UNSUCCESSFUL, Irp, 0, NULL );
+ ( FCB, STATUS_INVALID_PARAMETER, Irp, 0, NULL );
if( !(SendReq = LockRequest( Irp, IrpSp )) )
return UnlockAndMaybeComplete
( FCB, STATUS_NO_MEMORY, Irp, 0, NULL );