Author: arty
Date: Wed Jul 30 01:05:20 2008
New Revision: 34943
URL:
http://svn.reactos.org/svn/reactos?rev=34943&view=rev
Log:
Patch by Cameron Gutman (aicommander (at) gmail (dot) com)
- Remove a hack related to cancellation
- Make sure not to pass on a bad IRP on failure (in tdi)
- Remember connect irp
* Note: commit notes are arty's in this case
Modified:
trunk/reactos/drivers/network/afd/afd/main.c
trunk/reactos/drivers/network/afd/afd/tdi.c
Modified: trunk/reactos/drivers/network/afd/afd/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/ma…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/main.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/main.c [iso-8859-1] Wed Jul 30 01:05:20 2008
@@ -165,16 +165,19 @@
InFlightRequest[0] = &FCB->ListenIrp;
InFlightRequest[1] = &FCB->ReceiveIrp;
InFlightRequest[2] = &FCB->SendIrp;
+ InFlightRequest[3] = &FCB->ConnectIrp;
/* Return early here because we might be called in the mean time. */
if( FCB->Critical ||
FCB->ListenIrp.InFlightRequest ||
FCB->ReceiveIrp.InFlightRequest ||
- FCB->SendIrp.InFlightRequest ) {
- AFD_DbgPrint(MIN_TRACE,("Leaving socket alive (%x %x %x)\n",
+ FCB->SendIrp.InFlightRequest ||
+ FCB->ConnectIrp.InFlightRequest ) {
+ AFD_DbgPrint(MIN_TRACE,("Leaving socket alive (%x %x %x %x)\n",
FCB->ListenIrp.InFlightRequest,
FCB->ReceiveIrp.InFlightRequest,
- FCB->SendIrp.InFlightRequest));
+ FCB->SendIrp.InFlightRequest,
+ FCB->ConnectIrp.InFlightRequest));
ReturnEarly = TRUE;
}
@@ -183,11 +186,10 @@
/* Cancel our pending requests */
for( i = 0; i < IN_FLIGHT_REQUESTS; i++ ) {
- NTSTATUS Status = STATUS_NO_SUCH_FILE;
if( InFlightRequest[i]->InFlightRequest ) {
AFD_DbgPrint(MID_TRACE,("Cancelling in flight irp %d (%x)\n",
i, InFlightRequest[i]->InFlightRequest));
- InFlightRequest[i]->InFlightRequest->IoStatus.Status = Status;
+ InFlightRequest[i]->InFlightRequest->IoStatus.Status = STATUS_CANCELLED;
InFlightRequest[i]->InFlightRequest->IoStatus.Information = 0;
IoCancelIrp( InFlightRequest[i]->InFlightRequest );
}
Modified: trunk/reactos/drivers/network/afd/afd/tdi.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/td…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/tdi.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/tdi.c [iso-8859-1] Wed Jul 30 01:05:20 2008
@@ -294,6 +294,11 @@
assert(ConnectionObject);
DeviceObject = IoGetRelatedDeviceObject(ConnectionObject);
+ if (!DeviceObject) {
+ AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
+ *Irp = NULL;
+ return STATUS_INVALID_PARAMETER;
+ }
*Irp = TdiBuildInternalDeviceControlIrp(TDI_CONNECT, /* Sub function */
DeviceObject, /* Device object */
@@ -343,6 +348,10 @@
assert(ConnectionObject);
DeviceObject = IoGetRelatedDeviceObject(ConnectionObject);
+ if (!DeviceObject) {
+ AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
+ return STATUS_INVALID_PARAMETER;
+ }
KeInitializeEvent(&Event, NotificationEvent, FALSE);
@@ -391,6 +400,11 @@
AFD_DbgPrint(MAX_TRACE, ("Called\n"));
DeviceObject = IoGetRelatedDeviceObject(ConnectionObject);
+ if (!DeviceObject) {
+ AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
+ *Irp = NULL;
+ return STATUS_INVALID_PARAMETER;
+ }
Status = TdiBuildNullConnectionInfo(RequestConnectionInfo,
TDI_ADDRESS_TYPE_IP);
@@ -452,6 +466,10 @@
assert(FileObject);
DeviceObject = IoGetRelatedDeviceObject(FileObject);
+ if (!DeviceObject) {
+ AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
+ return STATUS_INVALID_PARAMETER;
+ }
KeInitializeEvent(&Event, NotificationEvent, FALSE);
@@ -508,6 +526,10 @@
PIRP Irp;
DeviceObject = IoGetRelatedDeviceObject(FileObject);
+ if (!DeviceObject) {
+ AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
+ return STATUS_INVALID_PARAMETER;
+ }
KeInitializeEvent(&Event, NotificationEvent, FALSE);
@@ -553,6 +575,10 @@
PIRP Irp;
DeviceObject = IoGetRelatedDeviceObject(FileObject);
+ if (!DeviceObject) {
+ AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
+ return STATUS_INVALID_PARAMETER;
+ }
KeInitializeEvent(&Event, NotificationEvent, FALSE);
@@ -774,6 +800,7 @@
DeviceObject = IoGetRelatedDeviceObject(TransportObject);
if (!DeviceObject) {
AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
+ *Irp = NULL;
return STATUS_INVALID_PARAMETER;
}
@@ -799,6 +826,7 @@
if (!Mdl) {
AFD_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
IoFreeIrp(*Irp);
+ *Irp = NULL;
return STATUS_INSUFFICIENT_RESOURCES;
}
@@ -807,11 +835,13 @@
} _SEH_HANDLE {
AFD_DbgPrint(MIN_TRACE, ("MmProbeAndLockPages() failed.\n"));
IoFreeIrp(*Irp);
+ *Irp = NULL;
Status = STATUS_INSUFFICIENT_RESOURCES;
} _SEH_END;
if( !NT_SUCCESS(Status) ) {
IoFreeIrp(*Irp);
+ *Irp = NULL;
return Status;
}
@@ -850,6 +880,7 @@
DeviceObject = IoGetRelatedDeviceObject(TransportObject);
if (!DeviceObject) {
AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
+ *Irp = NULL;
return STATUS_INVALID_PARAMETER;
}
@@ -875,6 +906,7 @@
if (!Mdl) {
AFD_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
IoFreeIrp(*Irp);
+ *Irp = NULL;
return STATUS_INSUFFICIENT_RESOURCES;
}
@@ -885,11 +917,13 @@
} _SEH_HANDLE {
AFD_DbgPrint(MIN_TRACE, ("MmProbeAndLockPages() failed.\n"));
IoFreeIrp(*Irp);
+ *Irp = NULL;
Status = STATUS_INSUFFICIENT_RESOURCES;
} _SEH_END;
if( !NT_SUCCESS(Status) ) {
IoFreeIrp(*Irp);
+ *Irp = NULL;
return Status;
}
@@ -945,6 +979,7 @@
DeviceObject = IoGetRelatedDeviceObject(TransportObject);
if (!DeviceObject) {
AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
+ *Irp = NULL;
return STATUS_INVALID_PARAMETER;
}
@@ -970,6 +1005,7 @@
if (!Mdl) {
AFD_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
IoFreeIrp(*Irp);
+ *Irp = NULL;
return STATUS_INSUFFICIENT_RESOURCES;
}
@@ -978,6 +1014,7 @@
} _SEH_HANDLE {
AFD_DbgPrint(MIN_TRACE, ("MmProbeAndLockPages() failed.\n"));
IoFreeIrp(*Irp);
+ *Irp = NULL;
_SEH_YIELD(return STATUS_INSUFFICIENT_RESOURCES);
} _SEH_END;
@@ -1033,6 +1070,7 @@
DeviceObject = IoGetRelatedDeviceObject(TransportObject);
if (!DeviceObject) {
AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
+ *Irp = NULL;
return STATUS_INVALID_PARAMETER;
}
@@ -1059,6 +1097,7 @@
if (!Mdl) {
AFD_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
IoFreeIrp(*Irp);
+ *Irp = NULL;
return STATUS_INSUFFICIENT_RESOURCES;
}
@@ -1067,6 +1106,7 @@
} _SEH_HANDLE {
AFD_DbgPrint(MIN_TRACE, ("MmProbeAndLockPages() failed.\n"));
IoFreeIrp(*Irp);
+ *Irp = NULL;
_SEH_YIELD(return STATUS_INSUFFICIENT_RESOURCES);
} _SEH_END;