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