DosPrintCharacter(DOS_OUTPUT_HANDLE, Character);
}
-/*
- * This function, derived from ntvdm.c!DisplayMessage, is used by the BIOS and
- * the DOS to display messages to an output device. A printer function is given
- * for printing the characters.
- */
-static VOID
-DisplayMessageAnsiV(IN CHAR_PRINT CharPrint,
- IN LPCSTR Format,
- IN va_list args)
-{
- static CHAR CurChar = 0;
- LPSTR str;
-
-#ifndef WIN2K_COMPLIANT
- CHAR StaticBuffer[256];
- LPSTR Buffer = StaticBuffer; // Use the static buffer by default.
-#else
- CHAR Buffer[2048]; // Large enough. If not, increase it by hand.
-#endif
- size_t MsgLen;
-
-#ifndef WIN2K_COMPLIANT
- /*
- * Retrieve the message length and if it is too long, allocate
- * an auxiliary buffer; otherwise use the static buffer.
- * The string is built to be NULL-terminated.
- */
- MsgLen = _vscprintf(Format, args);
- if (MsgLen >= ARRAYSIZE(StaticBuffer))
- {
- Buffer = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, (MsgLen + 1) * sizeof(CHAR));
- if (Buffer == NULL)
- {
- /* Allocation failed, use the static buffer and display a suitable error message */
- Buffer = StaticBuffer;
- Format = "DisplayMessageAnsi()\nOriginal message is too long and allocating an auxiliary buffer failed.";
- MsgLen = strlen(Format);
- }
- }
-#else
- MsgLen = ARRAYSIZE(Buffer) - 1;
-#endif
-
- RtlZeroMemory(Buffer, (MsgLen + 1) * sizeof(CHAR));
- _vsnprintf(Buffer, MsgLen, Format, args);
-
- /* Display the message */
- DPRINT1("\n\nNTVDM DOS32\n%s\n\n", Buffer);
-
- MsgLen = strlen(Buffer);
- str = Buffer;
- while (MsgLen--)
- {
- if (*str == '\n' && CurChar != '\r')
- CharPrint('\r');
-
- CurChar = *str++;
- CharPrint(CurChar);
- }
-
-#ifndef WIN2K_COMPLIANT
- /* Free the buffer if needed */
- if (Buffer != StaticBuffer) RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
-#endif
-}
-
-VOID
-DemDisplayMessage(IN CHAR_PRINT CharPrint,
- IN LPCSTR Format, ...)
-{
- va_list Parameters;
-
- va_start(Parameters, Format);
- DisplayMessageAnsiV(CharPrint, Format, Parameters);
- va_end(Parameters);
-}
-
static VOID DemLoadNTDOSKernel(VOID)
{