20template <UINT t_category = (1 << 19), UINT t_level = 0>
26 TraceGeneral = (1 << 0),
29 TraceRegistrar = (1 << 3),
30 TraceRefcount = (1 << 4),
31 TraceWindowing = (1 << 5),
32 TraceControls = (1 << 6),
33 TraceHosting = (1 << 7),
34 TraceDBClient = (1 << 8),
35 TraceDBProv
ider = (1 << 9),
36 TraceSnapin = (1 << 10),
37 TraceNotImpl = (1 << 11),
38 TraceAllocation = (1 << 12),
39 TraceException = (1 << 13),
40 TraceTime = (1 << 14),
41 TraceCache = (1 << 15),
42 TraceStencil = (1 << 16),
43 TraceString = (1 << 17),
45 TraceUtil = (1 << 19),
46 TraceSecurity = (1 << 20),
47 TraceSync = (1 << 21),
48 TraceISAPI = (1 << 22),
52 CTraceCategoryEx(LPCTSTR name = NULL) : m_name(name)
56 static UINT GetLevel() { return t_level; }
57 static UINT GetCategory() { return t_category; }
58 operator UINT() const { return GetCategory(); }
59 LPCTSTR GetCategoryName() const { return m_name; }
65class CTraceCategory : public CTraceCategoryEx<>
67 CTraceCategory(LPCTSTR name = NULL) : CTraceCategoryEx<>(name)
72#define DEFINE_TRACE_CATEGORY(name, cat) extern const DECLSPEC_
SELECTANY CTraceCategoryEx<cat, 0> name(TEXT(#name))
73DEFINE_TRACE_CATEGORY(atlTraceGeneral, CTraceCategoryEx<>::TraceGeneral);
74DEFINE_TRACE_CATEGORY(atlTraceCOM, CTraceCategoryEx<>::TraceCom);
75DEFINE_TRACE_CATEGORY(atlTraceQI, CTraceCategoryEx<>::TraceQI);
76DEFINE_TRACE_CATEGORY(atlTraceRegistrar, CTraceCategoryEx<>::TraceRegistrar);
77DEFINE_TRACE_CATEGORY(atlTraceRefcount, CTraceCategoryEx<>::TraceRefcount);
78DEFINE_TRACE_CATEGORY(atlTraceWindowing, CTraceCategoryEx<>::TraceWindowing);
79DEFINE_TRACE_CATEGORY(atlTraceControls, CTraceCategoryEx<>::TraceControls);
80DEFINE_TRACE_CATEGORY(atlTraceHosting, CTraceCategoryEx<>::TraceHosting);
81DEFINE_TRACE_CATEGORY(atlTraceDBClient, CTraceCategoryEx<>::TraceDBClient);
82DEFINE_TRACE_CATEGORY(atlTraceDBProv
ider, CTraceCategoryEx<>::TraceDBProv
ider);
83DEFINE_TRACE_CATEGORY(atlTraceSnapin, CTraceCategoryEx<>::TraceSnapin);
84DEFINE_TRACE_CATEGORY(atlTraceNotImpl, CTraceCategoryEx<>::TraceNotImpl);
85DEFINE_TRACE_CATEGORY(atlTraceAllocation, CTraceCategoryEx<>::TraceAllocation);
86DEFINE_TRACE_CATEGORY(atlTraceException, CTraceCategoryEx<>::TraceException);
87DEFINE_TRACE_CATEGORY(atlTraceTime, CTraceCategoryEx<>::TraceTime);
88DEFINE_TRACE_CATEGORY(atlTraceCache, CTraceCategoryEx<>::TraceCache);
89DEFINE_TRACE_CATEGORY(atlTraceStencil, CTraceCategoryEx<>::TraceStencil);
90DEFINE_TRACE_CATEGORY(atlTraceString, CTraceCategoryEx<>::TraceString);
91DEFINE_TRACE_CATEGORY(atlTraceMap, CTraceCategoryEx<>::TraceMap);
92DEFINE_TRACE_CATEGORY(atlTraceUtil, CTraceCategoryEx<>::TraceUtil);
93DEFINE_TRACE_CATEGORY(atlTraceSecurity, CTraceCategoryEx<>::TraceSecurity);
94DEFINE_TRACE_CATEGORY(atlTraceSync, CTraceCategoryEx<>::TraceSync);
95DEFINE_TRACE_CATEGORY(atlTraceISAPI, CTraceCategoryEx<>::TraceISAPI);
96#undef DEFINE_TRACE_CATEGORY
98struct CTraceCategoryEasy
104 template <UINT t_category, UINT t_level>
105 CTraceCategoryEasy(
const CTraceCategoryEx<t_category, t_level>& cat)
107 m_category = t_category;
109 m_name = cat.GetCategoryName();
112 operator UINT()
const {
return m_category; }
114 BOOL IsGeneral()
const
116 return lstrcmp(m_name,
TEXT(
"atlTraceGeneral")) == 0;
124 DefaultTraceLevel = 0,
125 DisableTracing = 0xFFFFFFFF,
126 EnableAllCategories = 0xFFFFFFFF
129 static UINT GetLevel() {
return s_level; }
130 static UINT GetCategories() {
return s_categories; }
136 return (s_level != DisableTracing && s_level >=
level && (s_categories &
category));
140 static UINT s_categories;
147template <
typename X_CHAR>
151 _In_ const CTraceCategoryEasy& cat,
156 char szBuff[1024], szFile[
MAX_PATH];
158 const BOOL bUnicode = (
sizeof(
TCHAR) == 2);
160 if (!CTrace::IsTracingEnabled(cat,
level))
163#ifdef _STRSAFE_H_INCLUDED_
165 if (!cat.IsGeneral())
173 if (!cat.IsGeneral())
181template <
typename X_CHAR>
185 _In_ const CTraceCategoryEasy& cat,
192 const BOOL bUnicode = (
sizeof(
TCHAR) == 2);
194 if (!CTrace::IsTracingEnabled(cat,
level))
197#ifdef _STRSAFE_H_INCLUDED_
199 if (!cat.IsGeneral())
207 if (!cat.IsGeneral())
215template <
typename X_CHAR,
typename Y_CHAR>
219 _In_ const CTraceCategoryEasy& cat,
230template <
typename X_CHAR,
typename Y_CHAR>
251template <
typename X_CHAR>
257 AtlTraceV(
NULL, -1, atlTraceGeneral, 0,
format, va);
267 #define ATLTRACE(format, ...) ATL::AtlTraceEx(__FILE__, __LINE__, format, ##__VA_ARGS__)
269 #define ATLTRACE(format, ...) ((void)0)
273#define ATLTRACE2 ATLTRACE
276 #define ATLTRACENOTIMPL(funcname) do { \
277 ATLTRACE(atlTraceNotImpl, 0, #funcname " is not implemented.\n"); \
281 #define ATLTRACENOTIMPL(funcname) return E_NOTIMPL
284#ifndef _ATL_NO_AUTOMATIC_NAMESPACE
EXTERN_C int __cdecl _CrtDbgReportW(int reportType, const wchar_t *filename, int linenumber, const wchar_t *moduleName, const wchar_t *format,...)
EXTERN_C int __cdecl _CrtDbgReport(int reportType, const char *filename, int linenumber, const char *moduleName, const char *format,...)
GLsizei GLenum * categories
_CRTIMP int __cdecl _vsnwprintf(wchar_t *_Dest, size_t _Count, const wchar_t *_Format, va_list _Args)
int _snwprintf(wchar_t *buffer, size_t count, const wchar_t *format,...)
static DWORD DWORD void LPSTR DWORD cch
#define _Printf_format_string_
#define DECLSPEC_SELECTANY
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
STRSAFEAPI StringCchLengthA(STRSAFE_LPCSTR psz, size_t cchMax, size_t *pcchLength)
STRSAFEAPI StringCchVPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat, va_list argList)
STRSAFEAPI StringCchLengthW(STRSAFE_LPCWSTR psz, size_t cchMax, size_t *pcchLength)
STRSAFEAPI StringCchPrintfA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszFormat,...)
STRSAFEAPI StringCchVPrintfA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszFormat, va_list argList)