Author: cgutman
Date: Sat Jun 4 20:31:05 2011
New Revision: 52083
URL:
http://svn.reactos.org/svn/reactos?rev=52083&view=rev
Log:
[AFD]
- Disassociate the connection from the address file before closing them
Modified:
trunk/reactos/drivers/network/afd/afd/main.c
trunk/reactos/drivers/network/afd/afd/tdi.c
trunk/reactos/drivers/network/afd/include/afd.h
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] Sat Jun 4 20:31:05 2011
@@ -460,7 +460,10 @@
ExFreePool( FCB->RemoteAddress );
if( FCB->Connection.Object )
+ {
+ TdiDisassociateAddressFile(FCB->Connection.Object);
ObDereferenceObject(FCB->Connection.Object);
+ }
if( FCB->AddressFile.Object )
ObDereferenceObject(FCB->AddressFile.Object);
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] Sat Jun 4 20:31:05 2011
@@ -420,6 +420,55 @@
return Status;
}
+NTSTATUS TdiDisassociateAddressFile(
+ PFILE_OBJECT ConnectionObject)
+/*
+ * FUNCTION: Disassociates a connection endpoint from an address file object
+ * ARGUMENTS:
+ * ConnectionObject = Connection endpoint file object
+ * RETURNS:
+ * Status of operation
+ */
+{
+ PDEVICE_OBJECT DeviceObject;
+ IO_STATUS_BLOCK Iosb;
+ NTSTATUS Status;
+ KEVENT Event;
+ PIRP Irp;
+
+ AFD_DbgPrint(MAX_TRACE, ("Called. ConnectionObject (0x%X)\n",
ConnectionObject));
+
+ if (!ConnectionObject) {
+ AFD_DbgPrint(MIN_TRACE, ("Bad connection object.\n"));
+ return STATUS_INVALID_PARAMETER;
+ }
+
+ DeviceObject = IoGetRelatedDeviceObject(ConnectionObject);
+ if (!DeviceObject) {
+ AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
+ return STATUS_INVALID_PARAMETER;
+ }
+
+ KeInitializeEvent(&Event, NotificationEvent, FALSE);
+
+ Irp = TdiBuildInternalDeviceControlIrp(TDI_DISASSOCIATE_ADDRESS, /* Sub function */
+ DeviceObject, /* Device object */
+ ConnectionObject, /* File object */
+ &Event, /* Event */
+ &Iosb); /* Status */
+ if (!Irp)
+ return STATUS_INSUFFICIENT_RESOURCES;
+
+ TdiBuildDisassociateAddress(Irp,
+ DeviceObject,
+ ConnectionObject,
+ NULL,
+ NULL);
+
+ Status = TdiCall(Irp, DeviceObject, &Event, &Iosb);
+
+ return Status;
+}
NTSTATUS TdiListen
( PIRP *Irp,
@@ -1229,7 +1278,7 @@
}
Irp = TdiBuildInternalDeviceControlIrp
- ( TDI_SEND_DATAGRAM, /* Sub function */
+ ( TDI_DISCONNECT, /* Sub function */
DeviceObject, /* Device object */
TransportObject, /* File object */
&Event, /* Event */
Modified: trunk/reactos/drivers/network/afd/include/afd.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/includ…
==============================================================================
--- trunk/reactos/drivers/network/afd/include/afd.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/include/afd.h [iso-8859-1] Sat Jun 4 20:31:05 2011
@@ -360,6 +360,9 @@
HANDLE AddressHandle,
PFILE_OBJECT ConnectionObject);
+NTSTATUS TdiDisassociateAddressFile(
+ PFILE_OBJECT ConnectionObject);
+
NTSTATUS TdiListen
( PIRP *Irp,
PFILE_OBJECT ConnectionObject,