Author: fireball Date: Thu Aug 31 20:08:17 2006 New Revision: 23843
URL: http://svn.reactos.org/svn/reactos?rev=23843&view=rev Log: Change a very ugly done DbgPrint() function to a good implementation. Now Freeldr shows all DPRINTs from e.g. cmlib correctly.
Modified: trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c
Modified: trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/reacto... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c (original) +++ trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c Thu Aug 31 20:08:17 2006 @@ -870,10 +870,33 @@
#undef DbgPrint ULONG -DbgPrint(const char *Fmt, ...) -{ - UiMessageBox(Fmt); - return 0; +DbgPrint(const char *Format, ...) +{ + va_list ap; + CHAR Buffer[512]; + ULONG Length; + + 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); + } + + /* Show it as a message box */ + UiMessageBox(Buffer); + + /* Cleanup and exit */ + va_end(ap); + return 0; }
/* EOF */