2011-09-23 12:05:40 +00:00
|
|
|
|
2011-09-24 11:55:19 +00:00
|
|
|
typedef enum _MSG_TYPE
|
|
|
|
{
|
|
|
|
SENT,
|
|
|
|
POST,
|
|
|
|
HOOK,
|
|
|
|
EVENT
|
|
|
|
} MSG_TYPE;
|
2011-09-23 12:05:40 +00:00
|
|
|
|
|
|
|
typedef struct _MSG_ENTRY
|
|
|
|
{
|
|
|
|
int iwnd;
|
|
|
|
UINT msg;
|
2011-09-24 11:55:19 +00:00
|
|
|
MSG_TYPE type;
|
2011-09-23 12:05:40 +00:00
|
|
|
int param1;
|
|
|
|
int param2;
|
|
|
|
} MSG_ENTRY;
|
|
|
|
|
2012-08-13 18:04:04 +00:00
|
|
|
typedef struct _MSG_CACHE
|
|
|
|
{
|
|
|
|
MSG_ENTRY last_post_message;
|
|
|
|
MSG_ENTRY message_cache[100];
|
|
|
|
int count;
|
|
|
|
} MSG_CACHE;
|
2011-09-30 15:37:13 +00:00
|
|
|
|
|
|
|
extern MSG_ENTRY empty_chain[];
|
2012-08-13 18:04:04 +00:00
|
|
|
extern MSG_CACHE default_cache;
|
|
|
|
|
|
|
|
void record_message(MSG_CACHE* cache, int iwnd, UINT message, MSG_TYPE type, int param1,int param2);
|
|
|
|
void compare_cache(MSG_CACHE* cache, const char* file, int line, MSG_ENTRY *msg_chain);
|
|
|
|
void trace_cache(MSG_CACHE* cache, const char* file, int line);
|
|
|
|
void empty_message_cache(MSG_CACHE* cache);
|
2011-09-30 15:37:13 +00:00
|
|
|
|
2011-09-23 12:05:40 +00:00
|
|
|
ATOM RegisterSimpleClass(WNDPROC lpfnWndProc, LPCWSTR lpszClassName);
|
|
|
|
|
2011-09-24 11:55:19 +00:00
|
|
|
/* filter messages that are affected by dwm */
|
2011-09-24 12:05:14 +00:00
|
|
|
static inline BOOL IsDWmMsg(UINT msg)
|
2011-09-24 11:55:19 +00:00
|
|
|
{
|
|
|
|
switch(msg)
|
|
|
|
{
|
|
|
|
case WM_NCPAINT:
|
|
|
|
case WM_ERASEBKGND:
|
|
|
|
case WM_PAINT:
|
|
|
|
case 0x031f: /*WM_DWMNCRENDERINGCHANGED*/
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2011-09-24 12:05:14 +00:00
|
|
|
static inline BOOL IseKeyMsg(UINT msg)
|
2011-09-24 11:55:19 +00:00
|
|
|
{
|
|
|
|
return (msg == WM_KEYUP || msg == WM_KEYDOWN);
|
|
|
|
}
|
|
|
|
|
2012-08-13 18:04:04 +00:00
|
|
|
#define COMPARE_CACHE(msg_chain) compare_cache(&default_cache, __FILE__, __LINE__, msg_chain)
|
|
|
|
#define TRACE_CACHE() trace_cache(&default_cache, __FILE__, __LINE__)
|
|
|
|
#define EMPTY_CACHE() empty_message_cache(&default_cache);
|
|
|
|
#define RECOND_MESSAGE(...) record_message(&default_cache, ##__VA_ARGS__);
|
2011-09-23 12:05:40 +00:00
|
|
|
|
2012-08-13 18:04:04 +00:00
|
|
|
#define COMPARE_CACHE_(cache, msg_chain) compare_cache(cache, __FILE__, __LINE__, msg_chain)
|
|
|
|
#define TRACE_CACHE_(cache) trace_cache(cache, __FILE__, __LINE__)
|
|
|
|
#define EMPTY_CACHE_(cache) empty_message_cache(cache);
|
2011-09-23 12:05:40 +00:00
|
|
|
|
|
|
|
#define EXPECT_QUEUE_STATUS(expected, notexpected) \
|
|
|
|
{ \
|
|
|
|
DWORD status = HIWORD(GetQueueStatus(QS_ALLEVENTS)); \
|
|
|
|
ok(((status) & (expected))== (expected),"wrong queue status. expected %li, and got %li\n", (DWORD)(expected), status); \
|
|
|
|
if(notexpected) \
|
|
|
|
ok((status & (notexpected))!=(notexpected), "wrong queue status. got non expected %li\n", (DWORD)(notexpected)); \
|
|
|
|
}
|