From 3a0c3db1e0856e48118bd1625fd39cb88c34e2fe Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Thu, 24 Jul 2008 16:44:01 +0000 Subject: [PATCH] convert external debug output from message boxes to real debug output on serial svn path=/branches/ros-amd64-bringup/; revision=34747 --- .../boot/freeldr/freeldr/reactos/reactos.c | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/reactos/boot/freeldr/freeldr/reactos/reactos.c b/reactos/boot/freeldr/freeldr/reactos/reactos.c index 2e56a7ed1d1..ac5b9a10fd0 100644 --- a/reactos/boot/freeldr/freeldr/reactos/reactos.c +++ b/reactos/boot/freeldr/freeldr/reactos/reactos.c @@ -874,6 +874,7 @@ LoadAndBootReactOS(PCSTR OperatingSystemName) } #undef DbgPrint +#if 0 ULONG DbgPrint(const char *Format, ...) { @@ -903,5 +904,39 @@ DbgPrint(const char *Format, ...) va_end(ap); return 0; } +#else +VOID DebugPrintChar(UCHAR Character); +ULONG +DbgPrint(const char *Format, ...) +{ + va_list ap; + CHAR Buffer[512]; + ULONG Length; + char *ptr = Buffer; + + va_start(ap, Format); + + /* Construct a string */ + Length = _vsnprintf(Buffer, 512, Format, ap); + + /* Check if we went past the buffer */ + if (Length == -1) + { + /* Terminate it if we went over-board */ + Buffer[sizeof(Buffer) - 1] = '\n'; + + /* Put maximum */ + Length = sizeof(Buffer); + } + + while (*ptr) + { + DebugPrintChar(*ptr++); + } + + va_end(ap); + return 0; +} +#endif /* EOF */