- Allow shared read access to the debug.log file.
[reactos.git] / reactos / ntoskrnl / kd / dlog.c
index b4bab16..2bd3c10 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: dlog.c,v 1.12 2004/03/07 04:38:41 dwelch Exp $
+/* $Id: dlog.c,v 1.16 2004/09/01 00:15:08 navaraf Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
 
 /* INCLUDES ******************************************************************/
 
-#include <ddk/ntddk.h>
-#include <internal/ntoskrnl.h>
-#include <roscfg.h>
-#include <internal/kd.h>
-#include <ntos/minmax.h>
-#include <rosrtl/string.h>
+#include <ntoskrnl.h>
 
 /* GLOBALS *******************************************************************/
 
@@ -35,6 +30,38 @@ static KEVENT DebugLogEvent;
 
 /* FUNCTIONS *****************************************************************/
 
+VOID
+DebugLogDumpMessages(VOID)
+{
+  static CHAR Buffer[256];
+  ULONG Offset;
+  ULONG Length;
+
+  if (!(KdDebugState & KD_DEBUG_BOOTLOG))
+    {
+      return;
+    }
+  KdDebugState &= ~KD_DEBUG_BOOTLOG;
+  Offset = (DebugLogEnd + 1) % DEBUGLOG_SIZE;
+  do
+    {
+      if (Offset <= DebugLogEnd)
+       {
+         Length = min(255, DebugLogEnd - Offset);
+       }
+      else
+       {
+         Length = min(255, DEBUGLOG_SIZE - Offset);
+       }
+      memcpy(Buffer, DebugLog + Offset, Length);
+      Buffer[Length] = 0;
+      DbgPrint(Buffer);
+      Offset = (Offset + Length) % DEBUGLOG_SIZE;
+    }
+  while (Length > 0);
+}
+
 VOID INIT_FUNCTION
 DebugLogInit(VOID)
 {
@@ -131,7 +158,7 @@ DebugLogInit2(VOID)
                        &Iosb,
                        NULL,
                        FILE_ATTRIBUTE_NORMAL,
-                       0,
+                       FILE_SHARE_READ,
                        FILE_SUPERSEDE,
                        FILE_WRITE_THROUGH | FILE_SYNCHRONOUS_IO_NONALERT,
                        NULL,