Index: network/afd/afd/bind.c
===================================================================
--- network/afd/afd/bind.c	(revision 58960)
+++ network/afd/afd/bind.c	(working copy)
@@ -13,7 +13,7 @@
 NTSTATUS WarmSocketForBind( PAFD_FCB FCB, ULONG ShareType ) {
     NTSTATUS Status;
 
-    AFD_DbgPrint(MID_TRACE,("Called (AF %d)\n",
+    AFD_DbgPrint(MID_TRACE,("Called (AF %u)\n",
                             FCB->LocalAddress->Address[0].AddressType));
 
     if( !FCB->TdiDeviceName.Length || !FCB->TdiDeviceName.Buffer ) {
@@ -78,6 +78,8 @@
     PAFD_FCB FCB = FileObject->FsContext;
     PAFD_BIND_DATA BindReq;
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     AFD_DbgPrint(MID_TRACE,("Called\n"));
 
     if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
Index: network/afd/afd/connect.c
===================================================================
--- network/afd/afd/connect.c	(revision 58960)
+++ network/afd/afd/connect.c	(working copy)
@@ -18,6 +18,8 @@
     PAFD_FCB FCB = FileObject->FsContext;
     UINT BufferSize = IrpSp->Parameters.DeviceIoControl.OutputBufferLength;
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp);
 
     if (FCB->ConnectOptionsSize == 0)
@@ -47,6 +49,8 @@
     PVOID ConnectOptions = LockRequest(Irp, IrpSp, FALSE, NULL);
     UINT ConnectOptionsSize = IrpSp->Parameters.DeviceIoControl.InputBufferLength;
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp);
 
     if (!ConnectOptions)
@@ -83,6 +87,8 @@
     PUINT ConnectOptionsSize = LockRequest(Irp, IrpSp, FALSE, NULL);
     UINT BufferSize = IrpSp->Parameters.DeviceIoControl.InputBufferLength;
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp);
 
     if (!ConnectOptionsSize)
@@ -118,6 +124,8 @@
     PAFD_FCB FCB = FileObject->FsContext;
     UINT BufferSize = IrpSp->Parameters.DeviceIoControl.OutputBufferLength;
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp);
 
     if (FCB->ConnectDataSize == 0)
@@ -147,6 +155,8 @@
     PVOID ConnectData = LockRequest(Irp, IrpSp, FALSE, NULL);
     UINT ConnectDataSize = IrpSp->Parameters.DeviceIoControl.InputBufferLength;
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp);
 
     if (!ConnectData)
@@ -182,6 +192,8 @@
     PUINT ConnectDataSize = LockRequest(Irp, IrpSp, FALSE, NULL);
     UINT BufferSize = IrpSp->Parameters.DeviceIoControl.InputBufferLength;
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp);
 
     if (!ConnectDataSize)
@@ -287,6 +299,7 @@
    return Status;
 }
 
+static IO_COMPLETION_ROUTINE StreamSocketConnectComplete;
 static
 NTSTATUS
 NTAPI
@@ -297,7 +310,7 @@
     PLIST_ENTRY NextIrpEntry;
     PIRP NextIrp;
 
-    AFD_DbgPrint(MID_TRACE,("Called: FCB %x, FO %x\n",
+    AFD_DbgPrint(MID_TRACE,("Called: FCB %p, FO %p\n",
                             Context, FCB->FileObject));
 
     /* I was wrong about this before as we can have pending writes to a not
@@ -338,7 +351,7 @@
     while( !IsListEmpty( &FCB->PendingIrpList[FUNCTION_CONNECT] ) ) {
         NextIrpEntry = RemoveHeadList(&FCB->PendingIrpList[FUNCTION_CONNECT]);
         NextIrp = CONTAINING_RECORD(NextIrpEntry, IRP, Tail.Overlay.ListEntry);
-        AFD_DbgPrint(MID_TRACE,("Completing connect %x\n", NextIrp));
+        AFD_DbgPrint(MID_TRACE,("Completing connect %p\n", NextIrp));
         NextIrp->IoStatus.Status = Status;
         NextIrp->IoStatus.Information = NT_SUCCESS(Status) ? ((ULONG_PTR)FCB->Connection.Handle) : 0;
         if( NextIrp->MdlAddress ) UnlockRequest( NextIrp, IoGetCurrentIrpStackLocation( NextIrp ) );
@@ -374,7 +387,7 @@
             NextIrpEntry = RemoveHeadList(&FCB->PendingIrpList[FUNCTION_SEND]);
             NextIrp = CONTAINING_RECORD(NextIrpEntry, IRP,
                                         Tail.Overlay.ListEntry);
-            AFD_DbgPrint(MID_TRACE,("Launching send request %x\n", NextIrp));
+            AFD_DbgPrint(MID_TRACE,("Launching send request %p\n", NextIrp));
             Status = AfdConnectedSocketWriteData
                 ( DeviceObject,
                   NextIrp,
@@ -403,8 +416,10 @@
     PFILE_OBJECT FileObject = IrpSp->FileObject;
     PAFD_FCB FCB = FileObject->FsContext;
     PAFD_CONNECT_INFO ConnectReq;
-    AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB));
+    AFD_DbgPrint(MID_TRACE,("Called on %p\n", FCB));
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
     if( !(ConnectReq = LockRequest( Irp, IrpSp, FALSE, NULL )) )
         return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp,
@@ -494,7 +509,7 @@
 
         FCB->State = SOCKET_STATE_CONNECTING;
 
-        AFD_DbgPrint(MID_TRACE,("Queueing IRP %x\n", Irp));
+        AFD_DbgPrint(MID_TRACE,("Queueing IRP %p\n", Irp));
         Status = QueueUserModeIrp( FCB, Irp, FUNCTION_CONNECT );
         if (Status == STATUS_PENDING)
         {
@@ -517,7 +532,7 @@
         break;
 
     default:
-        AFD_DbgPrint(MIN_TRACE,("Inappropriate socket state %d for connect\n",
+        AFD_DbgPrint(MIN_TRACE,("Inappropriate socket state %u for connect\n",
                                 FCB->State));
         break;
     }
Index: network/afd/afd/context.c
===================================================================
--- network/afd/afd/context.c	(revision 58960)
+++ network/afd/afd/context.c	(working copy)
@@ -17,6 +17,8 @@
     PAFD_FCB FCB = FileObject->FsContext;
     UINT ContextSize = IrpSp->Parameters.DeviceIoControl.OutputBufferLength;
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
 
     if( FCB->ContextSize < ContextSize ) ContextSize = FCB->ContextSize;
@@ -40,6 +42,8 @@
     PFILE_OBJECT FileObject = IrpSp->FileObject;
     PAFD_FCB FCB = FileObject->FsContext;
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
 
     if (IrpSp->Parameters.DeviceIoControl.OutputBufferLength < sizeof(ULONG))
@@ -62,6 +66,8 @@
     PAFD_FCB FCB = FileObject->FsContext;
     PVOID Context = LockRequest(Irp, IrpSp, FALSE, NULL);
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
 
     if (!Context)
Index: network/afd/afd/info.c
===================================================================
--- network/afd/afd/info.c	(revision 58960)
+++ network/afd/afd/info.c	(working copy)
@@ -18,7 +18,9 @@
     PAFD_FCB FCB = FileObject->FsContext;
     PLIST_ENTRY CurrentEntry;
 
-    AFD_DbgPrint(MID_TRACE,("Called %x %x\n", InfoReq,
+    UNREFERENCED_PARAMETER(DeviceObject);
+
+    AFD_DbgPrint(MID_TRACE,("Called %p %x\n", InfoReq,
                             InfoReq ? InfoReq->InformationClass : 0));
 
     if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
@@ -34,13 +36,13 @@
 
         case AFD_INFO_SEND_WINDOW_SIZE:
             InfoReq->Information.Ulong = FCB->Send.Size;
-            AFD_DbgPrint(MID_TRACE,("Send window size %d\n", FCB->Send.Size));
+            AFD_DbgPrint(MID_TRACE,("Send window size %u\n", FCB->Send.Size));
             break;
 
         case AFD_INFO_GROUP_ID_TYPE:
             InfoReq->Information.LargeInteger.u.HighPart = FCB->GroupType;
             InfoReq->Information.LargeInteger.u.LowPart = FCB->GroupID;
-            AFD_DbgPrint(MID_TRACE, ("Group ID: %d Group Type: %d\n", FCB->GroupID, FCB->GroupType));
+            AFD_DbgPrint(MID_TRACE, ("Group ID: %u Group Type: %u\n", FCB->GroupID, FCB->GroupType));
             break;
 
         case AFD_INFO_BLOCKING_MODE:
@@ -104,6 +106,8 @@
     PAFD_FCB FCB = FileObject->FsContext;
     PCHAR NewBuffer;
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp);
 
     if (!InfoReq)
@@ -171,7 +175,7 @@
                 }
                 break;
             default:
-                AFD_DbgPrint(MIN_TRACE,("Unknown request %d\n", InfoReq->InformationClass));
+                AFD_DbgPrint(MIN_TRACE,("Unknown request %u\n", InfoReq->InformationClass));
                 break;
         }
     } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
@@ -192,6 +196,8 @@
     PAFD_FCB FCB = FileObject->FsContext;
     PMDL Mdl = NULL;
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
 
     if( FCB->AddressFile.Object == NULL && FCB->Connection.Object == NULL ) {
@@ -232,6 +238,7 @@
     PFILE_OBJECT FileObject = IrpSp->FileObject;
     PAFD_FCB FCB = FileObject->FsContext;
 
+    UNREFERENCED_PARAMETER(DeviceObject);
 
     if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
 
Index: network/afd/afd/listen.c
===================================================================
--- network/afd/afd/listen.c	(revision 58960)
+++ network/afd/afd/listen.c	(working copy)
@@ -16,11 +16,13 @@
     PAFD_FCB FCB = NewFileObject->FsContext;
     NTSTATUS Status;
 
+    UNREFERENCED_PARAMETER(DeviceExt);
+
     if( !SocketAcquireStateLock( FCB ) )
         return LostSocket( Irp );
 
     /* Transfer the connection to the new socket, launch the opening read */
-    AFD_DbgPrint(MID_TRACE,("Completing a real accept (FCB %x)\n", FCB));
+    AFD_DbgPrint(MID_TRACE,("Completing a real accept (FCB %p)\n", FCB));
 
     FCB->Connection = Qelt->Object;
 
@@ -49,8 +51,8 @@
 
     ListenReceive->SequenceNumber = Qelt->Seq;
 
-    AFD_DbgPrint(MID_TRACE,("Giving SEQ %d to userland\n", Qelt->Seq));
-    AFD_DbgPrint(MID_TRACE,("Socket Address (K) %x (U) %x\n",
+    AFD_DbgPrint(MID_TRACE,("Giving SEQ %u to userland\n", Qelt->Seq));
+    AFD_DbgPrint(MID_TRACE,("Socket Address (K) %p (U) %p\n",
                             &ListenReceive->Address,
                             Qelt->ConnInfo->RemoteAddress));
 
@@ -61,9 +63,9 @@
 
     AFD_DbgPrint(MID_TRACE,("IPAddr->TAAddressCount %d\n",
                             IPAddr->TAAddressCount));
-    AFD_DbgPrint(MID_TRACE,("IPAddr->Address[0].AddressType %d\n",
+    AFD_DbgPrint(MID_TRACE,("IPAddr->Address[0].AddressType %u\n",
                             IPAddr->Address[0].AddressType));
-    AFD_DbgPrint(MID_TRACE,("IPAddr->Address[0].AddressLength %d\n",
+    AFD_DbgPrint(MID_TRACE,("IPAddr->Address[0].AddressLength %u\n",
                             IPAddr->Address[0].AddressLength));
     AFD_DbgPrint(MID_TRACE,("IPAddr->Address[0].Address[0].sin_port %x\n",
                             IPAddr->Address[0].Address[0].sin_port));
@@ -79,6 +81,7 @@
     return STATUS_SUCCESS;
 }
 
+static IO_COMPLETION_ROUTINE ListenComplete;
 static NTSTATUS NTAPI ListenComplete( PDEVICE_OBJECT DeviceObject,
                                       PIRP Irp,
                                       PVOID Context ) {
@@ -88,6 +91,8 @@
     PLIST_ENTRY NextIrpEntry;
     PIRP NextIrp;
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     if( !SocketAcquireStateLock( FCB ) )
         return STATUS_FILE_CLOSED;
 
@@ -141,7 +146,7 @@
 
         Qelt->Object = FCB->Connection;
         Qelt->Seq = FCB->ConnSeq++;
-        AFD_DbgPrint(MID_TRACE,("Address Type: %d (RA %x)\n",
+        AFD_DbgPrint(MID_TRACE,("Address Type: %u (RA %p)\n",
                                 AddressType,
                                 FCB->ListenIrp.
                                 ConnectionReturnInfo->RemoteAddress));
@@ -213,8 +218,10 @@
     PAFD_FCB FCB = FileObject->FsContext;
     PAFD_LISTEN_DATA ListenReq;
 
-    AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB));
+    UNREFERENCED_PARAMETER(DeviceObject);
 
+    AFD_DbgPrint(MID_TRACE,("Called on %p\n", FCB));
+
     if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
 
     if( !(ListenReq = LockRequest( Irp, IrpSp, FALSE, NULL )) )
@@ -229,7 +236,7 @@
 
     FCB->DelayedAccept = ListenReq->UseDelayedAcceptance;
 
-    AFD_DbgPrint(MID_TRACE,("ADDRESSFILE: %x\n", FCB->AddressFile.Handle));
+    AFD_DbgPrint(MID_TRACE,("ADDRESSFILE: %p\n", FCB->AddressFile.Handle));
 
     Status = WarmSocketForConnection( FCB );
 
@@ -277,6 +284,8 @@
     PAFD_FCB FCB = FileObject->FsContext;
     NTSTATUS Status;
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     AFD_DbgPrint(MID_TRACE,("Called\n"));
 
     if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
@@ -335,7 +344,7 @@
         PAFD_TDI_OBJECT_QELT PendingConnObj =
             CONTAINING_RECORD( PendingConn, AFD_TDI_OBJECT_QELT, ListEntry );
 
-        AFD_DbgPrint(MID_TRACE,("Comparing Seq %d to Q %d\n",
+        AFD_DbgPrint(MID_TRACE,("Comparing Seq %u to Q %u\n",
                                 AcceptData->SequenceNumber,
                                 PendingConnObj->Seq));
 
Index: network/afd/afd/lock.c
===================================================================
--- network/afd/afd/lock.c	(revision 58960)
+++ network/afd/afd/lock.c	(working copy)
@@ -14,6 +14,8 @@
     ASSERT(Irp->MdlAddress);
     ASSERT(Irp->Tail.Overlay.DriverContext[0]);
 
+    UNREFERENCED_PARAMETER(IrpSp);
+
     return Irp->Tail.Overlay.DriverContext[0];
 }
 
@@ -173,6 +175,8 @@
     ASSERT(Irp->MdlAddress);
     ASSERT(Irp->Tail.Overlay.DriverContext[0]);
 
+    UNREFERENCED_PARAMETER(IrpSp);
+
     /* Check if we need to copy stuff back */
     if (Irp->Tail.Overlay.DriverContext[1] != NULL)
     {
@@ -203,7 +207,7 @@
     BOOLEAN LockFailed = FALSE;
     PAFD_MAPBUF MapBuf;
 
-    AFD_DbgPrint(MID_TRACE,("Called(%08x)\n", NewBuf));
+    AFD_DbgPrint(MID_TRACE,("Called(%p)\n", NewBuf));
 
     if( NewBuf ) {
         RtlZeroMemory(NewBuf, Size);
@@ -223,14 +227,14 @@
             }
         } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
             AFD_DbgPrint(MIN_TRACE,("Access violation copying buffer info "
-                                    "from userland (%x %x)\n",
+                                    "from userland (%p %p)\n",
                                     Buf, AddressLen));
             ExFreePool( NewBuf );
             _SEH2_YIELD(return NULL);
         } _SEH2_END;
 
         for( i = 0; i < Count; i++ ) {
-            AFD_DbgPrint(MID_TRACE,("Locking buffer %d (%x:%d)\n",
+            AFD_DbgPrint(MID_TRACE,("Locking buffer %u (%p:%u)\n",
                                     i, NewBuf[i].buf, NewBuf[i].len));
 
             if( NewBuf[i].buf && NewBuf[i].len ) {
@@ -244,7 +248,7 @@
                 continue;
             }
 
-            AFD_DbgPrint(MID_TRACE,("NewMdl @ %x\n", MapBuf[i].Mdl));
+            AFD_DbgPrint(MID_TRACE,("NewMdl @ %p\n", MapBuf[i].Mdl));
 
             if( MapBuf[i].Mdl ) {
                 AFD_DbgPrint(MID_TRACE,("Probe and lock pages\n"));
Index: network/afd/afd/main.c
===================================================================
--- network/afd/afd/main.c	(revision 58960)
+++ network/afd/afd/main.c	(working copy)
@@ -46,6 +46,8 @@
     PAFD_FCB FCB = FileObject->FsContext;
     UINT BufferSize = IrpSp->Parameters.DeviceIoControl.OutputBufferLength;
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp);
 
     if (FCB->DisconnectOptionsSize == 0)
@@ -75,6 +77,8 @@
     PVOID DisconnectOptions = LockRequest(Irp, IrpSp, FALSE, NULL);
     UINT DisconnectOptionsSize = IrpSp->Parameters.DeviceIoControl.InputBufferLength;
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp);
 
     if (!DisconnectOptions)
@@ -111,6 +115,8 @@
     PUINT DisconnectOptionsSize = LockRequest(Irp, IrpSp, FALSE, NULL);
     UINT BufferSize = IrpSp->Parameters.DeviceIoControl.InputBufferLength;
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp);
 
     if (!DisconnectOptionsSize)
@@ -145,6 +151,8 @@
     PAFD_FCB FCB = FileObject->FsContext;
     UINT BufferSize = IrpSp->Parameters.DeviceIoControl.OutputBufferLength;
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp);
 
     if (FCB->DisconnectDataSize == 0)
@@ -175,6 +183,8 @@
     PVOID DisconnectData = LockRequest(Irp, IrpSp, FALSE, NULL);
     UINT DisconnectDataSize = IrpSp->Parameters.DeviceIoControl.InputBufferLength;
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp);
 
     if (!DisconnectData)
@@ -211,6 +221,8 @@
     PUINT DisconnectDataSize = LockRequest(Irp, IrpSp, FALSE, NULL);
     UINT BufferSize = IrpSp->Parameters.DeviceIoControl.InputBufferLength;
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp);
 
     if (!DisconnectDataSize)
@@ -247,6 +259,8 @@
     PULONG HandleFlags = LockRequest(Irp, IrpSp, TRUE, NULL);
     PAFD_TDI_HANDLE_DATA HandleData = Irp->UserBuffer;
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp);
 
     if (!HandleFlags)
@@ -299,7 +313,7 @@
 
         //EaLength = sizeof(FILE_FULL_EA_INFORMATION) + EaInfo->EaNameLength + EaInfo->EaValueLength;
 
-        AFD_DbgPrint(MID_TRACE,("EaInfo: %x, EaInfoValue: %x\n",
+        AFD_DbgPrint(MID_TRACE,("EaInfo: %p, EaInfoValue: %p\n",
                                 EaInfo, EaInfoValue));
     }
 
@@ -312,7 +326,7 @@
         return STATUS_NO_MEMORY;
     }
 
-    AFD_DbgPrint(MID_TRACE,("Initializing the new FCB @ %x (FileObject %x Flags %x)\n",
+    AFD_DbgPrint(MID_TRACE,("Initializing the new FCB @ %p (FileObject %p Flags %x)\n",
                             FCB, FileObject, ConnectInfo ? ConnectInfo->EndpointFlags : 0));
 
     RtlZeroMemory( FCB, sizeof( *FCB ) );
@@ -335,7 +349,7 @@
     InitializeListHead( &FCB->DatagramList );
     InitializeListHead( &FCB->PendingConnections );
 
-    AFD_DbgPrint(MID_TRACE,("%x: Checking command channel\n", FCB));
+    AFD_DbgPrint(MID_TRACE,("%p: Checking command channel\n", FCB));
 
     if( ConnectInfo ) {
         FCB->TdiDeviceName.Length = ConnectInfo->SizeOfTransportName;
@@ -395,6 +409,8 @@
     UINT Function;
     PIRP CurrentIrp;
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     if( !SocketAcquireStateLock( FCB ) ) return LostSocket(Irp);
 
     for (Function = 0; Function < MAX_FUNCTIONS; Function++)
@@ -445,7 +461,7 @@
     /* Cancel our pending requests */
     for( i = 0; i < IN_FLIGHT_REQUESTS; i++ ) {
         if( InFlightRequest[i]->InFlightRequest ) {
-            AFD_DbgPrint(MID_TRACE,("Cancelling in flight irp %d (%x)\n",
+            AFD_DbgPrint(MID_TRACE,("Cancelling in flight irp %u (%p)\n",
                                     i, InFlightRequest[i]->InFlightRequest));
             IoCancelIrp(InFlightRequest[i]->InFlightRequest);
         }
@@ -526,7 +542,7 @@
     {
         if (ZwClose(FCB->AddressFile.Handle) == STATUS_INVALID_HANDLE)
         {
-            DbgPrint("INVALID ADDRESS FILE HANDLE VALUE: %x %x\n", FCB->AddressFile.Handle, FCB->AddressFile.Object);
+            DbgPrint("INVALID ADDRESS FILE HANDLE VALUE: %p %p\n", FCB->AddressFile.Handle, FCB->AddressFile.Object);
         }
     }
 
@@ -534,7 +550,7 @@
     {
         if (ZwClose(FCB->Connection.Handle) == STATUS_INVALID_HANDLE)
         {
-            DbgPrint("INVALID CONNECTION HANDLE VALUE: %x %x\n", FCB->Connection.Handle, FCB->Connection.Object);
+            DbgPrint("INVALID CONNECTION HANDLE VALUE: %p %p\n", FCB->Connection.Handle, FCB->Connection.Object);
         }
     }
 
@@ -552,6 +568,7 @@
     return STATUS_SUCCESS;
 }
 
+static IO_COMPLETION_ROUTINE DisconnectComplete;
 static
 NTSTATUS
 NTAPI
@@ -563,6 +580,8 @@
     PIRP CurrentIrp;
     PLIST_ENTRY CurrentEntry;
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     if (!SocketAcquireStateLock(FCB))
         return STATUS_FILE_CLOSED;
 
@@ -679,6 +698,8 @@
     PLIST_ENTRY CurrentEntry;
     PIRP CurrentIrp;
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp);
 
     if (!(DisReq = LockRequest(Irp, IrpSp, FALSE, NULL)))
@@ -809,6 +830,7 @@
     return UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
 }
 
+static DRIVER_DISPATCH AfdDispatch;
 static NTSTATUS NTAPI
 AfdDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
 {
@@ -818,9 +840,9 @@
     PFILE_OBJECT FileObject = IrpSp->FileObject;
 #endif
 
-    AFD_DbgPrint(MID_TRACE,("AfdDispatch: %d\n", IrpSp->MajorFunction));
+    AFD_DbgPrint(MID_TRACE,("AfdDispatch: %u\n", IrpSp->MajorFunction));
     if( IrpSp->MajorFunction != IRP_MJ_CREATE) {
-        AFD_DbgPrint(MID_TRACE,("FO %x, IrpSp->FO %x\n",
+        AFD_DbgPrint(MID_TRACE,("FO %p, IrpSp->FO %p\n",
                                 FileObject, IrpSp->FileObject));
         ASSERT(FileObject == IrpSp->FileObject);
     }
@@ -1082,7 +1104,8 @@
     }
 }
 
-VOID NTAPI
+VOID
+NTAPI
 AfdCancelHandler(PDEVICE_OBJECT DeviceObject,
                  PIRP Irp)
 {
@@ -1199,12 +1222,14 @@
 
     SocketStateUnlock(FCB);
 
-    DbgPrint("WARNING!!! IRP cancellation race could lead to a process hang! (Function: %d)\n", Function);
+    DbgPrint("WARNING!!! IRP cancellation race could lead to a process hang! (Function: %u)\n", Function);
 }
 
+static DRIVER_UNLOAD AfdUnload;
 static VOID NTAPI
 AfdUnload(PDRIVER_OBJECT DriverObject)
 {
+    UNREFERENCED_PARAMETER(DriverObject);
 }
 
 NTSTATUS NTAPI
@@ -1215,6 +1240,7 @@
     PAFD_DEVICE_EXTENSION DeviceExt;
     NTSTATUS Status;
 
+    UNREFERENCED_PARAMETER(RegistryPath);
     /* register driver routines */
     DriverObject->MajorFunction[IRP_MJ_CLOSE] = AfdDispatch;
     DriverObject->MajorFunction[IRP_MJ_CREATE] = AfdDispatch;
@@ -1242,7 +1268,7 @@
     KeInitializeSpinLock( &DeviceExt->Lock );
     InitializeListHead( &DeviceExt->Polls );
 
-    AFD_DbgPrint(MID_TRACE,("Device created: object %x ext %x\n",
+    AFD_DbgPrint(MID_TRACE,("Device created: object %p ext %p\n",
                             DeviceObject, DeviceExt));
 
     return Status;
Index: network/afd/afd/read.c
===================================================================
--- network/afd/afd/read.c	(revision 58960)
+++ network/afd/afd/read.c	(working copy)
@@ -101,15 +101,14 @@
     *TotalBytesCopied = 0;
 
 
-    AFD_DbgPrint(MID_TRACE,("Called, BytesAvailable = %d\n",
-                            BytesAvailable));
+    AFD_DbgPrint(MID_TRACE,("Called, BytesAvailable = %u\n",BytesAvailable));
 
     if( CantReadMore(FCB) ) return STATUS_SUCCESS;
     if( !BytesAvailable ) return STATUS_PENDING;
 
     Map = (PAFD_MAPBUF)(RecvReq->BufferArray + RecvReq->BufferCount);
 
-    AFD_DbgPrint(MID_TRACE,("Buffer Count: %d @ %x\n",
+    AFD_DbgPrint(MID_TRACE,("Buffer Count: %u @ %p\n",
                             RecvReq->BufferCount,
                             RecvReq->BufferArray));
     for( i = 0;
@@ -123,7 +122,7 @@
         if( Map[i].Mdl ) {
             Map[i].BufferAddress = MmMapLockedPages( Map[i].Mdl, KernelMode );
 
-            AFD_DbgPrint(MID_TRACE,("Buffer %d: %x:%d\n",
+            AFD_DbgPrint(MID_TRACE,("Buffer %u: %p:%u\n",
                                     i,
                                     Map[i].BufferAddress,
                                     BytesToCopy));
@@ -157,9 +156,9 @@
     UINT TotalBytesCopied = 0, RetBytesCopied = 0;
     NTSTATUS Status = STATUS_SUCCESS, RetStatus = STATUS_PENDING;
 
-    AFD_DbgPrint(MID_TRACE,("%x %x\n", FCB, Irp));
+    AFD_DbgPrint(MID_TRACE,("%p %p\n", FCB, Irp));
 
-    AFD_DbgPrint(MID_TRACE,("FCB %x Receive data waiting %d\n",
+    AFD_DbgPrint(MID_TRACE,("FCB %p Receive data waiting %u\n",
                             FCB, FCB->Recv.Content));
 
     if( CantReadMore( FCB ) ) {
@@ -172,7 +171,7 @@
             NextIrpSp = IoGetCurrentIrpStackLocation( NextIrp );
             RecvReq = GetLockedData(NextIrp, NextIrpSp);
 
-            AFD_DbgPrint(MID_TRACE,("Completing recv %x (%d)\n", NextIrp,
+            AFD_DbgPrint(MID_TRACE,("Completing recv %p (%u)\n", NextIrp,
                                     TotalBytesCopied));
             UnlockBuffers( RecvReq->BufferArray,
                            RecvReq->BufferCount, FALSE );
@@ -198,7 +197,7 @@
         /* Kick the user that receive would be possible now */
         /* XXX Not implemented yet */
 
-        AFD_DbgPrint(MID_TRACE,("FCB %x Receive data waiting %d\n",
+        AFD_DbgPrint(MID_TRACE,("FCB %p Receive data waiting %u\n",
                                 FCB, FCB->Recv.Content));
         /*OskitDumpBuffer( FCB->Recv.Window, FCB->Recv.Content );*/
 
@@ -209,18 +208,18 @@
             NextIrpSp = IoGetCurrentIrpStackLocation( NextIrp );
             RecvReq = GetLockedData(NextIrp, NextIrpSp);
 
-            AFD_DbgPrint(MID_TRACE,("RecvReq @ %x\n", RecvReq));
+            AFD_DbgPrint(MID_TRACE,("RecvReq @ %p\n", RecvReq));
 
             Status = TryToSatisfyRecvRequestFromBuffer
             ( FCB, RecvReq, &TotalBytesCopied );
 
             if( Status == STATUS_PENDING ) {
-                AFD_DbgPrint(MID_TRACE,("Ran out of data for %x\n", NextIrp));
+                AFD_DbgPrint(MID_TRACE,("Ran out of data for %p\n", NextIrp));
                 InsertHeadList(&FCB->PendingIrpList[FUNCTION_RECV],
                                &NextIrp->Tail.Overlay.ListEntry);
                 break;
             } else {
-                AFD_DbgPrint(MID_TRACE,("Completing recv %x (%d)\n", NextIrp,
+                AFD_DbgPrint(MID_TRACE,("Completing recv %p (%u)\n", NextIrp,
                                         TotalBytesCopied));
                 UnlockBuffers( RecvReq->BufferArray,
                                RecvReq->BufferCount, FALSE );
@@ -263,7 +262,7 @@
         PollReeval(FCB->DeviceExt, FCB->FileObject);
     }
 
-    AFD_DbgPrint(MID_TRACE,("RetStatus for irp %x is %x\n", Irp, RetStatus));
+    AFD_DbgPrint(MID_TRACE,("RetStatus for irp %p is %x\n", Irp, RetStatus));
 
     /* Sometimes we're called with a NULL Irp */
     if( Irp ) {
@@ -274,6 +273,7 @@
     return RetStatus;
 }
 
+
 NTSTATUS NTAPI ReceiveComplete
 ( PDEVICE_OBJECT DeviceObject,
   PIRP Irp,
@@ -284,6 +284,8 @@
     PAFD_RECV_INFO RecvReq;
     PIO_STACK_LOCATION NextIrpSp;
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     AFD_DbgPrint(MID_TRACE,("Called\n"));
 
     if( !SocketAcquireStateLock( FCB ) )
@@ -341,7 +343,7 @@
 
     BytesToCopy = MIN( RecvReq->BufferArray[0].len, BytesAvailable );
 
-    AFD_DbgPrint(MID_TRACE,("BytesToCopy: %d len %d\n", BytesToCopy,
+    AFD_DbgPrint(MID_TRACE,("BytesToCopy: %u len %u\n", BytesToCopy,
                             RecvReq->BufferArray[0].len));
 
     if( Map[0].Mdl ) {
@@ -362,7 +364,7 @@
                           sizeof(USHORT),
                           RecvReq->BufferArray[1].len);
 
-            AFD_DbgPrint(MID_TRACE,("Copying %d bytes of address\n", AddrLen));
+            AFD_DbgPrint(MID_TRACE,("Copying %u bytes of address\n", AddrLen));
 
             Map[1].BufferAddress = MmMapLockedPages( Map[1].Mdl, KernelMode );
 
@@ -385,7 +387,7 @@
 
         Map[0].BufferAddress = MmMapLockedPages( Map[0].Mdl, KernelMode );
 
-        AFD_DbgPrint(MID_TRACE,("Buffer %d: %x:%d\n",
+        AFD_DbgPrint(MID_TRACE,("Buffer %d: %p:%u\n",
                                 0,
                                 Map[0].BufferAddress,
                                 BytesToCopy));
@@ -436,8 +438,11 @@
     PLIST_ENTRY ListEntry;
     KPROCESSOR_MODE LockMode;
 
-    AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB));
+    UNREFERENCED_PARAMETER(DeviceObject);
+    UNREFERENCED_PARAMETER(Short);
 
+    AFD_DbgPrint(MID_TRACE,("Called on %p\n", FCB));
+
     if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
 
     FCB->EventSelectDisabled &= ~AFD_EVENT_RECEIVE;
@@ -557,8 +562,10 @@
     PAFD_STORED_DATAGRAM DatagramRecv;
     UINT DGSize = Irp->IoStatus.Information + sizeof( AFD_STORED_DATAGRAM );
     PLIST_ENTRY NextIrpEntry, DatagramRecvEntry;
+    
+    UNREFERENCED_PARAMETER(DeviceObject);
 
-    AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB));
+    AFD_DbgPrint(MID_TRACE,("Called on %p\n", FCB));
 
     if( !SocketAcquireStateLock( FCB ) )
         return STATUS_FILE_CLOSED;
@@ -611,7 +618,7 @@
         DatagramRecv->Len = Irp->IoStatus.Information;
         RtlCopyMemory( DatagramRecv->Buffer, FCB->Recv.Window,
                        DatagramRecv->Len );
-        AFD_DbgPrint(MID_TRACE,("Received (A %x)\n",
+        AFD_DbgPrint(MID_TRACE,("Received (A %p)\n",
                                 FCB->AddressFrom->RemoteAddress));
         DatagramRecv->Address =
             TaCopyTransportAddress( FCB->AddressFrom->RemoteAddress );
@@ -642,7 +649,7 @@
         NextIrpSp = IoGetCurrentIrpStackLocation( NextIrp );
         RecvReq = GetLockedData(NextIrp, NextIrpSp);
 
-        AFD_DbgPrint(MID_TRACE,("RecvReq: %x, DatagramRecv: %x\n",
+        AFD_DbgPrint(MID_TRACE,("RecvReq: %p, DatagramRecv: %p\n",
                                 RecvReq, DatagramRecv));
 
         AFD_DbgPrint(MID_TRACE,("Satisfying\n"));
@@ -705,8 +712,10 @@
     PAFD_STORED_DATAGRAM DatagramRecv;
     KPROCESSOR_MODE LockMode;
 
-    AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB));
+    UNREFERENCED_PARAMETER(DeviceObject);
 
+    AFD_DbgPrint(MID_TRACE,("Called on %p\n", FCB));
+
     if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
 
     FCB->EventSelectDisabled &= ~AFD_EVENT_RECEIVE;
Index: network/afd/afd/select.c
===================================================================
--- network/afd/afd/select.c	(revision 58960)
+++ network/afd/afd/select.c	(working copy)
@@ -91,7 +91,8 @@
     AFD_DbgPrint(MID_TRACE,("Done\n"));
 }
 
-static VOID SelectTimeout( PKDPC Dpc,
+static KDEFERRED_ROUTINE SelectTimeout;
+static VOID NTAPI SelectTimeout( PKDPC Dpc,
                            PVOID DeferredContext,
                            PVOID SystemArgument1,
                            PVOID SystemArgument2 ) {
@@ -101,6 +102,10 @@
     KIRQL OldIrql;
     PAFD_DEVICE_EXTENSION DeviceExt;
 
+    UNREFERENCED_PARAMETER(Dpc);
+    UNREFERENCED_PARAMETER(SystemArgument1);
+    UNREFERENCED_PARAMETER(SystemArgument2);
+
     AFD_DbgPrint(MID_TRACE,("Called\n"));
 
     Irp = Poll->Irp;
@@ -127,7 +132,7 @@
     PAFD_HANDLE HandleArray;
     UINT i;
 
-    AFD_DbgPrint(MID_TRACE,("Killing selects that refer to %x\n", FileObject));
+    AFD_DbgPrint(MID_TRACE,("Killing selects that refer to %p\n", FileObject));
 
     KeAcquireSpinLock( &DeviceExt->Lock, &OldIrql );
 
@@ -140,7 +145,7 @@
         HandleArray = AFD_HANDLES(PollReq);
 
         for( i = 0; i < PollReq->HandleCount; i++ ) {
-            AFD_DbgPrint(MAX_TRACE,("Req: %x, This %x\n",
+            AFD_DbgPrint(MAX_TRACE,("Req: %p, This %p\n",
                                     HandleArray[i].Handle, FileObject));
             if( (PVOID)HandleArray[i].Handle == FileObject &&
                 (!OnlyExclusive || (OnlyExclusive && Poll->Exclusive)) ) {
@@ -167,7 +172,9 @@
     UINT i, Signalled = 0;
     ULONG Exclusive = PollReq->Exclusive;
 
-    AFD_DbgPrint(MID_TRACE,("Called (HandleCount %d Timeout %d)\n",
+    UNREFERENCED_PARAMETER(IrpSp);
+
+    AFD_DbgPrint(MID_TRACE,("Called (HandleCount %u Timeout %d)\n",
                             PollReq->HandleCount,
                             (INT)(PollReq->Timeout.QuadPart)));
 
@@ -206,7 +213,7 @@
         PollReq->Handles[i].Status =
             PollReq->Handles[i].Events & FCB->PollState;
         if( PollReq->Handles[i].Status ) {
-            AFD_DbgPrint(MID_TRACE,("Signalling %x with %x\n",
+            AFD_DbgPrint(MID_TRACE,("Signalling %p with %x\n",
                                     FCB, FCB->PollState));
             Signalled++;
         }
@@ -229,9 +236,7 @@
 
           KeInitializeTimerEx( &Poll->Timer, NotificationTimer );
 
-          KeInitializeDpc( (PRKDPC)&Poll->TimeoutDpc,
-             (PKDEFERRED_ROUTINE)SelectTimeout,
-             Poll );
+          KeInitializeDpc( (PRKDPC)&Poll->TimeoutDpc,SelectTimeout,Poll );
 
           InsertTailList( &DeviceExt->Polls, &Poll->ListEntry );
 
@@ -262,6 +267,8 @@
         (PAFD_EVENT_SELECT_INFO)LockRequest( Irp, IrpSp, FALSE, NULL );
     PAFD_FCB FCB = FileObject->FsContext;
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     if( !SocketAcquireStateLock( FCB ) ) {
         return LostSocket( Irp );
     }
@@ -270,7 +277,7 @@
          return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp,
                                         0 );
     }
-    AFD_DbgPrint(MID_TRACE,("Called (Event %x Triggers %x)\n",
+    AFD_DbgPrint(MID_TRACE,("Called (Event %p Triggers %d)\n",
                             EventSelectInfo->EventObject,
                             EventSelectInfo->Events));
 
@@ -302,7 +309,7 @@
     if((FCB->EventSelect) &&
        (FCB->PollState & (FCB->EventSelectTriggers & ~FCB->EventSelectDisabled)))
     {
-        AFD_DbgPrint(MID_TRACE,("Setting event %x\n", FCB->EventSelect));
+        AFD_DbgPrint(MID_TRACE,("Setting event %p\n", FCB->EventSelect));
 
         /* Set the application's event */
         KeSetEvent( FCB->EventSelect, IO_NETWORK_INCREMENT, FALSE );
@@ -324,8 +331,10 @@
     PKEVENT UserEvent;
     NTSTATUS Status;
 
-    AFD_DbgPrint(MID_TRACE,("Called (FCB %x)\n", FCB));
+    UNREFERENCED_PARAMETER(DeviceObject);
 
+    AFD_DbgPrint(MID_TRACE,("Called (FCB %p)\n", FCB));
+
     if( !SocketAcquireStateLock( FCB ) ) {
         return LostSocket( Irp );
     }
@@ -379,7 +388,7 @@
 
         PollReq->Handles[i].Status = PollReq->Handles[i].Events & FCB->PollState;
         if( PollReq->Handles[i].Status ) {
-            AFD_DbgPrint(MID_TRACE,("Signalling %x with %x\n",
+            AFD_DbgPrint(MID_TRACE,("Signalling %p with %x\n",
                                     FCB, FCB->PollState));
             Signalled++;
         }
@@ -395,7 +404,7 @@
     KIRQL OldIrql;
     PAFD_POLL_INFO PollReq;
 
-    AFD_DbgPrint(MID_TRACE,("Called: DeviceExt %x FileObject %x\n",
+    AFD_DbgPrint(MID_TRACE,("Called: DeviceExt %p FileObject %p\n",
                             DeviceExt, FileObject));
 
     KeAcquireSpinLock( &DeviceExt->Lock, &OldIrql );
@@ -414,7 +423,7 @@
     while( ThePollEnt != &DeviceExt->Polls ) {
         Poll = CONTAINING_RECORD( ThePollEnt, AFD_ACTIVE_POLL, ListEntry );
         PollReq = Poll->Irp->AssociatedIrp.SystemBuffer;
-        AFD_DbgPrint(MID_TRACE,("Checking poll %x\n", Poll));
+        AFD_DbgPrint(MID_TRACE,("Checking poll %p\n", Poll));
 
         if( UpdatePollWithFCB( Poll, FileObject ) ) {
             ThePollEnt = ThePollEnt->Flink;
@@ -429,7 +438,7 @@
     if((FCB->EventSelect) &&
        (FCB->PollState & (FCB->EventSelectTriggers & ~FCB->EventSelectDisabled)))
     {
-        AFD_DbgPrint(MID_TRACE,("Setting event %x\n", FCB->EventSelect));
+        AFD_DbgPrint(MID_TRACE,("Setting event %p\n", FCB->EventSelect));
 
         /* Set the application's event */
         KeSetEvent( FCB->EventSelect, IO_NETWORK_INCREMENT, FALSE );
Index: network/afd/afd/tdi.c
===================================================================
--- network/afd/afd/tdi.c	(revision 58960)
+++ network/afd/afd/tdi.c	(working copy)
@@ -64,7 +64,7 @@
 
     AFD_DbgPrint(MID_TRACE, ("Called\n"));
 
-    AFD_DbgPrint(MID_TRACE, ("Irp->UserEvent = %x\n", Irp->UserEvent));
+    AFD_DbgPrint(MID_TRACE, ("Irp->UserEvent = %p\n", Irp->UserEvent));
 
     Status = IoCallDriver(DeviceObject, Irp);
     AFD_DbgPrint(MID_TRACE, ("IoCallDriver: %08x\n", Status));
@@ -109,7 +109,7 @@
     NTSTATUS Status;
     ULONG ShareAccess;
 
-    AFD_DbgPrint(MAX_TRACE, ("Called. DeviceName (%wZ, %d)\n", DeviceName, ShareType));
+    AFD_DbgPrint(MAX_TRACE, ("Called. DeviceName (%wZ, %u)\n", DeviceName, ShareType));
 
     /* Determine the share access */
     if (ShareType != AFD_SHARE_REUSE)
@@ -152,7 +152,7 @@
             AFD_DbgPrint(MIN_TRACE, ("ObReferenceObjectByHandle() failed with status (0x%X).\n", Status));
             ZwClose(*Handle);
         } else {
-            AFD_DbgPrint(MAX_TRACE, ("Got handle (0x%X)  Object (0x%X)\n",
+            AFD_DbgPrint(MAX_TRACE, ("Got handle (%p)  Object (%p)\n",
                                      *Handle, *Object));
         }
     } else {
@@ -189,7 +189,7 @@
     ULONG EaLength;
     PTRANSPORT_ADDRESS Address;
 
-    AFD_DbgPrint(MAX_TRACE, ("Called. DeviceName (%wZ)  Name (0x%X)\n",
+    AFD_DbgPrint(MAX_TRACE, ("Called. DeviceName (%wZ)  Name (%p)\n",
                              DeviceName, Name));
 
     /* EaName must be 0-terminated, even though TDI_TRANSPORT_ADDRESS_LENGTH does *not* include the 0 */
@@ -399,7 +399,7 @@
     KEVENT Event;
     PIRP Irp;
 
-    AFD_DbgPrint(MAX_TRACE, ("Called. AddressHandle (0x%X)  ConnectionObject (0x%X)\n",
+    AFD_DbgPrint(MAX_TRACE, ("Called. AddressHandle (%p)  ConnectionObject (%p)\n",
                              AddressHandle, ConnectionObject));
 
     if (!ConnectionObject) {
@@ -448,7 +448,7 @@
     KEVENT Event;
     PIRP Irp;
 
-    AFD_DbgPrint(MAX_TRACE, ("Called. ConnectionObject (0x%X)\n", ConnectionObject));
+    AFD_DbgPrint(MAX_TRACE, ("Called. ConnectionObject (%p)\n", ConnectionObject));
 
     if (!ConnectionObject) {
         AFD_DbgPrint(MIN_TRACE, ("Bad connection object.\n"));
@@ -803,7 +803,7 @@
     /* Locate an IP entity */
     EntityCount = BufferSize / sizeof(TDIEntityID);
 
-    AFD_DbgPrint(MAX_TRACE, ("EntityCount = %d\n", EntityCount));
+    AFD_DbgPrint(MAX_TRACE, ("EntityCount = %u\n", EntityCount));
 
     for (i = 0; i < EntityCount; i++) {
         if (Entities[i].tei_entity == CL_NL_ENTITY) {
@@ -923,7 +923,7 @@
         return STATUS_INSUFFICIENT_RESOURCES;
     }
 
-    AFD_DbgPrint(MID_TRACE, ("Allocating irp for %x:%d\n", Buffer,BufferLength));
+    AFD_DbgPrint(MID_TRACE, ("Allocating irp for %p:%u\n", Buffer,BufferLength));
 
     Mdl = IoAllocateMdl(Buffer,         /* Virtual address */
                         BufferLength,   /* Length of buffer */
@@ -947,7 +947,7 @@
         _SEH2_YIELD(return STATUS_INSUFFICIENT_RESOURCES);
     } _SEH2_END;
 
-    AFD_DbgPrint(MID_TRACE,("AFD>>> Got an MDL: %x\n", Mdl));
+    AFD_DbgPrint(MID_TRACE,("AFD>>> Got an MDL: %p\n", Mdl));
 
     TdiBuildSend(*Irp,                   /* I/O Request Packet */
                  DeviceObject,           /* Device object */
@@ -1002,7 +1002,7 @@
         return STATUS_INSUFFICIENT_RESOURCES;
     }
 
-    AFD_DbgPrint(MID_TRACE, ("Allocating irp for %x:%d\n", Buffer,BufferLength));
+    AFD_DbgPrint(MID_TRACE, ("Allocating irp for %p:%u\n", Buffer,BufferLength));
 
     Mdl = IoAllocateMdl(Buffer,         /* Virtual address */
                         BufferLength,   /* Length of buffer */
@@ -1028,7 +1028,7 @@
         _SEH2_YIELD(return STATUS_INSUFFICIENT_RESOURCES);
     } _SEH2_END;
 
-    AFD_DbgPrint(MID_TRACE,("AFD>>> Got an MDL: %x\n", Mdl));
+    AFD_DbgPrint(MID_TRACE,("AFD>>> Got an MDL: %p\n", Mdl));
 
     TdiBuildReceive(*Irp,                   /* I/O Request Packet */
                     DeviceObject,           /* Device object */
@@ -1097,7 +1097,7 @@
         return STATUS_INSUFFICIENT_RESOURCES;
     }
 
-    AFD_DbgPrint(MID_TRACE, ("Allocating irp for %x:%d\n", Buffer,BufferLength));
+    AFD_DbgPrint(MID_TRACE, ("Allocating irp for %p:%u\n", Buffer,BufferLength));
 
     Mdl = IoAllocateMdl(Buffer,         /* Virtual address */
                         BufferLength,   /* Length of buffer */
@@ -1121,7 +1121,7 @@
         _SEH2_YIELD(return STATUS_INSUFFICIENT_RESOURCES);
     } _SEH2_END;
 
-    AFD_DbgPrint(MID_TRACE,("AFD>>> Got an MDL: %x\n", Mdl));
+    AFD_DbgPrint(MID_TRACE,("AFD>>> Got an MDL: %p\n", Mdl));
 
     TdiBuildReceiveDatagram(*Irp,                   /* I/O Request Packet */
                             DeviceObject,           /* Device object */
@@ -1173,7 +1173,7 @@
         return STATUS_INVALID_PARAMETER;
     }
 
-    AFD_DbgPrint(MID_TRACE,("Called(TransportObject %x)\n", TransportObject));
+    AFD_DbgPrint(MID_TRACE,("Called(TransportObject %p)\n", TransportObject));
 
     DeviceObject = IoGetRelatedDeviceObject(TransportObject);
     if (!DeviceObject) {
@@ -1192,7 +1192,7 @@
         return STATUS_INSUFFICIENT_RESOURCES;
     }
 
-    AFD_DbgPrint(MID_TRACE, ("Allocating irp for %x:%d\n", Buffer,BufferLength));
+    AFD_DbgPrint(MID_TRACE, ("Allocating irp for %p:%u\n", Buffer,BufferLength));
 
     Mdl = IoAllocateMdl(Buffer,         /* Virtual address */
                         BufferLength,   /* Length of buffer */
@@ -1217,7 +1217,7 @@
         _SEH2_YIELD(return STATUS_INSUFFICIENT_RESOURCES);
     } _SEH2_END;
 
-    AFD_DbgPrint(MID_TRACE,("AFD>>> Got an MDL: %x\n", Mdl));
+    AFD_DbgPrint(MID_TRACE,("AFD>>> Got an MDL: %p\n", Mdl));
 
     TdiBuildSendDatagram(*Irp,                   /* I/O Request Packet */
                          DeviceObject,           /* Device object */
@@ -1252,7 +1252,7 @@
         return STATUS_INVALID_PARAMETER;
     }
 
-    AFD_DbgPrint(MID_TRACE,("Called(TransportObject %x)\n", TransportObject));
+    AFD_DbgPrint(MID_TRACE,("Called(TransportObject %p)\n", TransportObject));
 
     DeviceObject = IoGetRelatedDeviceObject(TransportObject);
     if (!DeviceObject) {
Index: network/afd/afd/write.c
===================================================================
--- network/afd/afd/write.c	(revision 58960)
+++ network/afd/afd/write.c	(working copy)
@@ -9,6 +9,7 @@
  */
 #include "afd.h"
 
+static IO_COMPLETION_ROUTINE SendComplete;
 static NTSTATUS NTAPI SendComplete
 ( PDEVICE_OBJECT DeviceObject,
   PIRP Irp,
@@ -24,6 +25,8 @@
     UINT SendLength, BytesCopied;
     BOOLEAN HaltSendQueue;
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     /*
      * The Irp parameter passed in is the IRP of the stream between AFD and
      * TDI driver. It's not very usefull to us. We need the IRPs of the stream
@@ -33,7 +36,7 @@
      * processed).
      */
 
-    AFD_DbgPrint(MID_TRACE,("Called, status %x, %d bytes used\n",
+    AFD_DbgPrint(MID_TRACE,("Called, status %x, %u bytes used\n",
                             Irp->IoStatus.Status,
                             Irp->IoStatus.Information));
 
@@ -159,7 +162,7 @@
         SendReq = GetLockedData(NextIrp, NextIrpSp);
         Map = (PAFD_MAPBUF)(SendReq->BufferArray + SendReq->BufferCount);
 
-        AFD_DbgPrint(MID_TRACE,("SendReq @ %x\n", SendReq));
+        AFD_DbgPrint(MID_TRACE,("SendReq @ %p\n", SendReq));
 
         SpaceAvail = FCB->Send.Size - FCB->Send.BytesUsed;
         TotalBytesCopied = 0;
@@ -254,6 +257,7 @@
     return STATUS_SUCCESS;
 }
 
+static IO_COMPLETION_ROUTINE PacketSocketSendComplete;
 static NTSTATUS NTAPI PacketSocketSendComplete
 ( PDEVICE_OBJECT DeviceObject,
   PIRP Irp,
@@ -263,7 +267,9 @@
     PIRP NextIrp;
     PAFD_SEND_INFO SendReq;
 
-    AFD_DbgPrint(MID_TRACE,("Called, status %x, %d bytes used\n",
+    UNREFERENCED_PARAMETER(DeviceObject);
+
+    AFD_DbgPrint(MID_TRACE,("Called, status %x, %u bytes used\n",
                             Irp->IoStatus.Status,
                             Irp->IoStatus.Information));
 
@@ -329,8 +335,11 @@
     UINT TotalBytesCopied = 0, i, SpaceAvail = 0, BytesCopied, SendLength;
     KPROCESSOR_MODE LockMode;
 
-    AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB));
+    UNREFERENCED_PARAMETER(DeviceObject);
+    UNREFERENCED_PARAMETER(Short);
 
+    AFD_DbgPrint(MID_TRACE,("Called on %p\n", FCB));
+
     if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
 
     FCB->EventSelectDisabled &= ~AFD_EVENT_SEND;
@@ -431,7 +440,7 @@
                                        Irp, 0 );
     }
 
-    AFD_DbgPrint(MID_TRACE,("Socket state %d\n", FCB->State));
+    AFD_DbgPrint(MID_TRACE,("Socket state %u\n", FCB->State));
 
     if( FCB->State != SOCKET_STATE_CONNECTED ) {
         if (!(SendReq->AfdFlags & AFD_OVERLAPPED) && 
@@ -445,12 +454,12 @@
         }
     }
 
-    AFD_DbgPrint(MID_TRACE,("FCB->Send.BytesUsed = %d\n",
+    AFD_DbgPrint(MID_TRACE,("FCB->Send.BytesUsed = %u\n",
                             FCB->Send.BytesUsed));
 
     SpaceAvail = FCB->Send.Size - FCB->Send.BytesUsed;
 
-    AFD_DbgPrint(MID_TRACE,("We can accept %d bytes\n",
+    AFD_DbgPrint(MID_TRACE,("We can accept %u bytes\n",
                             SpaceAvail));
 
     /* Count the total transfer size */
@@ -493,7 +502,7 @@
     {
         BytesCopied = MIN(SendReq->BufferArray[i].len, SpaceAvail);
 
-        AFD_DbgPrint(MID_TRACE,("Copying Buffer %d, %x:%d to %x\n",
+        AFD_DbgPrint(MID_TRACE,("Copying Buffer %u, %p:%u to %p\n",
                                 i,
                                 SendReq->BufferArray[i].buf,
                                 BytesCopied,
@@ -559,8 +568,10 @@
     PAFD_SEND_INFO_UDP SendReq;
     KPROCESSOR_MODE LockMode;
 
-    AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB));
+    UNREFERENCED_PARAMETER(DeviceObject);
 
+    AFD_DbgPrint(MID_TRACE,("Called on %p\n", FCB));
+
     if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
 
     FCB->EventSelectDisabled &= ~AFD_EVENT_SEND;
@@ -611,7 +622,7 @@
                                        Irp, 0 );
 
     AFD_DbgPrint
-        (MID_TRACE,("RemoteAddress #%d Type %d\n",
+        (MID_TRACE,("RemoteAddress #%d Type %u\n",
                     ((PTRANSPORT_ADDRESS)SendReq->TdiConnection.RemoteAddress)->
                     TAAddressCount,
                     ((PTRANSPORT_ADDRESS)SendReq->TdiConnection.RemoteAddress)->
Index: network/afd/include/afd.h
===================================================================
--- network/afd/include/afd.h	(revision 58960)
+++ network/afd/include/afd.h	(working copy)
@@ -319,22 +319,15 @@
 
 VOID OskitDumpBuffer( PCHAR Buffer, UINT Len );
 VOID DestroySocket( PAFD_FCB FCB );
-VOID NTAPI AfdCancelHandler(PDEVICE_OBJECT DeviceObject,
-                 PIRP Irp);
+DRIVER_CANCEL AfdCancelHandler;
 VOID RetryDisconnectCompletion(PAFD_FCB FCB);
 BOOLEAN CheckUnlockExtraBuffers(PAFD_FCB FCB, PIO_STACK_LOCATION IrpSp);
 
 /* read.c */
 
-NTSTATUS NTAPI ReceiveComplete
-( PDEVICE_OBJECT DeviceObject,
-  PIRP Irp,
-  PVOID Context );
+IO_COMPLETION_ROUTINE ReceiveComplete;
 
-NTSTATUS NTAPI PacketSocketRecvComplete
-( PDEVICE_OBJECT DeviceObject,
-  PIRP Irp,
-  PVOID Context );
+IO_COMPLETION_ROUTINE PacketSocketRecvComplete;
 
 NTSTATUS NTAPI
 AfdConnectedSocketReadData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
