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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
//****************************************************************************
//
// Module: UNIMDM
// File: TRACING.H
//
// Copyright (c) 1992-1996, Microsoft Corporation, all rights reserved
//
// Revision History
//
//
// 3/29/96 JosephJ Created
//
//
// Description: Tracing (retail-mode diagnostics) functions
//
//****************************************************************************
#include <tspnotif.h>
#include "traceids.h"
// Trace-related flags, specified in the dwFlags field of TRACEINFO
#define fTI_ERROR (0x1<<0)
#define fTI_WARN (0x1<<1)
#define fTI_LOGTO_MEM (0x1<<31)
#define fTI_LOGTO_FILE (0x1<<31)
#define fTI_LOGTO_TRACE (0x1<<31)
// These IDs uniquely define the object type passed into traceRegisterObject.
// These will eventually be guids. For now they are simply integer IDs.
#define TSP_TIMER_LIST_GUID 0x1000
#define TSP_OVER_LIST_GUID 0x1001
#define TSP_MODEM_LIST_GUID 0x1002
#define TSP_COMMON_LIST_GUID 0x1003
// The corresponding implementation version of the objects above. Bump up
// the version each time there is a change in that objects internal
// structure.
#define TSP_TIMER_LIST_VERSION 0
#define TSP_OVER_LIST_VERSION 0
#define TSP_MODEM_LIST_VERSION 0
#define TSP_COMMON_LIST_VERSION 0
// dwMDMDBG_CURRENT_VERSION is passed into the external tracing dll's
// MdmDbgInit function to verify compatible versions.
// 7/13/96 JosephJ INITIALVERSION+2 should be official NT4.0 version.
#define dwMDMDBG_INITIAL_VERSION 0x12345678
#define dwMDMDBG_CURRENT_VERSION (dwMDMDBG_INITIAL_VERSION+3)
// This macro determines whether tracing is enabled for this session.
// Tracing is enabled during ProviderInit, based on a registry setting.
// If enabled, it is not disabled until provider shutdown.
#define TRACINGENABLED() (gfTracingEnabled)
#define TRACE1(_what) \
(void)(TRACINGENABLED() \
? traceTrace1(_what) \
: 0)
#define TRACE2(_what, _dw0) \
(void)(TRACINGENABLED() \
? traceTrace2( \
_what, \
(DWORD)(_dw0) \
) \
: 0)
#define TRACE3(_what, _dw0, _dw1) \
(void)(TRACINGENABLED() \
? traceTrace3( \
_what, \
(DWORD)(_dw0), (DWORD)(_dw1) \
) \
: 0)
#define TRACE4(_what, _dw0, _dw1, _dw2) \
(void)(TRACINGENABLED() \
? traceTrace4( \
_what, \
(DWORD)(_dw0), (DWORD)(_dw1), (DWORD)(_dw2) \
) \
: 0)
#define TRACE5(_what, _dw0, _dw1, _dw2, _dw3) \
(void)(TRACINGENABLED() \
? traceTrace5( \
_what, \
(DWORD)(_dw0), (DWORD)(_dw1), (DWORD)(_dw2), (DWORD)(_dw3) \
) \
: 0)
#define TRACE8(_what, _dw0, _dw1, _dw2, _dw3, _dw4, _dw5, _dw6) \
(void)(TRACINGENABLED() \
? traceTrace8( \
_what, \
(DWORD)(_dw0), (DWORD)(_dw1), (DWORD)(_dw2), (DWORD)(_dw3), \
(DWORD)(_dw4), (DWORD)(_dw5), (DWORD)(_dw6) \
) \
: 0)
// Tracing-related instance data tacked on to the trace-enabled version of
// an object (see for example OVERNODE in unimdm.h).
//
typedef struct {
DWORD dw0;
} TRACEINSTDATA;
// This struct is passed in to most tracing output functions (tracePrintf, etc),
// to provide some additional context.
typedef struct
{
DWORD dwID; // Device ID, if applicable
DWORD dwFlags; // One of the fTI_* flags defined above.
HANDLE hFile; // Handle to a file, if file logging is enabled.
} TRACEINFO, *PTRACEINFO;
void tracePrintf(
PTRACEINFO pti,
DWORD dwFlags,
LPCTSTR lpctszFormat,
...
);
void traceOnProcessAttach(void);
void traceOnProcessDetach(void);
void traceInitialize(DWORD dwPermanentID);
void traceDeinitialize(void);
typedef DWORD PGUID;
void traceRegisterObject(
PVOID pv,
PGUID pg,
DWORD dwVersion,
DWORD dwFlags,
DWORD dwParam
);
void traceUnRegisterObject(
PVOID pv,
DWORD dwFlags,
DWORD dwParam
);
void traceProcessNotification(
PNOTIFICATION_FRAME pnf
);
void traceTrace1(
DWORD dwWhat
);
void traceTrace2(
DWORD dwWhat,
DWORD dw0
);
void traceTrace3(
DWORD dwWhat,
DWORD dw0,
DWORD dw1
);
void traceTrace4(
DWORD dwWhat,
DWORD dw0,
DWORD dw1,
DWORD dw2
);
void traceTrace5(
DWORD dwWhat,
DWORD dw0,
DWORD dw1,
DWORD dw2,
DWORD dw3
);
void traceTrace8(
DWORD dwWhat,
DWORD dw0,
DWORD dw1,
DWORD dw2,
DWORD dw3,
DWORD dw4,
DWORD dw5,
DWORD dw6
);
LINEEVENT traceSetEventProc(LINEEVENT lineEventProc);
ASYNC_COMPLETION traceSetCompletionProc(ASYNC_COMPLETION cbCompletionProc);
extern BOOL gfTracingEnabled;
|