summaryrefslogtreecommitdiffstats
path: root/private/ntos/mailslot/debug.c
blob: cee41c8b96f3bad60bac97ab1788c733b2a692a9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*++

Copyright (c) 1989  Microsoft Corporation

Module Name:

    debug.c

Abstract:

    This module implements the debugging function for the mailslot file
    system.

Author:

    Manny Weiser (mannyw)    17-Jan-1991

Revision History:

--*/

#include "mailslot.h"
#include "stdio.h"


#ifdef MSDBG

#ifdef ALLOC_PRAGMA
#pragma alloc_text( PAGE, _DebugTrace )
#endif

VOID
_DebugTrace(
    LONG Indent,
    ULONG Level,
    PSZ X,
    ULONG Y
    )

/*++

Routine Description:

    This routine display debugging information.

Arguments:

    Level - The debug level required to display this message.  If
        level is 0 the message is displayed regardless of the setting
        or the debug level

    Indent - Incremement or the current debug message indent

    X - 1st print parameter

    Y - 2nd print parameter

Return Value:

    None.

--*/

{
    LONG i;
    char printMask[100];

    PAGED_CODE();
    if ((Level == 0) || (MsDebugTraceLevel & Level)) {

        if (Indent < 0) {
            MsDebugTraceIndent += Indent;
        }

        if (MsDebugTraceIndent < 0) {
            MsDebugTraceIndent = 0;
        }

        sprintf( printMask, "%%08lx:%%.*s%s", X );

        i = (LONG)PsGetCurrentThread();
        DbgPrint( printMask, i, MsDebugTraceIndent, "", Y );
        if (Indent > 0) {
            MsDebugTraceIndent += Indent;
        }
    }
}
#endif // MSDBG