- Fix bootlog/debug to file problem -- Steven. 3GB now works (Thanks to Filip) but a bug remains in ntoskrnl.
    - Basic beginning of Vector Exception Handling implementation -- Thomas
    - Merge with 13793:13838
Modified: branches/alex_devel_branch/reactos/bootdata/packages/reactos.dff
Modified: branches/alex_devel_branch/reactos/drivers/fs/np/create.c
Modified: branches/alex_devel_branch/reactos/drivers/fs/np/fsctrl.c
Modified: branches/alex_devel_branch/reactos/drivers/fs/np/npfs.h
Modified: branches/alex_devel_branch/reactos/drivers/fs/np/rw.c
Modified: branches/alex_devel_branch/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/select.h
Modified: branches/alex_devel_branch/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/socketvar.h
Modified: branches/alex_devel_branch/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/systm.h
Modified: branches/alex_devel_branch/reactos/drivers/lib/oskittcp/oskittcp/in_pcb.c
Modified: branches/alex_devel_branch/reactos/drivers/lib/oskittcp/oskittcp/interface.c
Modified: branches/alex_devel_branch/reactos/drivers/lib/oskittcp/oskittcp/route.c
Modified: branches/alex_devel_branch/reactos/drivers/storage/atapi/atapi.c
Modified: branches/alex_devel_branch/reactos/drivers/storage/atapi/atapi.h
Modified: branches/alex_devel_branch/reactos/include/ntdll/rtl.h
Modified: branches/alex_devel_branch/reactos/lib/adns/Makefile
Modified: branches/alex_devel_branch/reactos/lib/adns/src/event.c
Modified: branches/alex_devel_branch/reactos/lib/ntdll/def/ntdll.def
Modified: branches/alex_devel_branch/reactos/lib/ntdll/ldr/startup.c
Modified: branches/alex_devel_branch/reactos/lib/ntdll/rtl/exception.c
Modified: branches/alex_devel_branch/reactos/lib/rpcrt4/rpc_message.c
Modified: branches/alex_devel_branch/reactos/lib/user32/resources/oic_reactos.ico
Modified: branches/alex_devel_branch/reactos/ntoskrnl/Makefile
Modified: branches/alex_devel_branch/reactos/ntoskrnl/include/internal/io.h
Modified: branches/alex_devel_branch/reactos/ntoskrnl/include/internal/kd.h
Modified: branches/alex_devel_branch/reactos/ntoskrnl/io/cancel.c
Modified: branches/alex_devel_branch/reactos/ntoskrnl/io/iomgr.c
Modified: branches/alex_devel_branch/reactos/ntoskrnl/io/irp.c
Modified: branches/alex_devel_branch/reactos/ntoskrnl/kd/dlog.c
Modified: branches/alex_devel_branch/reactos/ntoskrnl/kd/kdebug.c
Modified: branches/alex_devel_branch/reactos/ntoskrnl/ob/handle.c
Modified: branches/alex_devel_branch/reactos/ntoskrnl/ps/kill.c
Modified: branches/alex_devel_branch/reactos/subsys/system/explorer/res/logov.bmp
Modified: branches/alex_devel_branch/reactos/subsys/system/explorer/res/reactos.ico
Modified: branches/alex_devel_branch/reactos/subsys/system/explorer/res/ros-big.ico
Modified: branches/alex_devel_branch/reactos/subsys/system/explorer/res/startmenu.ico
Modified: branches/alex_devel_branch/reactos/subsys/system/explorer/taskbar/startmenu.cpp
Modified: branches/alex_devel_branch/reactos/subsys/system/explorer/utility/xmlstorage.cpp
Modified: branches/alex_devel_branch/reactos/subsys/system/explorer/utility/xmlstorage.h
Modified: branches/alex_devel_branch/reactos/subsys/system/ibrowser/Makefile

Modified: branches/alex_devel_branch/reactos/bootdata/packages/reactos.dff
--- branches/alex_devel_branch/reactos/bootdata/packages/reactos.dff	2005-03-05 22:20:15 UTC (rev 13838)
+++ branches/alex_devel_branch/reactos/bootdata/packages/reactos.dff	2005-03-05 23:19:42 UTC (rev 13839)
@@ -146,6 +146,7 @@
 subsys\system\explorer\explorer.exe     4
 subsys\system\explorer\explorer-cfg-template.xml 4
 subsys\system\explorer\notifyhook\notifyhook.dll 1
+subsys\system\ibrowser\ibrowser.exe     1
 subsys\system\format\format.exe         1
 subsys\system\notepad\notepad.exe       1
 subsys\system\regedit\regedit.exe       4

Modified: branches/alex_devel_branch/reactos/drivers/fs/np/create.c
--- branches/alex_devel_branch/reactos/drivers/fs/np/create.c	2005-03-05 22:20:15 UTC (rev 13838)
+++ branches/alex_devel_branch/reactos/drivers/fs/np/create.c	2005-03-05 23:19:42 UTC (rev 13839)
@@ -48,17 +48,18 @@
 NpfsFindListeningServerInstance(PNPFS_PIPE Pipe)
 {
   PLIST_ENTRY CurrentEntry;
-  PNPFS_FCB ServerFcb;
+  PNPFS_WAITER_ENTRY Waiter;
 
-  CurrentEntry = Pipe->ServerFcbListHead.Flink;
-  while (CurrentEntry != &Pipe->ServerFcbListHead)
+  CurrentEntry = Pipe->WaiterListHead.Flink;
+  while (CurrentEntry != &Pipe->WaiterListHead)
     {
-      ServerFcb = CONTAINING_RECORD(CurrentEntry, NPFS_FCB, FcbListEntry);
-      if (ServerFcb->PipeState == FILE_PIPE_LISTENING_STATE)
+      Waiter = CONTAINING_RECORD(CurrentEntry, NPFS_WAITER_ENTRY, Entry);
+      if (Waiter->Fcb->PipeState == FILE_PIPE_LISTENING_STATE)
 	{
-	  DPRINT("Server found! Fcb %p\n", ServerFcb);
-	  return ServerFcb;
+	  DPRINT("Server found! Fcb %p\n", Waiter->Fcb);
+	  return Waiter->Fcb;
 	}
+
       CurrentEntry = CurrentEntry->Flink;
     }
 
@@ -66,6 +67,35 @@
 }
 
 
+static VOID
+NpfsSignalAndRemoveListeningServerInstance(PNPFS_PIPE Pipe,
+					   PNPFS_FCB Fcb)
+{
+  PLIST_ENTRY CurrentEntry;
+  PNPFS_WAITER_ENTRY Waiter;
+
+  CurrentEntry = Pipe->WaiterListHead.Flink;
+  while (CurrentEntry != &Pipe->WaiterListHead)
+    {
+      Waiter = CONTAINING_RECORD(CurrentEntry, NPFS_WAITER_ENTRY, Entry);
+      if (Waiter->Fcb == Fcb)
+	{
+	  DPRINT("Server found! Fcb %p\n", Waiter->Fcb);
+
+	  KeSetEvent(Waiter->Irp->UserEvent, 0, FALSE);
+	  Waiter->Irp->UserIosb->Status = FILE_PIPE_CONNECTED_STATE;
+	  Waiter->Irp->UserIosb->Information = 0;
+	  IoCompleteRequest(Waiter->Irp, IO_NO_INCREMENT);
+
+	  RemoveEntryList(&Waiter->Entry);
+	  ExFreePool(Waiter);
+	  return;
+	}
+      CurrentEntry = CurrentEntry->Flink;
+    }
+}
+
+
 NTSTATUS STDCALL
 NpfsCreate(PDEVICE_OBJECT DeviceObject,
 	   PIRP Irp)
@@ -206,9 +236,8 @@
       ClientFcb->PipeState = FILE_PIPE_CONNECTED_STATE;
       ServerFcb->PipeState = FILE_PIPE_CONNECTED_STATE;
 
-      /* Wake server thread */
-      DPRINT("Setting the ConnectEvent for %x\n", ServerFcb);
-      KeSetEvent(&ServerFcb->ConnectEvent, 0, FALSE);
+      /* Signal the server thread and remove it from the waiter list */
+      NpfsSignalAndRemoveListeningServerInstance(Pipe, ServerFcb);
     }
 
   KeUnlockMutex(&Pipe->FcbListLock);
@@ -318,6 +347,7 @@
 
        InitializeListHead(&Pipe->ServerFcbListHead);
        InitializeListHead(&Pipe->ClientFcbListHead);
+       InitializeListHead(&Pipe->WaiterListHead);
        KeInitializeMutex(&Pipe->FcbListLock, 0);
 
        Pipe->PipeType = Buffer->NamedPipeType;

Modified: branches/alex_devel_branch/reactos/drivers/fs/np/fsctrl.c
--- branches/alex_devel_branch/reactos/drivers/fs/np/fsctrl.c	2005-03-05 22:20:15 UTC (rev 13838)
+++ branches/alex_devel_branch/reactos/drivers/fs/np/fsctrl.c	2005-03-05 23:19:42 UTC (rev 13839)
@@ -18,9 +18,67 @@
 
 /* FUNCTIONS *****************************************************************/
 
+static VOID
+NpfsListeningCancelRoutine(IN PDEVICE_OBJECT DeviceObject,
+                           IN PIRP Irp)
+{
+  PNPFS_WAITER_ENTRY Waiter;
+
+  DPRINT1("NpfsListeningCancelRoutine() called\n");
+  /* FIXME: Not tested. */
+
+  Waiter = Irp->Tail.Overlay.DriverContext[0];
+
+  RemoveEntryList(&Waiter->Entry);
+  ExFreePool(Waiter);
+
+  IoReleaseCancelSpinLock(Irp->CancelIrql);
+
+  Irp->IoStatus.Status = STATUS_CANCELLED;
+  Irp->IoStatus.Information = 0;
+  IoCompleteRequest(Irp, IO_NO_INCREMENT);
+}
+
+
 static NTSTATUS
-NpfsConnectPipe(PNPFS_FCB Fcb)
+NpfsAddListeningServerInstance(PIRP Irp,
+			       PNPFS_FCB Fcb)
 {
+  PNPFS_WAITER_ENTRY Entry;
+  KIRQL OldIrql;
+
+  Entry = ExAllocatePool(NonPagedPool, sizeof(NPFS_WAITER_ENTRY));
+  if (Entry == NULL)
+    return STATUS_INSUFFICIENT_RESOURCES;
+
+  Entry->Irp = Irp;
+  Entry->Fcb = Fcb;
+  InsertTailList(&Fcb->Pipe->WaiterListHead, &Entry->Entry);
+
+  IoAcquireCancelSpinLock(&OldIrql);
+  if (!Irp->Cancel)
+    {
+      Irp->Tail.Overlay.DriverContext[0] = Entry;
+      IoMarkIrpPending(Irp);
+      IoSetCancelRoutine(Irp, NpfsListeningCancelRoutine);
+      IoReleaseCancelSpinLock(OldIrql);
+      return STATUS_PENDING;
+    }
+  /* IRP has already been cancelled */
+  IoReleaseCancelSpinLock(OldIrql);
+
+  DPRINT1("FIXME: Remove waiter entry!\n");
+  RemoveEntryList(&Entry->Entry);
+  ExFreePool(Entry);
+
+  return STATUS_CANCELLED;
+}
+
+
+static NTSTATUS
+NpfsConnectPipe(PIRP Irp,
+                PNPFS_FCB Fcb)
+{
   PNPFS_PIPE Pipe;
   PLIST_ENTRY current_entry;
   PNPFS_FCB ClientFcb;
@@ -88,29 +146,18 @@
       current_entry = current_entry->Flink;
     }
 
-  KeUnlockMutex(&Pipe->FcbListLock);
-
   /* no listening client fcb found */
   DPRINT("No listening client fcb found -- waiting for client\n");
 
   Fcb->PipeState = FILE_PIPE_LISTENING_STATE;
 
-  Status = KeWaitForSingleObject(&Fcb->ConnectEvent,
-				 UserRequest,
-				 KernelMode,
-				 FALSE,
-				 NULL);
-  if (!NT_SUCCESS(Status))
-    {
-      DPRINT("KeWaitForSingleObject() failed (Status %lx)\n", Status);
-      return Status;
-    }
+  Status = NpfsAddListeningServerInstance(Irp, Fcb);
 
-  Fcb->PipeState = FILE_PIPE_CONNECTED_STATE;
+  KeUnlockMutex(&Pipe->FcbListLock);
 
-  DPRINT("Client Fcb: %p\n", Fcb->OtherSide);
+  DPRINT("NpfsConnectPipe() done (Status %lx)\n", Status);
 
-  return STATUS_PIPE_CONNECTED;
+  return Status;
 }
 
 
@@ -327,7 +374,6 @@
 }
 
 
-
 NTSTATUS STDCALL
 NpfsFileSystemControl(PDEVICE_OBJECT DeviceObject,
 		      PIRP Irp)
@@ -366,7 +412,7 @@
 
       case FSCTL_PIPE_LISTEN:
 	DPRINT("Connecting pipe %wZ\n", &Pipe->PipeName);
-	Status = NpfsConnectPipe(Fcb);
+	Status = NpfsConnectPipe(Irp, Fcb);
 	break;
 
       case FSCTL_PIPE_PEEK:
@@ -439,12 +485,15 @@
 	Status = STATUS_UNSUCCESSFUL;
     }
 
-  Irp->IoStatus.Status = Status;
-  Irp->IoStatus.Information = 0;
+  if (Status != STATUS_PENDING)
+    {
+      Irp->IoStatus.Status = Status;
+      Irp->IoStatus.Information = 0;
+ 
+      IoCompleteRequest(Irp, IO_NO_INCREMENT);
+    }
 
-  IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
-  return(Status);
+  return Status;
 }
 
 

Modified: branches/alex_devel_branch/reactos/drivers/fs/np/npfs.h
--- branches/alex_devel_branch/reactos/drivers/fs/np/npfs.h	2005-03-05 22:20:15 UTC (rev 13838)
+++ branches/alex_devel_branch/reactos/drivers/fs/np/npfs.h	2005-03-05 23:19:42 UTC (rev 13839)
@@ -19,6 +19,7 @@
   KMUTEX FcbListLock;
   LIST_ENTRY ServerFcbListHead;
   LIST_ENTRY ClientFcbListHead;
+  LIST_ENTRY WaiterListHead;
   ULONG PipeType;
   ULONG ReadMode;
   ULONG WriteMode;
@@ -52,7 +53,15 @@
   KSPIN_LOCK DataListLock;	/* Data queue lock */
 } NPFS_FCB, *PNPFS_FCB;
 
+typedef struct _NPFS_WAITER_ENTRY
+{
+  LIST_ENTRY Entry;
+  PIRP Irp;
+  PNPFS_PIPE Pipe;
+  PNPFS_FCB Fcb;
+} NPFS_WAITER_ENTRY, *PNPFS_WAITER_ENTRY;
 
+
 extern NPAGED_LOOKASIDE_LIST NpfsPipeDataLookasideList;
 
 

Modified: branches/alex_devel_branch/reactos/drivers/fs/np/rw.c
--- branches/alex_devel_branch/reactos/drivers/fs/np/rw.c	2005-03-05 22:20:15 UTC (rev 13838)
+++ branches/alex_devel_branch/reactos/drivers/fs/np/rw.c	2005-03-05 23:19:42 UTC (rev 13839)
@@ -101,7 +101,6 @@
       /* FIXME: check if in blocking mode */
       if (Fcb->ReadDataAvailable == 0)
 	{
-	  KeResetEvent(&Fcb->Event);
 	  if (Fcb->PipeState == FILE_PIPE_CONNECTED_STATE)
 	    {
 	      KeSetEvent(&WriterFcb->Event, IO_NO_INCREMENT, FALSE);
@@ -167,6 +166,7 @@
 	  if (Length == 0)
 	    {
 	      KeSetEvent(&WriterFcb->Event, IO_NO_INCREMENT, FALSE);
+	      KeResetEvent(&Fcb->Event);
 	      break;
 	    }
 	}
@@ -187,8 +187,19 @@
 #endif
 
 	      Information = CopyLength;
-	      Fcb->ReadDataAvailable = 0;
-	      Fcb->WriteQuotaAvailable = Fcb->MaxDataLength;
+
+	      if (Fcb->ReadDataAvailable > Length)
+	        {
+	          memmove(Fcb->Data, Fcb->Data + Length,
+	                  Fcb->ReadDataAvailable - Length);
+	          Fcb->ReadDataAvailable -= Length;
+	          Status = STATUS_MORE_ENTRIES;
+	        }
+	      else
+	        {
+	          Fcb->ReadDataAvailable = 0;
+	          Fcb->WriteQuotaAvailable = Fcb->MaxDataLength;
+	        }
 	    }
 
 	  if (Information > 0)
@@ -197,6 +208,7 @@
 	        {
 	          KeSetEvent(&WriterFcb->Event, IO_NO_INCREMENT, FALSE);
 	        }
+	      KeResetEvent(&Fcb->Event);
 	      break;
 	    }
 	}
@@ -291,7 +303,6 @@
     {
       if (ReaderFcb->WriteQuotaAvailable == 0)
 	{
-	  KeResetEvent(&Fcb->Event);
 	  KeSetEvent(&ReaderFcb->Event, IO_NO_INCREMENT, FALSE);
 	  KeReleaseSpinLock(&ReaderFcb->DataListLock, OldIrql);
 	  if (Fcb->PipeState != FILE_PIPE_CONNECTED_STATE)
@@ -355,6 +366,7 @@
 	  if (Length == 0)
 	    {
 	      KeSetEvent(&ReaderFcb->Event, IO_NO_INCREMENT, FALSE);
+	      KeResetEvent(&Fcb->Event);
 	      break;
 	    }
 	}
@@ -374,6 +386,7 @@
 	  if (Information > 0)
 	    {
 	      KeSetEvent(&ReaderFcb->Event, IO_NO_INCREMENT, FALSE);
+	      KeResetEvent(&Fcb->Event);
 	      break;
 	    }
 	}

Modified: branches/alex_devel_branch/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/select.h
--- branches/alex_devel_branch/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/select.h	2005-03-05 22:20:15 UTC (rev 13838)
+++ branches/alex_devel_branch/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/select.h	2005-03-05 23:19:42 UTC (rev 13839)
@@ -40,19 +40,14 @@
 struct  listener_mgr;
 #endif
 
-/*
- * Used to maintain information about processes that wish to be
- * notified when I/O becomes possible.
- */
-struct selinfo {
-#if defined(OSKIT)
-	struct  listener_mgr *si_sel;
-#endif /* OSKIT */
-	pid_t	si_pid;		/* process to be notified */
-	short	si_flags;	/* see below */
-};
-#define	SI_COLL	0x0001		/* collision occurred */
+/* Included to suppress warnings about struct socket being declared in the
+ * parameter list.  Selinfo reoredered with struct socket. */
 
+struct selinfo;
+struct socket;
+
+#include <sys/socketvar.h>
+
 #ifdef KERNEL
 struct proc;
 

Modified: branches/alex_devel_branch/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/socketvar.h
--- branches/alex_devel_branch/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/socketvar.h	2005-03-05 22:20:15 UTC (rev 13838)
+++ branches/alex_devel_branch/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/socketvar.h	2005-03-05 23:19:42 UTC (rev 13839)
@@ -40,7 +40,26 @@
 #include <sys/filedesc.h>		/* for struct filedesc */
 #include <sys/select.h>			/* for struct selinfo */
 
+/* Warning suppression */
+struct sockaddr;
+
 /*
+ * Used to maintain information about processes that wish to be
+ * notified when I/O becomes possible.
+ *
+ * Moved from sys/select.h and replaced with an #include.
+ */
+struct selinfo {
+#if defined(OSKIT)
+	struct  listener_mgr *si_sel;
+#endif /* OSKIT */
+	pid_t	si_pid;		/* process to be notified */
+	short	si_flags;	/* see below */
+};
+#define	SI_COLL	0x0001		/* collision occurred */
+
+
+/*
  * Kernel structure per socket.
  * Contains send and receive buffer queues,
  * handle on protocol and pointer to protocol

Modified: branches/alex_devel_branch/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/systm.h
--- branches/alex_devel_branch/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/systm.h	2005-03-05 22:20:15 UTC (rev 13838)
+++ branches/alex_devel_branch/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/systm.h	2005-03-05 23:19:42 UTC (rev 13839)
@@ -125,9 +125,11 @@
 #include <oskitfreebsd.h>
 #include <oskitdebug.h>
 
+
 int __cdecl vprintf(const char *, va_list);
 
-static inline int log ( int blah, const char* fmt, ... )
+#define log bsd_log
+static inline int bsd_log ( int blah, const char* fmt, ... )
 {
 	va_list arg;
 	int i;

Modified: branches/alex_devel_branch/reactos/drivers/lib/oskittcp/oskittcp/in_pcb.c
--- branches/alex_devel_branch/reactos/drivers/lib/oskittcp/oskittcp/in_pcb.c	2005-03-05 22:20:15 UTC (rev 13838)
+++ branches/alex_devel_branch/reactos/drivers/lib/oskittcp/oskittcp/in_pcb.c	2005-03-05 23:19:42 UTC (rev 13839)
@@ -312,7 +312,7 @@
 	 * Don't do pcblookup call here; return interface in plocal_sin
 	 * and exit to caller, that will do the lookup.
 	 */
-		*plocal_sin = ia->ia_ifa.ifa_addr;
+		*plocal_sin = (struct sockaddr_in *)ia->ia_ifa.ifa_addr;
 		OS_DbgPrint(OSK_MID_TRACE,("plocal sin %x\n", 
 					   (*plocal_sin)->sin_addr.s_addr));
 

Modified: branches/alex_devel_branch/reactos/drivers/lib/oskittcp/oskittcp/interface.c
--- branches/alex_devel_branch/reactos/drivers/lib/oskittcp/oskittcp/interface.c	2005-03-05 22:20:15 UTC (rev 13838)
+++ branches/alex_devel_branch/reactos/drivers/lib/oskittcp/oskittcp/interface.c	2005-03-05 23:19:42 UTC (rev 13839)
@@ -365,7 +365,7 @@
      */
     so = head->so_q;
 
-    inp = so ? so->so_pcb : 0;
+    inp = so ? (struct inpcb *)so->so_pcb : NULL;
     if( inp ) {
         ((struct sockaddr_in *)AddrOut)->sin_addr.s_addr = 
             inp->inp_faddr.s_addr;
@@ -381,7 +381,7 @@
 	    
 	/*so->so_state &= ~SS_COMP;*/
 
-	mnam.m_data = &sa;
+	mnam.m_data = (char *)&sa;
 	mnam.m_len = sizeof(sa);
 	
 	(void) soaccept(so, &mnam);
@@ -452,7 +452,7 @@
 			 OSK_UINT RemoteAddress,
 			 OSK_UI16 RemotePort ) {
     struct socket *so = socket;
-    struct inpcb *inp = so->so_pcb;
+    struct inpcb *inp = (struct inpcb *)so->so_pcb;
     inp->inp_laddr.s_addr = LocalAddress;
     inp->inp_lport = LocalPort;
     inp->inp_faddr.s_addr = RemoteAddress;
@@ -465,7 +465,7 @@
 			 OSK_UINT *RemoteAddress,
 			 OSK_UI16 *RemotePort ) {
     struct socket *so = socket;
-    struct inpcb *inp = so ? so->so_pcb : 0;
+    struct inpcb *inp = so ? (struct inpcb *)so->so_pcb : NULL;
     if( inp ) {
 	*LocalAddress = inp->inp_laddr.s_addr;
 	*LocalPort = inp->inp_lport;
@@ -589,7 +589,7 @@
 
     if( ifaddr )
     {
-       sin = (struct sockaddr *)&ifaddr->ifa_addr;
+       sin = (struct sockaddr_in *)&ifaddr->ifa_addr;
 
        OS_DbgPrint(OSK_MID_TRACE,("ifaddr->addr = %x\n", 
                                   sin->sin_addr.s_addr));

Modified: branches/alex_devel_branch/reactos/drivers/lib/oskittcp/oskittcp/route.c
--- branches/alex_devel_branch/reactos/drivers/lib/oskittcp/oskittcp/route.c	2005-03-05 22:20:15 UTC (rev 13838)
+++ branches/alex_devel_branch/reactos/drivers/lib/oskittcp/oskittcp/route.c	2005-03-05 23:19:42 UTC (rev 13839)
@@ -314,8 +314,8 @@
 	register struct ifaddr *ifa;
 
 	OS_DbgPrint(OSK_MID_TRACE,("Called: flags %\n", flags));
-	OskitDumpBuffer( dst, sizeof(*dst) );
-	OskitDumpBuffer( gateway, sizeof(*gateway) );
+	OskitDumpBuffer( (void *)dst, sizeof(*dst) );
+	OskitDumpBuffer( (void *)gateway, sizeof(*gateway) );
 
 	if ((flags & RTF_GATEWAY) == 0) {
 		/*

Modified: branches/alex_devel_branch/reactos/drivers/storage/atapi/atapi.c
--- branches/alex_devel_branch/reactos/drivers/storage/atapi/atapi.c	2005-03-05 22:20:15 UTC (rev 13838)
+++ branches/alex_devel_branch/reactos/drivers/storage/atapi/atapi.c	2005-03-05 23:19:42 UTC (rev 13839)
@@ -1327,6 +1327,8 @@
          DrvParms->TMSectorCountHi,
          DrvParms->TMSectorCountLo,
          (ULONG)((DrvParms->TMSectorCountHi << 16) + DrvParms->TMSectorCountLo));
+  DPRINT("SupportedFeatures83: %x, EnabledFeatures86 %x\n", DrvParms->SupportedFeatures83, DrvParms->EnabledFeatures86);
+  DPRINT("Max48BitAddress: %I64d\n", *(PULONGLONG)DrvParms->Max48BitAddress);
   if (DrvParms->TMFieldsValid & 0x0004)
     {
       if ((DrvParms->UltraDmaModes >> 8) && (DrvParms->UltraDmaModes & 0xff))
@@ -1952,7 +1954,7 @@
 {
   PREAD_CAPACITY_DATA CapacityData;
   PIDE_DRIVE_IDENTIFY DeviceParams;
-  ULONG LastSector;
+  LARGE_INTEGER LastSector;
 
   DPRINT("SCSIOP_READ_CAPACITY: TargetId: %lu\n", Srb->TargetId);
   CapacityData = (PREAD_CAPACITY_DATA)Srb->DataBuffer;
@@ -1964,15 +1966,34 @@
   /* Calculate last sector (big-endian). */
   if (DeviceParams->Capabilities & IDE_DRID_LBA_SUPPORTED)
     {
-      LastSector = (ULONG)((DeviceParams->TMSectorCountHi << 16) +
-			    DeviceParams->TMSectorCountLo) - 1;
+      if (DeviceExtension->DeviceFlags[Srb->TargetId] & DEVICE_48BIT_ADDRESS)
+        {
+	  ((PUSHORT)&LastSector)[0] = DeviceParams->Max48BitAddress[0]; 
+	  ((PUSHORT)&LastSector)[1] = DeviceParams->Max48BitAddress[1]; 
+	  ((PUSHORT)&LastSector)[2] = DeviceParams->Max48BitAddress[2]; 
+	  ((PUSHORT)&LastSector)[3] = DeviceParams->Max48BitAddress[3]; 
+	  LastSector.QuadPart -= 1;
+
+	}
+      else
+        {
+	  LastSector.u.HighPart = 0;
+          LastSector.u.LowPart = (ULONG)((DeviceParams->TMSectorCountHi << 16) +
+			                 DeviceParams->TMSectorCountLo)-1;
+	}
     }
   else
     {
-      LastSector = (ULONG)(DeviceParams->LogicalCyls *
-			   DeviceParams->LogicalHeads *
-			   DeviceParams->SectorsPerTrack)-1;
+      LastSector.u.HighPart = 0;
+      LastSector.u.LowPart = (ULONG)(DeviceParams->LogicalCyls *
+			             DeviceParams->LogicalHeads *
+			             DeviceParams->SectorsPerTrack)-1;
     }
+  if (LastSector.u.HighPart)
+    {
+      DPRINT1("Disk is too large for our implementation (%I64d sectors\n", LastSector.QuadPart);
+      KEBUGCHECK(0);
+    }
 
   CapacityData->LogicalBlockAddress = (((PUCHAR)&LastSector)[0] << 24) |
 				      (((PUCHAR)&LastSector)[1] << 16) |
@@ -1996,10 +2017,10 @@
   PIDE_DRIVE_IDENTIFY DeviceParams;
   ULONG StartingSector;
   ULONG SectorCount;
-  UCHAR CylinderHigh;
-  UCHAR CylinderLow;
+  UCHAR CylinderHigh[2];
+  UCHAR CylinderLow[2];
   UCHAR DrvHead;
-  UCHAR SectorNumber;
+  UCHAR SectorNumber[2];
   UCHAR Command;
   ULONG Retries;
   UCHAR Status;
@@ -2025,47 +2046,61 @@
 	 Srb->DataTransferLength,
 	 SectorCount);
 
-  if (DeviceParams->Capabilities & IDE_DRID_LBA_SUPPORTED)
+  if (DeviceExtension->DeviceFlags[Srb->TargetId] & DEVICE_48BIT_ADDRESS)
     {
-      SectorNumber = StartingSector & 0xff;
-      CylinderLow = (StartingSector >> 8) & 0xff;
-      CylinderHigh = (StartingSector >> 16) & 0xff;
-      DrvHead = ((StartingSector >> 24) & 0x0f) | 
-          (Srb->TargetId ? IDE_DH_DRV1 : 0) |
-          IDE_DH_LBA;
+      SectorNumber[0] = StartingSector & 0xff;
+      CylinderLow[0] = (StartingSector >> 8) & 0xff;
+      CylinderHigh[0] = (StartingSector >> 16) & 0xff;
+      SectorNumber[1] = (StartingSector >> 24) & 0xff;
+      CylinderLow[1] = 0;
+      CylinderHigh[1] = 0;
+      DrvHead = (Srb->TargetId ? IDE_DH_DRV1 : 0) | IDE_DH_LBA;
+
+      DPRINT("%s:BUS=%04x:DRV=%d:LBA48=1:BLK=%08d:SC=%02x:CM=%02x\n",
+	     (Srb->SrbFlags & SRB_FLAGS_DATA_IN) ? "READ" : "WRITE",
+	     DeviceExtension->CommandPortBase,
+	     DrvHead & IDE_DH_DRV1 ? 1 : 0,
+	     (SectorNumber[1] << 24) +
+	     (CylinderHigh[0] << 16) + (CylinderLow[0] << 8) + DectorNumberLow[0],
+	     SectorCount,
+	     Command);
     }
-  else
+  else if (DeviceParams->Capabilities & IDE_DRID_LBA_SUPPORTED)
     {
-      SectorNumber = (StartingSector % DeviceParams->SectorsPerTrack) + 1;
-      StartingSector /= DeviceParams->SectorsPerTrack;
-      DrvHead = (StartingSector % DeviceParams->LogicalHeads) | 
-          (Srb->TargetId ? IDE_DH_DRV1 : 0);
-      StartingSector /= DeviceParams->LogicalHeads;
-      CylinderLow = StartingSector & 0xff;
-      CylinderHigh = StartingSector >> 8;
-    }
+      SectorNumber[0] = StartingSector & 0xff;
+      CylinderLow[0] = (StartingSector >> 8) & 0xff;
+      CylinderHigh[0] = (StartingSector >> 16) & 0xff;
+      DrvHead = ((StartingSector >> 24) & 0x0f) | 
+                 (Srb->TargetId ? IDE_DH_DRV1 : 0) |
+		 IDE_DH_LBA;
 
-  if (DrvHead & IDE_DH_LBA)
-    {
       DPRINT("%s:BUS=%04x:DRV=%d:LBA=1:BLK=%08d:SC=%02x:CM=%02x\n",
 	     (Srb->SrbFlags & SRB_FLAGS_DATA_IN) ? "READ" : "WRITE",
 	     DeviceExtension->CommandPortBase,
 	     DrvHead & IDE_DH_DRV1 ? 1 : 0,
 	     ((DrvHead & 0x0f) << 24) +
-	       (CylinderHigh << 16) + (CylinderLow << 8) + SectorNumber,
+	     (CylinderHigh[0] << 16) + (CylinderLow[0] << 8) + SectorNumber[0],
 	     SectorCount,
 	     Command);
     }
   else
     {
+      SectorNumber[0] = (StartingSector % DeviceParams->SectorsPerTrack) + 1;
+      StartingSector /= DeviceParams->SectorsPerTrack;
+      DrvHead = (StartingSector % DeviceParams->LogicalHeads) | 
+          (Srb->TargetId ? IDE_DH_DRV1 : 0);
+      StartingSector /= DeviceParams->LogicalHeads;
+      CylinderLow[0] = StartingSector & 0xff;
+      CylinderHigh[0] = StartingSector >> 8;
+
       DPRINT("%s:BUS=%04x:DRV=%d:LBA=0:CH=%02x:CL=%02x:HD=%01x:SN=%02x:SC=%02x:CM=%02x\n",
              (Srb->SrbFlags & SRB_FLAGS_DATA_IN) ? "READ" : "WRITE",
              DeviceExtension->CommandPortBase,
              DrvHead & IDE_DH_DRV1 ? 1 : 0, 
-             CylinderHigh,
-             CylinderLow,
+             CylinderHigh[0],
+             CylinderLow[0],
              DrvHead & 0x0f,
-             SectorNumber,
+             SectorNumber[0],
              SectorCount,
              Command);
     }
@@ -2119,11 +2154,21 @@
 #endif
 
   /* Setup command parameters */
+  if (DeviceExtension->DeviceFlags[Srb->TargetId] & DEVICE_48BIT_ADDRESS)
+    {
+      IDEWritePrecomp(DeviceExtension->CommandPortBase, 0);
+      IDEWriteSectorCount(DeviceExtension->CommandPortBase, SectorCount >> 8);
+      IDEWriteSectorNum(DeviceExtension->CommandPortBase, SectorNumber[1]);
+      IDEWriteCylinderLow(DeviceExtension->CommandPortBase, CylinderLow[1]);
+      IDEWriteCylinderHigh(DeviceExtension->CommandPortBase, CylinderHigh[1]);
+    }
+
   IDEWritePrecomp(DeviceExtension->CommandPortBase, 0);
-  IDEWriteSectorCount(DeviceExtension->CommandPortBase, SectorCount);
-  IDEWriteSectorNum(DeviceExtension->CommandPortBase, SectorNumber);
-  IDEWriteCylinderHigh(DeviceExtension->CommandPortBase, CylinderHigh);
-  IDEWriteCylinderLow(DeviceExtension->CommandPortBase, CylinderLow);
+  IDEWriteSectorCount(DeviceExtension->CommandPortBase, SectorCount & 0xff);
+  IDEWriteSectorNum(DeviceExtension->CommandPortBase, SectorNumber[0]);
+  IDEWriteCylinderLow(DeviceExtension->CommandPortBase, CylinderLow[0]);
+  IDEWriteCylinderHigh(DeviceExtension->CommandPortBase, CylinderHigh[0]);
+
   IDEWriteDriveHead(DeviceExtension->CommandPortBase, IDE_DH_FIXED | DrvHead);
 
 #ifdef ENABLE_DMA
@@ -2135,7 +2180,14 @@
   if (DeviceExtension->UseDma)
     {
       Handler = AtapiDmaInterrupt;
-      Command = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? IDE_CMD_READ_DMA : IDE_CMD_WRITE_DMA;
+      if (DeviceExtension->DeviceFlags[Srb->TargetId] & DEVICE_48BIT_ADDRESS)
+        {
+	  Command = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? IDE_CMD_READ_DMA_EXT : IDE_CMD_WRITE_DMA_EXT;
+	}
+      else
+        {
+          Command = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? IDE_CMD_READ_DMA : IDE_CMD_WRITE_DMA;
+	}
     }
   else
 #endif
@@ -2143,11 +2195,25 @@
       Handler = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? AtapiReadInterrupt : AtapiWriteInterrupt;
       if (DeviceExtension->DeviceFlags[Srb->TargetId] & DEVICE_MULTI_SECTOR_CMD)
         {
-          Command = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? IDE_CMD_READ_MULTIPLE : IDE_CMD_WRITE_MULTIPLE;
+          if (DeviceExtension->DeviceFlags[Srb->TargetId] & DEVICE_48BIT_ADDRESS)
+	    {
+              Command = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? IDE_CMD_READ_MULTIPLE_EXT : IDE_CMD_WRITE_MULTIPLE_EXT;
+	    }
+	  else
+	    {
+              Command = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? IDE_CMD_READ_MULTIPLE : IDE_CMD_WRITE_MULTIPLE;
+	    }
 	}
       else
         {
-          Command = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? IDE_CMD_READ : IDE_CMD_WRITE;
+          if (DeviceExtension->DeviceFlags[Srb->TargetId] & DEVICE_48BIT_ADDRESS)
+	    {
+	      Command = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? IDE_CMD_READ_EXT : IDE_CMD_WRITE_EXT;
+	    }
+	  else
+	    {
+	      Command = Srb->SrbFlags & SRB_FLAGS_DATA_IN ? IDE_CMD_READ : IDE_CMD_WRITE;
+	    }
 	}
     }
 
@@ -2274,7 +2340,9 @@
   ScsiPortStallExecution(10);
 
   /* Issue command to drive */
-  AtapiExecuteCommand(DeviceExtension, IDE_CMD_FLUSH_CACHE, AtapiNoDataInterrupt); 
+  AtapiExecuteCommand(DeviceExtension, 
+	              DeviceExtension->DeviceFlags[Srb->TargetId] & DEVICE_48BIT_ADDRESS ? IDE_CMD_FLUSH_CACHE_EXT : IDE_CMD_FLUSH_CACHE, 
+		      AtapiNoDataInterrupt); 
 
   /* Wait for controller ready */
   for (Retries = 0; Retries < IDE_MAX_WRITE_RETRIES; Retries++)

Modified: branches/alex_devel_branch/reactos/drivers/storage/atapi/atapi.h
--- branches/alex_devel_branch/reactos/drivers/storage/atapi/atapi.h	2005-03-05 22:20:15 UTC (rev 13838)
+++ branches/alex_devel_branch/reactos/drivers/storage/atapi/atapi.h	2005-03-05 23:19:42 UTC (rev 13839)
@@ -64,21 +64,27 @@
 #define  IDE_REG_COMMAND          0x0007
 
 /* IDE/ATA commands */
-#define    IDE_CMD_RESET            0x08
-#define    IDE_CMD_READ             0x20
-#define    IDE_CMD_READ_RETRY       0x21
-#define    IDE_CMD_WRITE            0x30
-#define    IDE_CMD_WRITE_RETRY      0x31
-#define    IDE_CMD_PACKET           0xA0
-#define    IDE_CMD_READ_MULTIPLE    0xC4
-#define    IDE_CMD_WRITE_MULTIPLE   0xC5
-#define    IDE_CMD_READ_DMA         0xC8
-#define    IDE_CMD_WRITE_DMA        0xCA
-#define    IDE_CMD_FLUSH_CACHE      0xE7
-#define    IDE_CMD_FLUSH_CACHE_EXT  0xEA
-#define    IDE_CMD_IDENT_ATA_DRV    0xEC
-#define    IDE_CMD_IDENT_ATAPI_DRV  0xA1
-#define    IDE_CMD_GET_MEDIA_STATUS 0xDA
+#define    IDE_CMD_RESET		0x08
+#define    IDE_CMD_READ			0x20
+#define    IDE_CMD_READ_ONCE		0x21
+#define    IDE_CMD_READ_EXT		0x24	/* 48 bit */
+#define    IDE_CMD_READ_DMA_EXT		0x25	/* 48 bit */
+#define    IDE_CMD_READ_MULTIPLE_EXT	0x29	/* 48 bit */
+#define    IDE_CMD_WRITE		0x30
+#define    IDE_CMD_WRITE_ONCE		0x31
+#define    IDE_CMD_WRITE_EXT		0x34	/* 48 bit */
+#define    IDE_CMD_WRITE_DMA_EXT	0x35	/* 48 bit */
+#define    IDE_CMD_WRITE_MULTIPLE_EXT	0x39	/* 48 bit */
+#define    IDE_CMD_PACKET		0xA0
+#define    IDE_CMD_READ_MULTIPLE	0xC4
+#define    IDE_CMD_WRITE_MULTIPLE	0xC5
+#define    IDE_CMD_READ_DMA		0xC8
+#define    IDE_CMD_WRITE_DMA		0xCA
+#define    IDE_CMD_FLUSH_CACHE		0xE7
+#define    IDE_CMD_FLUSH_CACHE_EXT	0xEA	/* 48 bit */
+#define    IDE_CMD_IDENT_ATA_DRV	0xEC
+#define    IDE_CMD_IDENT_ATAPI_DRV	0xA1
+#define    IDE_CMD_GET_MEDIA_STATUS	0xDA
 
 //
 //  Access macros for command registers

Modified: branches/alex_devel_branch/reactos/include/ntdll/rtl.h
--- branches/alex_devel_branch/reactos/include/ntdll/rtl.h	2005-03-05 22:20:15 UTC (rev 13838)
+++ branches/alex_devel_branch/reactos/include/ntdll/rtl.h	2005-03-05 23:19:42 UTC (rev 13839)
@@ -770,7 +770,14 @@
 STDCALL
 RtlDeleteTimerQueue(HANDLE TimerQueue);
 
+PVOID
+STDCALL
+RtlEncodePointer(IN PVOID Pointer);
 
+PVOID
+STDCALL
+RtlDecodePointer(IN PVOID Pointer);
+
 #ifndef __NTDRIVER__
 
 #ifndef __INTERLOCKED_DECLARED

Modified: branches/alex_devel_branch/reactos/lib/adns/Makefile
--- branches/alex_devel_branch/reactos/lib/adns/Makefile	2005-03-05 22:20:15 UTC (rev 13838)
+++ branches/alex_devel_branch/reactos/lib/adns/Makefile	2005-03-05 23:19:42 UTC (rev 13839)
@@ -7,8 +7,8 @@
 TARGET_NAME = adns
 
 TARGET_CFLAGS = \
- -O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
- -Wstrict-prototypes -Wmissing-prototypes -Wall -DADNS_JGAA_WIN32
+ -O3 -Wall -Wwrite-strings -Wpointer-arith \
+ -Wstrict-prototypes -Wmissing-prototypes -Wall -DADNS_JGAA_WIN32 -D__USE_W32API -D__REACTOS__
 
 # require os code to explicitly request A/W version of structs/functions
 TARGET_CFLAGS += -Isrc -Iadns_win32

Modified: branches/alex_devel_branch/reactos/lib/adns/src/event.c
--- branches/alex_devel_branch/reactos/lib/adns/src/event.c	2005-03-05 22:20:15 UTC (rev 13838)
+++ branches/alex_devel_branch/reactos/lib/adns/src/event.c	2005-03-05 23:19:42 UTC (rev 13839)
@@ -52,7 +52,7 @@
   
   serv= ads->tcpserver;
   adns_socket_close(ads->tcpsocket);
-  ads->tcpsocket= -1;
+  ads->tcpsocket= INVALID_SOCKET;
   ads->tcprecv.used= ads->tcprecv_skip= ads->tcpsend.used= 0;
 }
 

Modified: branches/alex_devel_branch/reactos/lib/ntdll/def/ntdll.def
--- branches/alex_devel_branch/reactos/lib/ntdll/def/ntdll.def	2005-03-05 22:20:15 UTC (rev 13838)
+++ branches/alex_devel_branch/reactos/lib/ntdll/def/ntdll.def	2005-03-05 23:19:42 UTC (rev 13839)
@@ -296,6 +296,7 @@
 RtlAddAuditAccessAceEx@28
 ;RtlAddCompoundAce
 RtlAddRange@36
+RtlAddVectoredExceptionHandler@8
 RtlAdjustPrivilege@16
 RtlAllocateAndInitializeSid@44
 RtlAllocateHandle@8
@@ -593,6 +594,7 @@
 RtlReleasePebLock@0
 RtlReleaseResource@4
 ;RtlRemoteCall
+RtlRemoveVectoredExceptionHandler@4
 RtlResetRtlTranslations@4
 RtlRestoreLastWin32Error@4=RtlSetLastWin32Error@4
 RtlRunDecodeUnicodeString@8

Modified: branches/alex_devel_branch/reactos/lib/ntdll/ldr/startup.c
--- branches/alex_devel_branch/reactos/lib/ntdll/ldr/startup.c	2005-03-05 22:20:15 UTC (rev 13838)
+++ branches/alex_devel_branch/reactos/lib/ntdll/ldr/startup.c	2005-03-05 23:19:42 UTC (rev 13839)
@@ -39,7 +39,9 @@
 
 NTSTATUS LdrpAttachThread (VOID);
 
+VOID RtlpInitializeVectoredExceptionHandling(VOID);
 
+
 #define VALUE_BUFFER_SIZE 256
 
 BOOLEAN FASTCALL
@@ -306,6 +308,9 @@
            ZwTerminateProcess(NtCurrentProcess(),STATUS_UNSUCCESSFUL);
          }
             
+       /* initialized vectored exception handling */
+       RtlpInitializeVectoredExceptionHandling();
+
        /* initalize peb lock support */
        RtlInitializeCriticalSection (&PebLock);
        Peb->FastPebLock = &PebLock;

Modified: branches/alex_devel_branch/reactos/lib/ntdll/rtl/exception.c
--- branches/alex_devel_branch/reactos/lib/ntdll/rtl/exception.c	2005-03-05 22:20:15 UTC (rev 13838)
+++ branches/alex_devel_branch/reactos/lib/ntdll/rtl/exception.c	2005-03-05 23:19:42 UTC (rev 13839)
@@ -22,6 +22,15 @@
 #define NDEBUG
 #include <debug.h>
 
+static CRITICAL_SECTION RtlpVectoredExceptionLock;
+static LIST_ENTRY RtlpVectoredExceptionHead;
+
+typedef struct _RTL_VECTORED_EXCEPTION_HANDLER
+{
+  LIST_ENTRY ListEntry;
+  PVECTORED_EXCEPTION_HANDLER VectoredHandler;
+} RTL_VECTORED_EXCEPTION_HANDLER, *PRTL_VECTORED_EXCEPTION_HANDLER;
+
 /* FUNCTIONS ***************************************************************/
 
 VOID STDCALL
@@ -87,4 +96,83 @@
   NtTerminateProcess(NtCurrentProcess(), ExitStatus);
 }
 
+
+VOID
+RtlpInitializeVectoredExceptionHandling(VOID)
+{
+  InitializeListHead(&RtlpVectoredExceptionHead);
+  RtlInitializeCriticalSection(&RtlpVectoredExceptionLock);
+}
+
+
+/*
+ * @implemented
+ */
+PVOID STDCALL
+RtlAddVectoredExceptionHandler(IN ULONG FirstHandler,
+                               IN PVECTORED_EXCEPTION_HANDLER VectoredHandler)
+{
+  PRTL_VECTORED_EXCEPTION_HANDLER veh;
+  
+  veh = RtlAllocateHeap(RtlGetProcessHeap(),
+                        0,
+                        sizeof(RTL_VECTORED_EXCEPTION_HANDLER));
+  if(veh != NULL)
+  {
+    veh->VectoredHandler = RtlEncodePointer(VectoredHandler);
+    RtlEnterCriticalSection(&RtlpVectoredExceptionLock);
+    if(FirstHandler != 0)
+    {
+      InsertHeadList(&RtlpVectoredExceptionHead,
+                     &veh->ListEntry);
+    }
+    else
+    {
+      InsertTailList(&RtlpVectoredExceptionHead,
+                     &veh->ListEntry);
+    }
+    RtlLeaveCriticalSection(&RtlpVectoredExceptionLock);
+  }
+  
+  return veh;
+}
+
+
+/*
+ * @implemented
+ */
+ULONG STDCALL
+RtlRemoveVectoredExceptionHandler(IN PVOID VectoredHandlerHandle)
+{
+  PLIST_ENTRY CurrentEntry;
+  PRTL_VECTORED_EXCEPTION_HANDLER veh = NULL;
+  ULONG Removed = FALSE;
+  
+  RtlEnterCriticalSection(&RtlpVectoredExceptionLock);
+  for(CurrentEntry = RtlpVectoredExceptionHead.Flink;
+      CurrentEntry != &RtlpVectoredExceptionHead;
+      CurrentEntry = CurrentEntry->Flink)
+  {
+    veh = CONTAINING_RECORD(CurrentEntry,
+                            RTL_VECTORED_EXCEPTION_HANDLER,
+                            ListEntry);
+    if(veh == VectoredHandlerHandle)
+    {
+      RemoveEntryList(&veh->ListEntry);
+      Removed = TRUE;
+      break;
+    }
+  }
+  RtlLeaveCriticalSection(&RtlpVectoredExceptionLock);
+  
+  if(Removed)
+  {
+    RtlFreeHeap(RtlGetProcessHeap(),
+                0,
+                veh);
+  }
+
+  return Removed;
+}
+
 /* EOF */

Modified: branches/alex_devel_branch/reactos/lib/rpcrt4/rpc_message.c
--- branches/alex_devel_branch/reactos/lib/rpcrt4/rpc_message.c	2005-03-05 22:20:15 UTC (rev 13838)
+++ branches/alex_devel_branch/reactos/lib/rpcrt4/rpc_message.c	2005-03-05 23:19:42 UTC (rev 13839)
@@ -265,10 +265,15 @@
     }
 
     /* transmit packet header */
-    if (!WriteFile(Connection->conn, Header, hdr_size, &count, NULL)) {
+    ResetEvent(Connection->ovl.hEvent);
+    if (!WriteFile(Connection->conn, Header, hdr_size, &count, &Connection->ovl)) {
       WARN("WriteFile failed with error %ld\n", GetLastError());
       return GetLastError();
     }
+    if (!GetOverlappedResult(Connection->conn, &Connection->ovl, &count, TRUE)) {
+      WARN("GetOverlappedResult failed with error %ld\n", GetLastError());
[truncated at 1000 lines; 755 more skipped]