2011-07-25 21:45:47 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
/*
|
|
|
|
When a process is created, DbgInitDebugChannels will locate DEBUGCHANNEL
|
|
|
|
environment variable and extract information about debug channels.
|
|
|
|
This information includes which of the win32k debug channels will be
|
|
|
|
enabled for the current process and which level of a channel will be active.
|
|
|
|
This information will be stored in ppi->DbgChannelLevel.
|
2015-02-21 17:28:37 +00:00
|
|
|
In this way user mode can control how win32k debugging will work when
|
2011-07-25 21:45:47 +00:00
|
|
|
the following macros are used: ERR, FIXME, WARN, TRACE
|
|
|
|
|
|
|
|
By default only the ERR channel will be active. Remember that other
|
|
|
|
debug channels can be activated for applications that are executed with a DEBUGCHANNEL
|
|
|
|
|
|
|
|
Valid syntax for DEBUGCHANNEL is the following:
|
|
|
|
+UserProcess,info+UserWnd,err+UserWndpos,-listview
|
|
|
|
warn+UserMsgQ,-UserMsgGet,+shell
|
|
|
|
|
|
|
|
Note the following:
|
|
|
|
The debug level is not required
|
|
|
|
The operation to enable/disable (+/-) and the name of the channel is required
|
|
|
|
Channels are devided by commas
|
|
|
|
No spaces are allowed
|
2015-02-21 17:28:37 +00:00
|
|
|
The syntax is case sensitive. Levels must be lowercase and
|
2011-07-25 21:45:47 +00:00
|
|
|
the names of the channels must be exactly like they are defined in DBG_DEFAULT_CHANNEL
|
|
|
|
This syntax can be mixed with wine debug channels without problems
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2012-03-08 09:18:28 +00:00
|
|
|
#if DBG
|
2011-07-25 21:45:47 +00:00
|
|
|
|
2014-04-20 13:29:53 +00:00
|
|
|
#if !defined(__RELFILE__)
|
|
|
|
#define __RELFILE__ __FILE__
|
|
|
|
#endif
|
|
|
|
|
2011-07-25 21:45:47 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
PWCHAR Name;
|
|
|
|
ULONG Id;
|
|
|
|
} DBG_CHANNEL;
|
|
|
|
|
2011-12-14 04:07:06 +00:00
|
|
|
/* Note: The following values don't need to be sorted */
|
2011-07-25 21:45:47 +00:00
|
|
|
enum _DEBUGCHANNELS
|
|
|
|
{
|
|
|
|
DbgChEngBlt,
|
|
|
|
DbgChEngBrush,
|
|
|
|
DbgChEngClip,
|
|
|
|
DbgChEngCursor,
|
|
|
|
DbgChEngDev,
|
|
|
|
DbgChEngErr,
|
|
|
|
DbgChEngEvent,
|
|
|
|
DbgChEngGrad,
|
|
|
|
DbgChEngLDev,
|
|
|
|
DbgChEngLine,
|
|
|
|
DbgChEngMapping,
|
2022-03-20 14:38:20 +00:00
|
|
|
DbgChEngMDev,
|
2011-07-25 21:45:47 +00:00
|
|
|
DbgChEngPDev,
|
|
|
|
DbgChEngSurface,
|
|
|
|
DbgChEngWnd,
|
|
|
|
DbgChEngXlate,
|
|
|
|
DbgChGdiBitmap,
|
|
|
|
DbgChGdiBlt,
|
|
|
|
DbgChGdiBrush,
|
|
|
|
DbgChGdiClipRgn,
|
|
|
|
DbgChGdiCoord,
|
|
|
|
DbgChGdiDC,
|
|
|
|
DbgChGdiDCAttr,
|
|
|
|
DbgChGdiDCState,
|
|
|
|
DbgChGdiDev,
|
|
|
|
DbgChGdiDib,
|
|
|
|
DbgChGdiFont,
|
|
|
|
DbgChGdiLine,
|
|
|
|
DbgChGdiObj,
|
|
|
|
DbgChGdiPalette,
|
|
|
|
DbgChGdiPath,
|
|
|
|
DbgChGdiPen,
|
|
|
|
DbgChGdiPool,
|
|
|
|
DbgChGdiRgn,
|
|
|
|
DbgChGdiText,
|
|
|
|
DbgChGdiXFormObj,
|
|
|
|
DbgChUserAccel,
|
2011-08-21 12:38:52 +00:00
|
|
|
DbgChUserCallback,
|
|
|
|
DbgChUserCallProc,
|
2011-07-25 21:45:47 +00:00
|
|
|
DbgChUserCaret,
|
|
|
|
DbgChUserClass,
|
|
|
|
DbgChUserClipbrd,
|
|
|
|
DbgChUserCsr,
|
|
|
|
DbgChUserDce,
|
2011-08-21 12:38:52 +00:00
|
|
|
DbgChUserDefwnd,
|
2011-07-25 21:45:47 +00:00
|
|
|
DbgChUserDesktop,
|
2011-08-21 12:38:52 +00:00
|
|
|
DbgChUserDisplay,
|
2011-07-25 21:45:47 +00:00
|
|
|
DbgChUserEvent,
|
|
|
|
DbgChUserFocus,
|
|
|
|
DbgChUserHook,
|
|
|
|
DbgChUserHotkey,
|
|
|
|
DbgChUserIcon,
|
|
|
|
DbgChUserInput,
|
|
|
|
DbgChUserKbd,
|
|
|
|
DbgChUserKbdLayout,
|
|
|
|
DbgChUserMenu,
|
|
|
|
DbgChUserMetric,
|
2011-08-21 12:38:52 +00:00
|
|
|
DbgChUserMisc,
|
2011-07-25 21:45:47 +00:00
|
|
|
DbgChUserMonitor,
|
2011-08-21 12:38:52 +00:00
|
|
|
DbgChUserMsg,
|
2011-07-25 21:45:47 +00:00
|
|
|
DbgChUserMsgQ,
|
|
|
|
DbgChUserObj,
|
2011-08-21 12:38:52 +00:00
|
|
|
DbgChUserPainting,
|
2011-07-25 21:45:47 +00:00
|
|
|
DbgChUserProcess,
|
|
|
|
DbgChUserProp,
|
|
|
|
DbgChUserScrollbar,
|
2022-03-16 20:03:56 +00:00
|
|
|
DbgChUserSecurity,
|
2014-11-28 21:48:44 +00:00
|
|
|
DbgChUserShutdown,
|
2011-08-21 12:38:52 +00:00
|
|
|
DbgChUserSysparams,
|
2011-07-25 21:45:47 +00:00
|
|
|
DbgChUserThread,
|
|
|
|
DbgChUserTimer,
|
|
|
|
DbgChUserWinsta,
|
|
|
|
DbgChUserWnd,
|
2011-08-21 12:38:52 +00:00
|
|
|
DbgChUserWinpos,
|
2011-07-25 21:45:47 +00:00
|
|
|
DbgChCount
|
|
|
|
};
|
2015-02-21 17:28:37 +00:00
|
|
|
|
2011-07-25 21:45:47 +00:00
|
|
|
#define DISABLED_LEVEL 0x0
|
|
|
|
#define ERR_LEVEL 0x1
|
|
|
|
#define FIXME_LEVEL 0x2
|
|
|
|
#define WARN_LEVEL 0x4
|
|
|
|
#define TRACE_LEVEL 0x8
|
|
|
|
|
|
|
|
#define MAX_LEVEL ERR_LEVEL | FIXME_LEVEL | WARN_LEVEL | TRACE_LEVEL
|
|
|
|
|
2011-08-21 12:38:52 +00:00
|
|
|
#define DBG_GET_PPI ((PPROCESSINFO)PsGetCurrentProcessWin32Process())
|
2011-07-25 21:45:47 +00:00
|
|
|
#define DBG_DEFAULT_CHANNEL(x) static int DbgDefaultChannel = DbgCh##x;
|
|
|
|
|
|
|
|
#define DBG_ENABLE_CHANNEL(ppi,ch,level) ((ppi)->DbgChannelLevel[ch] |= level)
|
|
|
|
#define DBG_DISABLE_CHANNEL(ppi,ch,level) ((ppi)->DbgChannelLevel[ch] &= ~level)
|
2012-10-27 16:39:18 +00:00
|
|
|
#define DBG_IS_CHANNEL_ENABLED(ppi,ch,level) (((ppi)->DbgChannelLevel[ch] & level) == level)
|
2011-07-25 21:45:47 +00:00
|
|
|
|
2018-06-09 22:48:45 +00:00
|
|
|
#define DBG_PRINT(ppi,ch,level,fmt, ...) \
|
|
|
|
do { \
|
|
|
|
if ((level == ERR_LEVEL) || (ppi && DBG_IS_CHANNEL_ENABLED(ppi,ch,level))) \
|
|
|
|
DbgPrint("(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__); \
|
|
|
|
} while (0)
|
2011-07-25 21:45:47 +00:00
|
|
|
|
2011-08-21 12:38:52 +00:00
|
|
|
#define ERR(fmt, ...) DBG_PRINT(DBG_GET_PPI, DbgDefaultChannel, ERR_LEVEL,"err: " fmt, ##__VA_ARGS__)
|
|
|
|
#define FIXME(fmt, ...) DBG_PRINT(DBG_GET_PPI, DbgDefaultChannel, FIXME_LEVEL,"fixme: " fmt, ##__VA_ARGS__)
|
|
|
|
#define WARN(fmt, ...) DBG_PRINT(DBG_GET_PPI, DbgDefaultChannel, WARN_LEVEL,"warn: " fmt, ##__VA_ARGS__)
|
|
|
|
#define TRACE(fmt, ...) DBG_PRINT(DBG_GET_PPI, DbgDefaultChannel, TRACE_LEVEL,"trace: " fmt, ##__VA_ARGS__)
|
2011-07-25 21:45:47 +00:00
|
|
|
|
2011-08-21 12:38:52 +00:00
|
|
|
#define ERR_CH(ch,fmt, ...) DBG_PRINT(DBG_GET_PPI, DbgCh##ch, ERR_LEVEL, "err: " fmt, ##__VA_ARGS__)
|
|
|
|
#define FIXME_CH(ch,fmt, ...) DBG_PRINT(DBG_GET_PPI, DbgCh##ch, FIXME_LEVEL, "fixme: " fmt, ##__VA_ARGS__)
|
|
|
|
#define WARN_CH(ch,fmt, ...) DBG_PRINT(DBG_GET_PPI, DbgCh##ch, WARN_LEVEL, "warn: " fmt, ##__VA_ARGS__)
|
|
|
|
#define TRACE_CH(ch,fmt, ...) DBG_PRINT(DBG_GET_PPI, DbgCh##ch, TRACE_LEVEL, "trace: " fmt, ##__VA_ARGS__)
|
2011-07-25 21:45:47 +00:00
|
|
|
|
2011-08-21 12:38:52 +00:00
|
|
|
#define ERR_PPI(ppi,ch,fmt, ...) DBG_PRINT(ppi, DbgCh##ch, ERR_LEVEL,"err: " fmt, ##__VA_ARGS__)
|
|
|
|
#define FIXME_PPI(ppi,ch,fmt, ...) DBG_PRINT(ppi, DbgCh##ch, FIXME_LEVEL,"fixme: " fmt, ##__VA_ARGS__)
|
|
|
|
#define WARN_PPI(ppi,ch,fmt, ...) DBG_PRINT(ppi, DbgCh##ch, WARN_LEVEL,"warn: " fmt, ##__VA_ARGS__)
|
|
|
|
#define TRACE_PPI(ppi,ch,fmt, ...) DBG_PRINT(ppi, DbgCh##ch, TRACE_LEVEL,"trace: " fmt, ##__VA_ARGS__)
|
|
|
|
|
2014-04-20 13:29:53 +00:00
|
|
|
#define STUB DbgPrint("WARNING: %s at %s:%d is UNIMPLEMENTED!\n",__FUNCTION__,__RELFILE__,__LINE__);
|
2011-07-25 21:45:47 +00:00
|
|
|
|
|
|
|
#else
|
2015-02-21 17:28:37 +00:00
|
|
|
#define DBG_GET_PPI
|
2012-03-07 21:18:30 +00:00
|
|
|
#define DBG_DEFAULT_CHANNEL(x)
|
2011-07-25 21:45:47 +00:00
|
|
|
|
2012-03-07 21:18:30 +00:00
|
|
|
#define DBG_ENABLE_CHANNEL(ppi,ch,level)
|
|
|
|
#define DBG_DISABLE_CHANNEL(ppi,ch,level)
|
|
|
|
#define DBG_IS_CHANNEL_ENABLED(ppi,ch,level)
|
2011-07-25 21:45:47 +00:00
|
|
|
|
2015-02-21 17:28:37 +00:00
|
|
|
#define DBG_PRINT(ppi,ch,level)
|
2011-07-25 21:45:47 +00:00
|
|
|
|
2015-02-21 17:28:37 +00:00
|
|
|
#define ERR(fmt, ...)
|
|
|
|
#define FIXME(fmt, ...)
|
|
|
|
#define WARN(fmt, ...)
|
|
|
|
#define TRACE(fmt, ...)
|
2011-07-25 21:45:47 +00:00
|
|
|
|
2015-02-21 17:28:37 +00:00
|
|
|
#define ERR_CH(ch,fmt, ...)
|
2011-07-25 21:45:47 +00:00
|
|
|
#define FIXME_CH(ch,fmt, ...)
|
2015-02-21 17:28:37 +00:00
|
|
|
#define WARN_CH(ch,fmt, ...)
|
2011-07-25 21:45:47 +00:00
|
|
|
#define TRACE_CH(ch,fmt, ...)
|
|
|
|
|
2015-02-21 17:28:37 +00:00
|
|
|
#define ERR_PPI(ppi,ch,fmt, ...)
|
|
|
|
#define FIXME_PPI(ppi,ch,fmt, ...)
|
|
|
|
#define WARN_PPI(ppi,ch,fmt, ...)
|
|
|
|
#define TRACE_PPI(ppi,ch,fmt, ...)
|
2011-08-21 12:38:52 +00:00
|
|
|
|
2012-03-07 21:18:30 +00:00
|
|
|
#define STUB
|
|
|
|
|
2011-07-25 21:45:47 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
BOOL DbgInitDebugChannels();
|