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