Handle non-hardware X events correctly with native USER
[wine/multimedia.git] / misc / spy.c
blob39960039fd6f2cfccec3359c137e82cf0af86266
1 /*
2 * Message spying routines
4 * Copyright 1994, Bob Amstadt
5 * 1995, Alex Korobka
6 */
8 #include <stdlib.h>
9 #include <string.h>
10 #include "windows.h"
11 #include "win.h"
12 #include "module.h"
13 #include "options.h"
14 #include "debug.h"
15 #include "spy.h"
17 #define SPY_MAX_MSGNUM WM_USER
18 #define SPY_INDENT_UNIT 4 /* 4 spaces */
20 static const char * const MessageTypeNames[SPY_MAX_MSGNUM + 1] =
22 "wm_null", /* 0x00 */
23 "WM_CREATE",
24 "WM_DESTROY",
25 "WM_MOVE",
26 "wm_sizewait",
27 "WM_SIZE",
28 "WM_ACTIVATE",
29 "WM_SETFOCUS",
30 "WM_KILLFOCUS",
31 "WM_SETVISIBLE",
32 "WM_ENABLE",
33 "WM_SETREDRAW",
34 "WM_SETTEXT",
35 "WM_GETTEXT",
36 "WM_GETTEXTLENGTH",
37 "WM_PAINT",
38 "WM_CLOSE", /* 0x10 */
39 "WM_QUERYENDSESSION",
40 "WM_QUIT",
41 "WM_QUERYOPEN",
42 "WM_ERASEBKGND",
43 "WM_SYSCOLORCHANGE",
44 "WM_ENDSESSION",
45 "wm_systemerror",
46 "WM_SHOWWINDOW",
47 "WM_CTLCOLOR",
48 "WM_WININICHANGE",
49 "WM_DEVMODECHANGE",
50 "WM_ACTIVATEAPP",
51 "WM_FONTCHANGE",
52 "WM_TIMECHANGE",
53 "WM_CANCELMODE",
54 "WM_SETCURSOR", /* 0x20 */
55 "WM_MOUSEACTIVATE",
56 "WM_CHILDACTIVATE",
57 "WM_QUEUESYNC",
58 "WM_GETMINMAXINFO",
59 "wm_unused3",
60 "wm_painticon",
61 "WM_ICONERASEBKGND",
62 "WM_NEXTDLGCTL",
63 "wm_alttabactive",
64 "WM_SPOOLERSTATUS",
65 "WM_DRAWITEM",
66 "WM_MEASUREITEM",
67 "WM_DELETEITEM",
68 "WM_VKEYTOITEM",
69 "WM_CHARTOITEM",
70 "WM_SETFONT", /* 0x30 */
71 "WM_GETFONT",
72 "WM_SETHOTKEY",
73 "WM_GETHOTKEY",
74 "wm_filesyschange",
75 "wm_isactiveicon",
76 "wm_queryparkicon",
77 "WM_QUERYDRAGICON",
78 "wm_querysavestate",
79 "WM_COMPAREITEM",
80 "wm_testing",
81 NULL,
82 "wm_otherwindowcreated",
83 "wm_otherwindowdestroyed",
84 "wm_activateshellwindow",
85 NULL,
87 NULL, /* 0x40 */
88 "wm_compacting", NULL, NULL,
89 "WM_COMMNOTIFY", NULL,
90 "WM_WINDOWPOSCHANGING", /* 0x0046 */
91 "WM_WINDOWPOSCHANGED", /* 0x0047 */
92 "WM_POWER", NULL,
93 "WM_COPYDATA",
94 "WM_CANCELJOURNAL", NULL, NULL,
95 "WM_NOTIFY", NULL,
97 /* 0x0050 */
98 "WM_INPUTLANGCHANGEREQUEST",
99 "WM_INPUTLANGCHANGE",
100 "WM_TCARD",
101 "WM_HELP",
102 "WM_USERCHANGED",
103 "WM_NOTIFYFORMAT", NULL, NULL,
104 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
106 /* 0x0060 */
107 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
108 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
110 /* 0x0070 */
111 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
112 NULL, NULL, NULL,
113 "WM_CONTEXTMENU",
114 "WM_STYLECHANGING",
115 "WM_STYLECHANGED",
116 "WM_DISPLAYCHANGE",
117 "WM_GETICON",
119 "WM_SETICON", /* 0x0080 */
120 "WM_NCCREATE", /* 0x0081 */
121 "WM_NCDESTROY", /* 0x0082 */
122 "WM_NCCALCSIZE", /* 0x0083 */
123 "WM_NCHITTEST", /* 0x0084 */
124 "WM_NCPAINT", /* 0x0085 */
125 "WM_NCACTIVATE", /* 0x0086 */
126 "WM_GETDLGCODE", /* 0x0087 */
127 "wm_syncpaint",
128 "wm_synctask", NULL, NULL, NULL, NULL, NULL, NULL,
130 /* 0x0090 */
131 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
132 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
134 /* 0x00A0 */
135 "WM_NCMOUSEMOVE", /* 0x00A0 */
136 "WM_NCLBUTTONDOWN", /* 0x00A1 */
137 "WM_NCLBUTTONUP", /* 0x00A2 */
138 "WM_NCLBUTTONDBLCLK", /* 0x00A3 */
139 "WM_NCRBUTTONDOWN", /* 0x00A4 */
140 "WM_NCRBUTTONUP", /* 0x00A5 */
141 "WM_NCRBUTTONDBLCLK", /* 0x00A6 */
142 "WM_NCMBUTTONDOWN", /* 0x00A7 */
143 "WM_NCMBUTTONUP", /* 0x00A8 */
144 "WM_NCMBUTTONDBLCLK", /* 0x00A9 */
145 NULL, NULL, NULL, NULL, NULL, NULL,
147 /* 0x00B0 - Win32 Edit controls */
148 "EM_GETSEL32", /* 0x00b0 */
149 "EM_SETSEL32", /* 0x00b1 */
150 "EM_GETRECT32", /* 0x00b2 */
151 "EM_SETRECT32", /* 0x00b3 */
152 "EM_SETRECTNP32", /* 0x00b4 */
153 "EM_SCROLL32", /* 0x00b5 */
154 "EM_LINESCROLL32", /* 0x00b6 */
155 "EM_SCROLLCARET32", /* 0x00b7 */
156 "EM_GETMODIFY32", /* 0x00b8 */
157 "EM_SETMODIFY32", /* 0x00b9 */
158 "EM_GETLINECOUNT32", /* 0x00ba */
159 "EM_LINEINDEX32", /* 0x00bb */
160 "EM_SETHANDLE32", /* 0x00bc */
161 "EM_GETHANDLE32", /* 0x00bd */
162 "EM_GETTHUMB32", /* 0x00be */
163 NULL, /* 0x00bf */
165 NULL, /* 0x00c0 */
166 "EM_LINELENGTH32", /* 0x00c1 */
167 "EM_REPLACESEL32", /* 0x00c2 */
168 NULL, /* 0x00c3 */
169 "EM_GETLINE32", /* 0x00c4 */
170 "EM_LIMITTEXT32", /* 0x00c5 */
171 "EM_CANUNDO32", /* 0x00c6 */
172 "EM_UNDO32", /* 0x00c7 */
173 "EM_FMTLINES32", /* 0x00c8 */
174 "EM_LINEFROMCHAR32", /* 0x00c9 */
175 NULL, /* 0x00ca */
176 "EM_SETTABSTOPS32", /* 0x00cb */
177 "EM_SETPASSWORDCHAR32", /* 0x00cc */
178 "EM_EMPTYUNDOBUFFER32", /* 0x00cd */
179 "EM_GETFIRSTVISIBLELINE32", /* 0x00ce */
180 "EM_SETREADONLY32", /* 0x00cf */
182 "EM_SETWORDBREAKPROC32", /* 0x00d0 */
183 "EM_GETWORDBREAKPROC32", /* 0x00d1 */
184 "EM_GETPASSWORDCHAR32", /* 0x00d2 */
185 "EM_SETMARGINS32", /* 0x00d3 */
186 "EM_GETMARGINS32", /* 0x00d4 */
187 "EM_GETLIMITTEXT32", /* 0x00d5 */
188 "EM_POSFROMCHAR32", /* 0x00d6 */
189 "EM_CHARFROMPOS32", /* 0x00d7 */
190 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
192 /* 0x00E0 - Win32 Scrollbars */
193 "SBM_SETPOS32", /* 0x00e0 */
194 "SBM_GETPOS32", /* 0x00e1 */
195 "SBM_SETRANGE32", /* 0x00e2 */
196 "SBM_GETRANGE32", /* 0x00e3 */
197 "SBM_ENABLE_ARROWS32", /* 0x00e4 */
198 NULL,
199 "SBM_SETRANGEREDRAW32", /* 0x00e6 */
200 NULL, NULL,
201 "SBM_SETSCROLLINFO32", /* 0x00e9 */
202 "SBM_GETSCROLLINFO32", /* 0x00ea */
203 NULL, NULL, NULL, NULL, NULL,
205 /* 0x00F0 - Win32 Buttons */
206 "BM_GETCHECK32", /* 0x00f0 */
207 "BM_SETCHECK32", /* 0x00f1 */
208 "BM_GETSTATE32", /* 0x00f2 */
209 "BM_SETSTATE32", /* 0x00f3 */
210 "BM_SETSTYLE32", /* 0x00f4 */
211 "BM_CLICK32", /* 0x00f5 */
212 "BM_GETIMAGE32", /* 0x00f6 */
213 "BM_SETIMAGE32", /* 0x00f7 */
214 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
216 "WM_KEYDOWN", /* 0x0100 */
217 "WM_KEYUP", /* 0x0101 */
218 "WM_CHAR", /* 0x0102 */
219 "WM_DEADCHAR", /* 0x0103 */
220 "WM_SYSKEYDOWN", /* 0x0104 */
221 "WM_SYSKEYUP", /* 0x0105 */
222 "WM_SYSCHAR", /* 0x0106 */
223 "WM_SYSDEADCHAR", /* 0x0107 */
224 "WM_KEYLAST", /* 0x0108 */
225 NULL,
226 "WM_CONVERTREQUEST",
227 "WM_CONVERTRESULT",
228 "WM_INTERIM", NULL, NULL, NULL,
230 "WM_INITDIALOG", /* 0x0110 */
231 "WM_COMMAND", /* 0x0111 */
232 "WM_SYSCOMMAND", /* 0x0112 */
233 "WM_TIMER", /* 0x0113 */
234 "WM_HSCROLL", /* 0x0114 */
235 "WM_VSCROLL", /* 0x0115 */
236 "WM_INITMENU", /* 0x0116 */
237 "WM_INITMENUPOPUP", /* 0x0117 */
238 "WM_SYSTIMER", /* 0x0118 */
239 NULL, NULL, NULL, NULL, NULL, NULL,
240 "WM_MENUSELECT", /* 0x011f */
242 "WM_MENUCHAR", /* 0x0120 */
243 "WM_ENTERIDLE", /* 0x0121 */
244 NULL, NULL, NULL, NULL, NULL, NULL,
245 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
247 /* 0x0130 */
248 NULL,
249 "wm_lbtrackpoint", /* 0x0131 */
250 "WM_CTLCOLORMSGBOX", /* 0x0132 */
251 "WM_CTLCOLOREDIT", /* 0x0133 */
252 "WM_CTLCOLORLISTBOX", /* 0x0134 */
253 "WM_CTLCOLORBTN", /* 0x0135 */
254 "WM_CTLCOLORDLG", /* 0x0136 */
255 "WM_CTLCOLORSCROLLBAR", /* 0x0137 */
256 "WM_CTLCOLORSTATIC", /* 0x0138 */
257 NULL, NULL, NULL, NULL, NULL, NULL, NULL,
259 /* 0x0140 - Win32 Comboboxes */
260 "CB_GETEDITSEL32", /* 0x0140 */
261 "CB_LIMITTEXT32", /* 0x0141 */
262 "CB_SETEDITSEL32", /* 0x0142 */
263 "CB_ADDSTRING32", /* 0x0143 */
264 "CB_DELETESTRING32", /* 0x0144 */
265 "CB_DIR32", /* 0x0145 */
266 "CB_GETCOUNT32", /* 0x0146 */
267 "CB_GETCURSEL32", /* 0x0147 */
268 "CB_GETLBTEXT32", /* 0x0148 */
269 "CB_GETLBTEXTLEN32", /* 0x0149 */
270 "CB_INSERTSTRING32", /* 0x014a */
271 "CB_RESETCONTENT32", /* 0x014b */
272 "CB_FINDSTRING32", /* 0x014c */
273 "CB_SELECTSTRING32", /* 0x014d */
274 "CB_SETCURSEL32", /* 0x014e */
275 "CB_SHOWDROPDOWN32", /* 0x014f */
277 "CB_GETITEMDATA32", /* 0x0150 */
278 "CB_SETITEMDATA32", /* 0x0151 */
279 "CB_GETDROPPEDCONTROLRECT32",/* 0x0152 */
280 "CB_SETITEMHEIGHT32", /* 0x0153 */
281 "CB_GETITEMHEIGHT32", /* 0x0154 */
282 "CB_SETEXTENDEDUI32", /* 0x0155 */
283 "CB_GETEXTENDEDUI32", /* 0x0156 */
284 "CB_GETDROPPEDSTATE32", /* 0x0157 */
285 "CB_FINDSTRINGEXACT32", /* 0x0158 */
286 "CB_SETLOCALE32", /* 0x0159 */
287 "CB_GETLOCALE32", /* 0x015a */
288 "CB_GETTOPINDEX32", /* 0x015b */
289 "CB_SETTOPINDEX32", /* 0x015c */
290 "CB_GETHORIZONTALEXTENT32", /* 0x015d */
291 "CB_SETHORIZONTALEXTENT32", /* 0x015e */
292 "CB_GETDROPPEDWIDTH32", /* 0x015f */
294 "CB_SETDROPPEDWIDTH32", /* 0x0160 */
295 "CB_INITSTORAGE32", /* 0x0161 */
296 NULL, NULL, NULL, NULL, NULL, NULL,
297 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
299 /* 0x0170 - Win32 Static controls */
300 "STM_SETICON32", /* 0x0170 */
301 "STM_GETICON32", /* 0x0171 */
302 "STM_SETIMAGE32", /* 0x0172 */
303 "STM_GETIMAGE32", /* 0x0173 */
304 NULL, NULL, NULL, NULL,
305 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
307 /* 0x0180 - Win32 Listboxes */
308 "LB_ADDSTRING32", /* 0x0180 */
309 "LB_INSERTSTRING32", /* 0x0181 */
310 "LB_DELETESTRING32", /* 0x0182 */
311 "LB_SELITEMRANGEEX32", /* 0x0183 */
312 "LB_RESETCONTENT32", /* 0x0184 */
313 "LB_SETSEL32", /* 0x0185 */
314 "LB_SETCURSEL32", /* 0x0186 */
315 "LB_GETSEL32", /* 0x0187 */
316 "LB_GETCURSEL32", /* 0x0188 */
317 "LB_GETTEXT32", /* 0x0189 */
318 "LB_GETTEXTLEN32", /* 0x018a */
319 "LB_GETCOUNT32", /* 0x018b */
320 "LB_SELECTSTRING32", /* 0x018c */
321 "LB_DIR32", /* 0x018d */
322 "LB_GETTOPINDEX32", /* 0x018e */
323 "LB_FINDSTRING32", /* 0x018f */
325 "LB_GETSELCOUNT32", /* 0x0190 */
326 "LB_GETSELITEMS32", /* 0x0191 */
327 "LB_SETTABSTOPS32", /* 0x0192 */
328 "LB_GETHORIZONTALEXTENT32", /* 0x0193 */
329 "LB_SETHORIZONTALEXTENT32", /* 0x0194 */
330 "LB_SETCOLUMNWIDTH32", /* 0x0195 */
331 "LB_ADDFILE32", /* 0x0196 */
332 "LB_SETTOPINDEX32", /* 0x0197 */
333 "LB_GETITEMRECT32", /* 0x0198 */
334 "LB_GETITEMDATA32", /* 0x0199 */
335 "LB_SETITEMDATA32", /* 0x019a */
336 "LB_SELITEMRANGE32", /* 0x019b */
337 "LB_SETANCHORINDEX32", /* 0x019c */
338 "LB_GETANCHORINDEX32", /* 0x019d */
339 "LB_SETCARETINDEX32", /* 0x019e */
340 "LB_GETCARETINDEX32", /* 0x019f */
342 "LB_SETITEMHEIGHT32", /* 0x01a0 */
343 "LB_GETITEMHEIGHT32", /* 0x01a1 */
344 "LB_FINDSTRINGEXACT32", /* 0x01a2 */
345 "LB_CARETON32", /* 0x01a3 */
346 "LB_CARETOFF32", /* 0x01a4 */
347 "LB_SETLOCALE32", /* 0x01a5 */
348 "LB_GETLOCALE32", /* 0x01a6 */
349 "LB_SETCOUNT32", /* 0x01a7 */
350 "LB_INITSTORAGE32", /* 0x01a8 */
351 "LB_ITEMFROMPOINT32", /* 0x01a9 */
352 NULL, NULL, NULL, NULL, NULL, NULL,
354 /* 0x01B0 */
355 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
356 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
358 /* 0x01C0 */
359 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
360 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
362 /* 0x01D0 */
363 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
364 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
366 /* 0x01E0 */
367 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
368 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
370 /* 0x01F0 */
371 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
372 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
374 "WM_MOUSEMOVE", /* 0x0200 */
375 "WM_LBUTTONDOWN", /* 0x0201 */
376 "WM_LBUTTONUP", /* 0x0202 */
377 "WM_LBUTTONDBLCLK", /* 0x0203 */
378 "WM_RBUTTONDOWN", /* 0x0204 */
379 "WM_RBUTTONUP", /* 0x0205 */
380 "WM_RBUTTONDBLCLK", /* 0x0206 */
381 "WM_MBUTTONDOWN", /* 0x0207 */
382 "WM_MBUTTONUP", /* 0x0208 */
383 "WM_MBUTTONDBLCLK", /* 0x0209 */
384 NULL, NULL, NULL, NULL, NULL, NULL,
386 "WM_PARENTNOTIFY", /* 0x0210 */
387 "WM_ENTERMENULOOP", /* 0x0211 */
388 "WM_EXITMENULOOP", /* 0x0212 */
389 "wm_nextmenu", /* 0x0213 */
390 "WM_SIZING",
391 "WM_CAPTURECHANGED",
392 "WM_MOVING", NULL,
393 "WM_POWERBROADCAST",
394 "WM_DEVICECHANGE", NULL, NULL, NULL, NULL, NULL, NULL,
396 "WM_MDICREATE", /* 0x0220 */
397 "WM_MDIDESTROY", /* 0x0221 */
398 "WM_MDIACTIVATE", /* 0x0222 */
399 "WM_MDIRESTORE", /* 0x0223 */
400 "WM_MDINEXT", /* 0x0224 */
401 "WM_MDIMAXIMIZE", /* 0x0225 */
402 "WM_MDITILE", /* 0x0226 */
403 "WM_MDICASCADE", /* 0x0227 */
404 "WM_MDIICONARRANGE", /* 0x0228 */
405 "WM_MDIGETACTIVE", /* 0x0229 */
407 "wm_dropobject",
408 "wm_querydropobject",
409 "wm_begindrag",
410 "wm_dragloop",
411 "wn_dragselect",
412 "wm_dragmove",
414 /* 0x0230*/
415 "WM_MDISETMENU", /* 0x0230 */
416 "WM_ENTERSIZEMOVE", /* 0x0231 */
417 "WM_EXITSIZEMOVE", /* 0x0232 */
418 "WM_DROPFILES", /* 0x0233 */
419 "WM_MDIREFRESHMENU", NULL, NULL, NULL,
420 /* 0x0238*/
421 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
423 /* 0x0240 */
424 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
425 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
427 /* 0x0250 */
428 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
429 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
431 /* 0x0260 */
432 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
433 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
434 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
435 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
437 /* 0x0280 */
438 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
439 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
440 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
441 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
443 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
444 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
445 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
446 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
448 /* 0x02c0 */
449 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
450 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
451 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
452 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
454 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
455 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
456 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
457 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
459 "WM_CUT", /* 0x0300 */
460 "WM_COPY",
461 "WM_PASTE",
462 "WM_CLEAR",
463 "WM_UNDO",
464 "WM_RENDERFORMAT",
465 "WM_RENDERALLFORMATS",
466 "WM_DESTROYCLIPBOARD",
467 "WM_DRAWCLIPBOARD",
468 "WM_PAINTCLIPBOARD",
469 "WM_VSCROLLCLIPBOARD",
470 "WM_SIZECLIPBOARD",
471 "WM_ASKCBFORMATNAME",
472 "WM_CHANGECBCHAIN",
473 "WM_HSCROLLCLIPBOARD",
474 "WM_QUERYNEWPALETTE", /* 0x030f*/
476 "WM_PALETTEISCHANGING",
477 "WM_PALETTECHANGED",
478 "WM_HOTKEY", /* 0x0312 */
479 NULL, NULL, NULL, NULL,
480 "WM_PRINT",
481 "WM_PRINTCLIENT",
482 NULL, NULL, NULL, NULL, NULL, NULL, NULL,
484 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
485 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
486 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
487 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
489 /* 0x0340 */
490 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
491 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
492 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
493 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
495 "WM_QUERYAFXWNDPROC", /* 0x0360 */
496 "WM_SIZEPARENT", /* 0x0361 */
497 "WM_SETMESSAGESTRING", /* 0x0362 */
498 "WM_IDLEUPDATECMDUI", /* 0x0363 */
499 "WM_INITIALUPDATE", /* 0x0364 */
500 "WM_COMMANDHELP", /* 0x0365 */
501 "WM_HELPHITTEST", /* 0x0366 */
502 "WM_EXITHELPMODE", /* 0x0367 */
503 "WM_RECALCPARENT", /* 0x0368 */
504 "WM_SIZECHILD", /* 0x0369 */
505 "WM_KICKIDLE", /* 0x036A */
506 "WM_QUERYCENTERWND", /* 0x036B */
507 "WM_DISABLEMODAL", /* 0x036C */
508 "WM_FLOATSTATUS", /* 0x036D */
509 "WM_ACTIVATETOPLEVEL", /* 0x036E */
510 "WM_QUERY3DCONTROLS", /* 0x036F */
511 NULL,NULL,NULL,
512 "WM_SOCKET_NOTIFY", /* 0x0373 */
513 "WM_SOCKET_DEAD", /* 0x0374 */
514 "WM_POPMESSAGESTRING", /* 0x0375 */
515 "WM_OCC_LOADFROMSTREAM", /* 0x0376 */
516 "WM_OCC_LOADFROMSTORAGE", /* 0x0377 */
517 "WM_OCC_INITNEW", /* 0x0378 */
518 "WM_QUEUE_SENTINEL", /* 0x0379 */
519 "WM_OCC_LOADFROMSTREAM_EX", /* 0x037A */
520 "WM_OCC_LOADFROMSTORAGE_EX", /* 0x037B */
522 NULL,NULL,NULL,NULL,
524 /* 0x0380 */
525 "WM_PENWINFIRST",
526 "WM_RCRESULT",
527 "WM_HOOKRCRESULT",
528 "WM_GLOBALRCCHANGE",
529 "WM_SKB",
530 "WM_HEDITCTL",
531 NULL, NULL,
532 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
534 "WM_COALESCE_FIRST",
535 NULL, NULL, NULL, NULL, NULL, NULL, NULL,
536 NULL, NULL, NULL, NULL, NULL, NULL, NULL,
537 "WM_COALESCE_LAST",
539 /* 0x03a0 */
540 "MM_JOY1MOVE",
541 "MM_JOY2MOVE",
542 "MM_JOY1ZMOVE",
543 "MM_JOY2ZMOVE",
544 NULL, NULL, NULL, NULL,
545 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
547 /* 0x03b0 */
548 NULL, NULL, NULL, NULL, NULL,
549 "MM_JOY1BUTTONDOWN",
550 "MM_JOY2BUTTONDOWN",
551 "MM_JOY1BUTTONUP",
552 "MM_JOY2BUTTONUP",
553 "MM_MCINOTIFY",
554 NULL,
555 "MM_WOM_OPEN",
556 "MM_WOM_CLOSE",
557 "MM_WOM_DONE",
558 "MM_WIM_OPEN",
559 "MM_WIM_CLOSE",
561 /* 0x03c0 */
562 "MM_WIM_DATA",
563 "MM_MIM_OPEN",
564 "MM_MIM_CLOSE",
565 "MM_MIM_DATA",
566 "MM_MIM_LONGDATA",
567 "MM_MIM_ERROR",
568 "MM_MIM_LONGERROR",
569 "MM_MOM_OPEN",
570 "MM_MOM_CLOSE",
571 "MM_MOM_DONE",
572 NULL, NULL, NULL, NULL, NULL, NULL,
573 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
574 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
576 /* 0x03e0 */
577 "WM_DDE_INITIATE", /* 0x3E0 */
578 "WM_DDE_TERMINATE", /* 0x3E1 */
579 "WM_DDE_ADVISE", /* 0x3E2 */
580 "WM_DDE_UNADVISE", /* 0x3E3 */
581 "WM_DDE_ACK", /* 0x3E4 */
582 "WM_DDE_DATA", /* 0x3E5 */
583 "WM_DDE_REQUEST", /* 0x3E6 */
584 "WM_DDE_POKE", /* 0x3E7 */
585 "WM_DDE_EXECUTE", /* 0x3E8 */
586 NULL, NULL, NULL, NULL, NULL, NULL, NULL,
589 /* 0x03f0 */
590 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
591 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
593 "WM_USER"
597 static BOOL16 SPY_Exclude[SPY_MAX_MSGNUM+1];
598 static BOOL16 SPY_ExcludeDWP = 0;
599 static int SPY_IndentLevel = 0;
601 #define SPY_EXCLUDE(msg) \
602 (SPY_Exclude[(msg) > SPY_MAX_MSGNUM ? SPY_MAX_MSGNUM : (msg)])
604 /***********************************************************************
605 * SPY_GetMsgName
607 const char *SPY_GetMsgName( UINT32 msg )
609 static char msg_buffer[20];
611 if (msg <= SPY_MAX_MSGNUM)
613 if (!MessageTypeNames[msg]) return "???";
614 return MessageTypeNames[msg];
616 sprintf( msg_buffer, "WM_USER+%04x", msg - WM_USER );
617 return msg_buffer;
620 /***********************************************************************
621 * SPY_GetWndName
623 const char *SPY_GetWndName( HWND32 hwnd )
625 static char wnd_buffer[16];
627 WND* pWnd = WIN_FindWndPtr( hwnd );
628 if( pWnd )
630 INT32 n = sizeof(wnd_buffer) - 6;
631 LPSTR p = wnd_buffer;
632 LPSTR src;
634 char postfix;
636 if( pWnd->text && pWnd->text[0] != '\0' )
638 src = pWnd->text;
639 *(p++) = postfix = '\"';
640 while ((n-- > 1) && *src) *p++ = *src++;
642 else /* get class name */
644 INT32 len;
646 *(p++)='{';
647 GlobalGetAtomName32A( pWnd->class->atomName, p, n + 1);
648 src = p += (len = lstrlen32A(p));
649 if( len >= n ) src = wnd_buffer; /* something nonzero */
650 postfix = '}';
652 if( *src ) for( n = 0; n < 3; n++ ) *(p++)='.';
653 *(p++) = postfix;
654 *(p++) = '\0';
656 else lstrcpy32A( wnd_buffer, "\"NULL\"" );
657 return wnd_buffer;
660 /***********************************************************************
661 * SPY_EnterMessage
663 void SPY_EnterMessage( INT32 iFlag, HWND32 hWnd, UINT32 msg,
664 WPARAM32 wParam, LPARAM lParam )
666 LPCSTR pname;
668 if (!TRACE_ON(message) || SPY_EXCLUDE(msg)) return;
670 /* each SPY_SENDMESSAGE must be complemented by call to SPY_ExitMessage */
671 switch(iFlag)
673 case SPY_DISPATCHMESSAGE16:
674 pname = SPY_GetWndName(hWnd);
675 TRACE(message,"%*s(%04x) %-16s message [%04x] %s dispatched wp=%04x lp=%08lx\n",
676 SPY_IndentLevel, "", hWnd, pname, msg, SPY_GetMsgName( msg ),
677 wParam, lParam);
678 break;
680 case SPY_DISPATCHMESSAGE32:
681 pname = SPY_GetWndName(hWnd);
682 TRACE(message,"%*s(%08x) %-16s message [%04x] %s dispatched wp=%08x lp=%08lx\n",
683 SPY_IndentLevel, "", hWnd, pname, msg, SPY_GetMsgName( msg ),
684 wParam, lParam);
685 break;
687 case SPY_SENDMESSAGE16:
688 case SPY_SENDMESSAGE32:
690 char taskName[30];
691 HTASK16 hTask = GetWindowTask16(hWnd);
693 if (hTask == GetCurrentTask()) strcpy( taskName, "self" );
694 else if (!hTask) strcpy( taskName, "Wine" );
695 else
697 sprintf( taskName, "task %04x ???", hTask );
698 GetModuleName( hTask, taskName + 10, sizeof(taskName) - 10 );
700 pname = SPY_GetWndName(hWnd);
702 if (iFlag == SPY_SENDMESSAGE16)
703 TRACE(message, "%*s(%04x) %-16s message [%04x] %s sent from %s wp=%04x lp=%08lx\n",
704 SPY_IndentLevel, "", hWnd, pname, msg, SPY_GetMsgName( msg ),
705 taskName, wParam, lParam );
706 else
707 TRACE(message, "%*s(%08x) %-16s message [%04x] %s sent from %s wp=%08x lp=%08lx\n",
708 SPY_IndentLevel, "", hWnd, pname, msg, SPY_GetMsgName( msg ),
709 taskName, wParam, lParam );
711 break;
713 case SPY_DEFWNDPROC16:
714 if( SPY_ExcludeDWP ) return;
715 TRACE(message, "%*s(%04x) DefWindowProc16: %s [%04x] wp=%04x lp=%08lx\n",
716 SPY_IndentLevel, "", hWnd, SPY_GetMsgName( msg ),
717 msg, wParam, lParam );
718 break;
720 case SPY_DEFWNDPROC32:
721 if( SPY_ExcludeDWP ) return;
722 TRACE(message, "%*s(%08x) DefWindowProc32: %s [%04x] wp=%08x lp=%08lx\n",
723 SPY_IndentLevel, "", hWnd, SPY_GetMsgName( msg ),
724 msg, wParam, lParam );
725 break;
727 SPY_IndentLevel += SPY_INDENT_UNIT;
731 /***********************************************************************
732 * SPY_ExitMessage
734 void SPY_ExitMessage( INT32 iFlag, HWND32 hWnd, UINT32 msg, LRESULT lReturn )
736 LPCSTR pname;
738 if (!TRACE_ON(message) || SPY_EXCLUDE(msg) ||
739 (SPY_ExcludeDWP && (iFlag == SPY_RESULT_DEFWND16 || iFlag == SPY_RESULT_DEFWND32)) )
740 return;
742 if (SPY_IndentLevel) SPY_IndentLevel -= SPY_INDENT_UNIT;
744 switch(iFlag)
746 case SPY_RESULT_DEFWND16:
747 TRACE(message," %*s(%04x) DefWindowProc16: %s [%04x] returned %08lx\n",
748 SPY_IndentLevel, "", hWnd, SPY_GetMsgName( msg ), msg, lReturn );
749 break;
751 case SPY_RESULT_DEFWND32:
752 TRACE(message," %*s(%08x) DefWindowProc32: %s [%04x] returned %08lx\n",
753 SPY_IndentLevel, "", hWnd, SPY_GetMsgName( msg ), msg, lReturn );
754 break;
756 case SPY_RESULT_OK16:
757 pname = SPY_GetWndName(hWnd);
758 TRACE(message," %*s(%04x) %-16s message [%04x] %s returned %08lx\n",
759 SPY_IndentLevel, "", hWnd, pname, msg,
760 SPY_GetMsgName( msg ), lReturn );
761 break;
763 case SPY_RESULT_OK32:
764 pname = SPY_GetWndName(hWnd);
765 TRACE(message," %*s(%08x) %-16s message [%04x] %s returned %08lx\n",
766 SPY_IndentLevel, "", hWnd, pname, msg,
767 SPY_GetMsgName( msg ), lReturn );
768 break;
770 case SPY_RESULT_INVALIDHWND16:
771 pname = SPY_GetWndName(hWnd);
772 WARN(message, " %*s(%04x) %-16s message [%04x] %s HAS INVALID HWND\n",
773 SPY_IndentLevel, "", hWnd, pname, msg,
774 SPY_GetMsgName( msg ) );
775 break;
777 case SPY_RESULT_INVALIDHWND32:
778 pname = SPY_GetWndName(hWnd);
779 WARN(message, " %*s(%08x) %-16s message [%04x] %s HAS INVALID HWND\n",
780 SPY_IndentLevel, "", hWnd, pname, msg,
781 SPY_GetMsgName( msg ) );
782 break;
787 /***********************************************************************
788 * SPY_Init
790 int SPY_Init(void)
792 int i;
793 char buffer[1024];
795 if (!TRACE_ON(message)) return TRUE;
797 PROFILE_GetWineIniString( "Spy", "Include", "", buffer, sizeof(buffer) );
798 if (buffer[0] && strcmp( buffer, "INCLUDEALL" ))
800 TRACE(message, "Include=%s\n", buffer );
801 for (i = 0; i <= SPY_MAX_MSGNUM; i++)
802 SPY_Exclude[i] = (MessageTypeNames[i] && !strstr(buffer,MessageTypeNames[i]));
805 PROFILE_GetWineIniString( "Spy", "Exclude", "", buffer, sizeof(buffer) );
806 if (buffer[0])
808 TRACE(message, "Exclude=%s\n", buffer );
809 if (!strcmp( buffer, "EXCLUDEALL" ))
810 for (i = 0; i <= SPY_MAX_MSGNUM; i++) SPY_Exclude[i] = TRUE;
811 else
812 for (i = 0; i <= SPY_MAX_MSGNUM; i++)
813 SPY_Exclude[i] = (MessageTypeNames[i] && strstr(buffer,MessageTypeNames[i]));
816 SPY_ExcludeDWP = PROFILE_GetWineIniInt( "Spy", "ExcludeDWP", 0 );
818 return 1;