Browsing netreg, the http registry server works.
Modified: trunk/reactos/drivers/net/afd/afd/connect.c
Modified: trunk/reactos/drivers/net/afd/afd/main.c
Modified: trunk/reactos/drivers/net/afd/afd/write.c
Modified: trunk/reactos/drivers/net/tcpip/tcpip/dispatch.c

Modified: trunk/reactos/drivers/net/afd/afd/connect.c
--- trunk/reactos/drivers/net/afd/afd/connect.c	2005-01-18 04:02:49 UTC (rev 13110)
+++ trunk/reactos/drivers/net/afd/afd/connect.c	2005-01-18 04:14:13 UTC (rev 13111)
@@ -61,7 +61,7 @@
 			     ReceiveComplete,
 			     FCB );
     }
-    
+
     return Status;
 }
 

Modified: trunk/reactos/drivers/net/afd/afd/main.c
--- trunk/reactos/drivers/net/afd/afd/main.c	2005-01-18 04:02:49 UTC (rev 13110)
+++ trunk/reactos/drivers/net/afd/afd/main.c	2005-01-18 04:14:13 UTC (rev 13111)
@@ -140,6 +140,7 @@
 
 VOID DestroySocket( PAFD_FCB FCB ) {
     UINT i;
+    BOOLEAN ReturnEarly = FALSE;
     PAFD_IN_FLIGHT_REQUEST InFlightRequest[IN_FLIGHT_REQUESTS];
 
     AFD_DbgPrint(MIN_TRACE,("Called (%x)\n", FCB));
@@ -161,8 +162,7 @@
 				FCB->ListenIrp.InFlightRequest,
 				FCB->ReceiveIrp.InFlightRequest,
 				FCB->SendIrp.InFlightRequest));
-	SocketStateUnlock( FCB );
-	return;
+        ReturnEarly = TRUE;
     }
 
     /* After PoolReeval, this FCB should not be involved in any outstanding
@@ -181,6 +181,8 @@
     }
 
     SocketStateUnlock( FCB );
+
+    if( ReturnEarly ) return;
     
     if( FCB->Recv.Window ) 
 	ExFreePool( FCB->Recv.Window );

Modified: trunk/reactos/drivers/net/afd/afd/write.c
--- trunk/reactos/drivers/net/afd/afd/write.c	2005-01-18 04:02:49 UTC (rev 13110)
+++ trunk/reactos/drivers/net/afd/afd/write.c	2005-01-18 04:14:13 UTC (rev 13111)
@@ -208,6 +208,12 @@
         if( !(SendReq = LockRequest( Irp, IrpSp )) ) 
             return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0,
                                            NULL, FALSE );
+
+        /* Must lock buffers before handing off user data */
+        SendReq->BufferArray = LockBuffers( SendReq->BufferArray,
+                                            SendReq->BufferCount,
+                                            NULL, NULL,
+                                            FALSE, FALSE );
     
         TdiBuildConnectionInfo( &TargetAddress, FCB->RemoteAddress );
 
@@ -260,7 +266,7 @@
 					SendReq->BufferCount,
 					NULL, NULL,
 					FALSE, FALSE );
-    
+
     AFD_DbgPrint(MID_TRACE,("FCB->Send.BytesUsed = %d\n", 
 			    FCB->Send.BytesUsed));
 

Modified: trunk/reactos/drivers/net/tcpip/tcpip/dispatch.c
--- trunk/reactos/drivers/net/tcpip/tcpip/dispatch.c	2005-01-18 04:02:49 UTC (rev 13110)
+++ trunk/reactos/drivers/net/tcpip/tcpip/dispatch.c	2005-01-18 04:14:13 UTC (rev 13111)
@@ -82,6 +82,60 @@
 }
 
 
+VOID DispDataRequestComplete(
+    PVOID Context,
+    NTSTATUS Status,
+    ULONG Count)
+/*
+ * FUNCTION: Completes a send/receive IRP
+ * ARGUMENTS:
+ *     Context = Pointer to context information (IRP)
+ *     Status  = Status of the request
+ *     Count   = Number of bytes sent or received
+ */
+{
+    PIRP Irp;
+    PIO_STACK_LOCATION IrpSp;
+    PTRANSPORT_CONTEXT TranContext;
+    KIRQL OldIrql;
+
+    TI_DbgPrint(DEBUG_IRP, ("Called for irp %x (%x, %d).\n", 
+			    Context, Status, Count));
+
+    Irp         = Context;
+    IrpSp       = IoGetCurrentIrpStackLocation(Irp);
+    TranContext = (PTRANSPORT_CONTEXT)IrpSp->FileObject->FsContext;
+
+    IoAcquireCancelSpinLock(&OldIrql);
+
+    IoSetCancelRoutine(Irp, NULL);
+
+    if (Irp->Cancel || TranContext->CancelIrps) {
+        /* The IRP has been cancelled */
+
+        TI_DbgPrint(DEBUG_IRP, ("IRP is cancelled.\n"));
+
+        Status = STATUS_CANCELLED;
+        Count  = 0;
+    }
+
+    IoReleaseCancelSpinLock(OldIrql);
+
+    Irp->IoStatus.Status      = Status;
+    Irp->IoStatus.Information = Count;
+
+    TI_DbgPrint(MID_TRACE, ("Irp->IoStatus.Status = %x\n",
+			    Irp->IoStatus.Status));
+    TI_DbgPrint(MID_TRACE, ("Irp->IoStatus.Information = %d\n",
+			    Irp->IoStatus.Information));
+    TI_DbgPrint(DEBUG_IRP, ("Completing IRP at (0x%X).\n", Irp));
+
+    IRPFinish(Irp, Irp->IoStatus.Status);
+
+    TI_DbgPrint(DEBUG_IRP, ("Done Completing IRP\n"));
+}
+
+
 VOID DDKAPI DispCancelRequest(
     PDEVICE_OBJECT Device,
     PIRP Irp)
@@ -112,13 +166,26 @@
         TI_DbgPrint(MIN_TRACE, ("Irp->Cancel is FALSE, should be TRUE.\n"));
 #endif
 
-    IoReleaseCancelSpinLock(Irp->CancelIrql);
-
     /* Try canceling the request */
     switch(MinorFunction) {
     case TDI_SEND:
+        TCPDisconnect
+            ( TranContext->Handle.ConnectionContext,
+              TDI_DISCONNECT_RELEASE,
+              NULL,
+              NULL,
+              DispDataRequestComplete,
+              Irp );
+        break;
+
     case TDI_RECEIVE:
-        /* FIXME: Close connection */
+        TCPDisconnect
+            ( TranContext->Handle.ConnectionContext,
+              TDI_DISCONNECT_ABORT | TDI_DISCONNECT_RELEASE,
+              NULL,
+              NULL,
+              DispDataRequestComplete,
+              Irp );
         break;
 
     case TDI_SEND_DATAGRAM:
@@ -146,64 +213,13 @@
 
     if (Status != STATUS_PENDING)
         DispCancelComplete(FileObject);
+    else
+        IoReleaseCancelSpinLock(Irp->CancelIrql);
 
     TI_DbgPrint(MAX_TRACE, ("Leaving.\n"));
 }
 
-VOID DispDataRequestComplete(
-    PVOID Context,
-    NTSTATUS Status,
-    ULONG Count)
-/*
- * FUNCTION: Completes a send/receive IRP
- * ARGUMENTS:
- *     Context = Pointer to context information (IRP)
- *     Status  = Status of the request
- *     Count   = Number of bytes sent or received
- */
-{
-    PIRP Irp;
-    PIO_STACK_LOCATION IrpSp;
-    PTRANSPORT_CONTEXT TranContext;
-    KIRQL OldIrql;
 
-    TI_DbgPrint(DEBUG_IRP, ("Called for irp %x (%x, %d).\n", 
-			    Context, Status, Count));
-
-    Irp         = Context;
-    IrpSp       = IoGetCurrentIrpStackLocation(Irp);
-    TranContext = (PTRANSPORT_CONTEXT)IrpSp->FileObject->FsContext;
-
-    IoAcquireCancelSpinLock(&OldIrql);
-
-    IoSetCancelRoutine(Irp, NULL);
-
-    if (Irp->Cancel || TranContext->CancelIrps) {
-        /* The IRP has been cancelled */
-
-        TI_DbgPrint(DEBUG_IRP, ("IRP is cancelled.\n"));
-
-        Status = STATUS_CANCELLED;
-        Count  = 0;
-    }
-
-    IoReleaseCancelSpinLock(OldIrql);
-
-    Irp->IoStatus.Status      = Status;
-    Irp->IoStatus.Information = Count;
-
-    TI_DbgPrint(MID_TRACE, ("Irp->IoStatus.Status = %x\n",
-			    Irp->IoStatus.Status));
-    TI_DbgPrint(MID_TRACE, ("Irp->IoStatus.Information = %d\n",
-			    Irp->IoStatus.Information));
-    TI_DbgPrint(DEBUG_IRP, ("Completing IRP at (0x%X).\n", Irp));
-
-    IRPFinish(Irp, Irp->IoStatus.Status);
-
-    TI_DbgPrint(DEBUG_IRP, ("Done Completing IRP\n"));
-}
-
-
 NTSTATUS DispTdiAccept(
   PIRP Irp)
 /*