Use free Windows DDK and compile with latest MinGW releases.
[reactos.git] / reactos / lib / ntdll / dbg / print.c
1 /* $Id: print.c,v 1.5 2002/09/07 15:12:39 chorns Exp $
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: lib/ntdll/dbg/print.c
6 * PURPOSE: Debug output
7 * PROGRAMMER: Eric Kohl
8 * UPDATE HISTORY:
9 * Created 28/12/1999
10 */
11
12 /* INCLUDES ***************************************************************/
13
14 #define NTOS_USER_MODE
15 #include <ntos.h>
16 #include <stdarg.h>
17 #include <stdio.h>
18 #include <string.h>
19
20 #define NDEBUG
21 #include <debug.h>
22
23 /* FUNCTIONS ***************************************************************/
24
25 ULONG DbgService (ULONG Service, PVOID Context1, PVOID Context2);
26 __asm__ ("\n\t.global _DbgService\n\t"
27 "_DbgService:\n\t"
28 "mov 4(%esp), %eax\n\t"
29 "mov 8(%esp), %ecx\n\t"
30 "mov 12(%esp), %edx\n\t"
31 "int $0x2D\n\t"
32 "ret\n\t");
33
34 ULONG
35 DbgPrint(PCH Format, ...)
36 {
37 ANSI_STRING DebugString;
38 CHAR Buffer[4096];
39 va_list ap;
40
41 /* init ansi string */
42 DebugString.Buffer = Buffer;
43 DebugString.MaximumLength = sizeof(Buffer);
44
45 va_start (ap, Format);
46 DebugString.Length = _vsnprintf (Buffer, sizeof(Buffer), Format, ap);
47 va_end (ap);
48
49 DbgService (1, &DebugString, NULL);
50
51 return (ULONG)DebugString.Length;
52 }
53
54
55 VOID
56 STDCALL
57 DbgPrompt (
58 PCH OutputString,
59 PCH InputString,
60 USHORT InputSize
61 )
62 {
63 ANSI_STRING Output;
64 ANSI_STRING Input;
65
66 Input.Length = 0;
67 Input.MaximumLength = InputSize;
68 Input.Buffer = InputString;
69
70 Output.Length = strlen (OutputString);
71 Output.MaximumLength = Output.Length + 1;
72 Output.Buffer = OutputString;
73
74 DbgService (2,
75 &Output,
76 &Input);
77 }
78
79 /* EOF */