MCI_OPEN_DRIVER_PARMS - Add win32 version of structure.
[wine.git] / misc / spy.c
blob7acac97af1841af3abf86f6c9ec22736126233b4
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 #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 "WM_QUERYAFXWNDPROC", /* 0x0360 */
497 "WM_SIZEPARENT", /* 0x0361 */
498 "WM_SETMESSAGESTRING", /* 0x0362 */
499 "WM_IDLEUPDATECMDUI", /* 0x0363 */
500 "WM_INITIALUPDATE", /* 0x0364 */
501 "WM_COMMANDHELP", /* 0x0365 */
502 "WM_HELPHITTEST", /* 0x0366 */
503 "WM_EXITHELPMODE", /* 0x0367 */
504 "WM_RECALCPARENT", /* 0x0368 */
505 "WM_SIZECHILD", /* 0x0369 */
506 "WM_KICKIDLE", /* 0x036A */
507 "WM_QUERYCENTERWND", /* 0x036B */
508 "WM_DISABLEMODAL", /* 0x036C */
509 "WM_FLOATSTATUS", /* 0x036D */
510 "WM_ACTIVATETOPLEVEL", /* 0x036E */
511 "WM_QUERY3DCONTROLS", /* 0x036F */
512 NULL,NULL,NULL,
513 "WM_SOCKET_NOTIFY", /* 0x0373 */
514 "WM_SOCKET_DEAD", /* 0x0374 */
515 "WM_POPMESSAGESTRING", /* 0x0375 */
516 "WM_OCC_LOADFROMSTREAM", /* 0x0376 */
517 "WM_OCC_LOADFROMSTORAGE", /* 0x0377 */
518 "WM_OCC_INITNEW", /* 0x0378 */
519 "WM_QUEUE_SENTINEL", /* 0x0379 */
520 "WM_OCC_LOADFROMSTREAM_EX", /* 0x037A */
521 "WM_OCC_LOADFROMSTORAGE_EX", /* 0x037B */
523 NULL,NULL,NULL,NULL,
525 /* 0x0380 */
526 "WM_PENWINFIRST",
527 "WM_RCRESULT",
528 "WM_HOOKRCRESULT",
529 "WM_GLOBALRCCHANGE",
530 "WM_SKB",
531 "WM_HEDITCTL",
532 NULL, NULL,
533 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
535 "WM_COALESCE_FIRST",
536 NULL, NULL, NULL, NULL, NULL, NULL, NULL,
537 NULL, NULL, NULL, NULL, NULL, NULL, NULL,
538 "WM_COALESCE_LAST",
540 /* 0x03a0 */
541 "MM_JOY1MOVE",
542 "MM_JOY2MOVE",
543 "MM_JOY1ZMOVE",
544 "MM_JOY2ZMOVE",
545 NULL, NULL, NULL, NULL,
546 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
548 /* 0x03b0 */
549 NULL, NULL, NULL, NULL, NULL,
550 "MM_JOY1BUTTONDOWN",
551 "MM_JOY2BUTTONDOWN",
552 "MM_JOY1BUTTONUP",
553 "MM_JOY2BUTTONUP",
554 "MM_MCINOTIFY",
555 NULL,
556 "MM_WOM_OPEN",
557 "MM_WOM_CLOSE",
558 "MM_WOM_DONE",
559 "MM_WIM_OPEN",
560 "MM_WIM_CLOSE",
562 /* 0x03c0 */
563 "MM_WIM_DATA",
564 "MM_MIM_OPEN",
565 "MM_MIM_CLOSE",
566 "MM_MIM_DATA",
567 "MM_MIM_LONGDATA",
568 "MM_MIM_ERROR",
569 "MM_MIM_LONGERROR",
570 "MM_MOM_OPEN",
571 "MM_MOM_CLOSE",
572 "MM_MOM_DONE",
573 NULL, NULL, NULL, NULL, NULL, NULL,
574 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
575 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
577 /* 0x03e0 */
578 "WM_DDE_INITIATE", /* 0x3E0 */
579 "WM_DDE_TERMINATE", /* 0x3E1 */
580 "WM_DDE_ADVISE", /* 0x3E2 */
581 "WM_DDE_UNADVISE", /* 0x3E3 */
582 "WM_DDE_ACK", /* 0x3E4 */
583 "WM_DDE_DATA", /* 0x3E5 */
584 "WM_DDE_REQUEST", /* 0x3E6 */
585 "WM_DDE_POKE", /* 0x3E7 */
586 "WM_DDE_EXECUTE", /* 0x3E8 */
587 NULL, NULL, NULL, NULL, NULL, NULL, NULL,
590 /* 0x03f0 */
591 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
592 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
594 "WM_USER"
598 static BOOL16 SPY_Exclude[SPY_MAX_MSGNUM+1];
599 static BOOL16 SPY_ExcludeDWP = 0;
600 static int SPY_IndentLevel = 0;
602 #define SPY_EXCLUDE(msg) \
603 (SPY_Exclude[(msg) > SPY_MAX_MSGNUM ? SPY_MAX_MSGNUM : (msg)])
605 /***********************************************************************
606 * SPY_GetMsgName
608 const char *SPY_GetMsgName( UINT msg )
610 static char msg_buffer[20];
612 if (msg <= SPY_MAX_MSGNUM)
614 if (!MessageTypeNames[msg]) return "???";
615 return MessageTypeNames[msg];
617 sprintf( msg_buffer, "WM_USER+%04x", msg - WM_USER );
618 return msg_buffer;
621 /***********************************************************************
622 * SPY_GetWndName
624 const char *SPY_GetWndName( HWND hwnd )
626 static char wnd_buffer[16];
628 WND* pWnd = WIN_FindWndPtr( hwnd );
629 if( pWnd )
631 INT n = sizeof(wnd_buffer) - 6;
632 LPSTR p = wnd_buffer;
633 LPSTR src;
635 char postfix;
637 if( pWnd->text && pWnd->text[0] != '\0' )
639 src = pWnd->text;
640 *(p++) = postfix = '\"';
641 while ((n-- > 1) && *src) *p++ = *src++;
643 else /* get class name */
645 INT len;
647 *(p++)='{';
648 GlobalGetAtomNameA( pWnd->class->atomName, p, n + 1);
649 src = p += (len = lstrlenA(p));
650 if( len >= n ) src = wnd_buffer; /* something nonzero */
651 postfix = '}';
653 if( *src ) for( n = 0; n < 3; n++ ) *(p++)='.';
654 *(p++) = postfix;
655 *(p++) = '\0';
657 else lstrcpyA( wnd_buffer, "\"NULL\"" );
658 return wnd_buffer;
661 /***********************************************************************
662 * SPY_EnterMessage
664 void SPY_EnterMessage( INT iFlag, HWND hWnd, UINT msg,
665 WPARAM wParam, LPARAM lParam )
667 LPCSTR pname;
669 if (!TRACE_ON(message) || SPY_EXCLUDE(msg)) return;
671 /* each SPY_SENDMESSAGE must be complemented by call to SPY_ExitMessage */
672 switch(iFlag)
674 case SPY_DISPATCHMESSAGE16:
675 pname = SPY_GetWndName(hWnd);
676 TRACE(message,"%*s(%04x) %-16s message [%04x] %s dispatched wp=%04x lp=%08lx\n",
677 SPY_IndentLevel, "", hWnd, pname, msg, SPY_GetMsgName( msg ),
678 wParam, lParam);
679 break;
681 case SPY_DISPATCHMESSAGE:
682 pname = SPY_GetWndName(hWnd);
683 TRACE(message,"%*s(%08x) %-16s message [%04x] %s dispatched wp=%08x lp=%08lx\n",
684 SPY_IndentLevel, "", hWnd, pname, msg, SPY_GetMsgName( msg ),
685 wParam, lParam);
686 break;
688 case SPY_SENDMESSAGE16:
689 case SPY_SENDMESSAGE:
691 char taskName[30];
692 HTASK16 hTask = GetWindowTask16(hWnd);
694 if (hTask == GetCurrentTask()) strcpy( taskName, "self" );
695 else if (!hTask) strcpy( taskName, "Wine" );
696 else
698 sprintf( taskName, "task %04x ???", hTask );
699 GetModuleName16( hTask, taskName + 10, sizeof(taskName) - 10 );
701 pname = SPY_GetWndName(hWnd);
703 if (iFlag == SPY_SENDMESSAGE16)
704 TRACE(message, "%*s(%04x) %-16s message [%04x] %s sent from %s wp=%04x lp=%08lx\n",
705 SPY_IndentLevel, "", hWnd, pname, msg, SPY_GetMsgName( msg ),
706 taskName, wParam, lParam );
707 else
708 TRACE(message, "%*s(%08x) %-16s message [%04x] %s sent from %s wp=%08x lp=%08lx\n",
709 SPY_IndentLevel, "", hWnd, pname, msg, SPY_GetMsgName( msg ),
710 taskName, wParam, lParam );
712 break;
714 case SPY_DEFWNDPROC16:
715 if( SPY_ExcludeDWP ) return;
716 TRACE(message, "%*s(%04x) DefWindowProc16: %s [%04x] wp=%04x lp=%08lx\n",
717 SPY_IndentLevel, "", hWnd, SPY_GetMsgName( msg ),
718 msg, wParam, lParam );
719 break;
721 case SPY_DEFWNDPROC:
722 if( SPY_ExcludeDWP ) return;
723 TRACE(message, "%*s(%08x) DefWindowProc32: %s [%04x] wp=%08x lp=%08lx\n",
724 SPY_IndentLevel, "", hWnd, SPY_GetMsgName( msg ),
725 msg, wParam, lParam );
726 break;
728 SPY_IndentLevel += SPY_INDENT_UNIT;
732 /***********************************************************************
733 * SPY_ExitMessage
735 void SPY_ExitMessage( INT iFlag, HWND hWnd, UINT msg, LRESULT lReturn )
737 LPCSTR pname;
739 if (!TRACE_ON(message) || SPY_EXCLUDE(msg) ||
740 (SPY_ExcludeDWP && (iFlag == SPY_RESULT_DEFWND16 || iFlag == SPY_RESULT_DEFWND)) )
741 return;
743 if (SPY_IndentLevel) SPY_IndentLevel -= SPY_INDENT_UNIT;
745 switch(iFlag)
747 case SPY_RESULT_DEFWND16:
748 TRACE(message," %*s(%04x) DefWindowProc16: %s [%04x] returned %08lx\n",
749 SPY_IndentLevel, "", hWnd, SPY_GetMsgName( msg ), msg, lReturn );
750 break;
752 case SPY_RESULT_DEFWND:
753 TRACE(message," %*s(%08x) DefWindowProc32: %s [%04x] returned %08lx\n",
754 SPY_IndentLevel, "", hWnd, SPY_GetMsgName( msg ), msg, lReturn );
755 break;
757 case SPY_RESULT_OK16:
758 pname = SPY_GetWndName(hWnd);
759 TRACE(message," %*s(%04x) %-16s message [%04x] %s returned %08lx\n",
760 SPY_IndentLevel, "", hWnd, pname, msg,
761 SPY_GetMsgName( msg ), lReturn );
762 break;
764 case SPY_RESULT_OK:
765 pname = SPY_GetWndName(hWnd);
766 TRACE(message," %*s(%08x) %-16s message [%04x] %s returned %08lx\n",
767 SPY_IndentLevel, "", hWnd, pname, msg,
768 SPY_GetMsgName( msg ), lReturn );
769 break;
771 case SPY_RESULT_INVALIDHWND16:
772 pname = SPY_GetWndName(hWnd);
773 WARN(message, " %*s(%04x) %-16s message [%04x] %s HAS INVALID HWND\n",
774 SPY_IndentLevel, "", hWnd, pname, msg,
775 SPY_GetMsgName( msg ) );
776 break;
778 case SPY_RESULT_INVALIDHWND:
779 pname = SPY_GetWndName(hWnd);
780 WARN(message, " %*s(%08x) %-16s message [%04x] %s HAS INVALID HWND\n",
781 SPY_IndentLevel, "", hWnd, pname, msg,
782 SPY_GetMsgName( msg ) );
783 break;
788 /***********************************************************************
789 * SPY_Init
791 int SPY_Init(void)
793 int i;
794 char buffer[1024];
796 if (!TRACE_ON(message)) return TRUE;
798 PROFILE_GetWineIniString( "Spy", "Include", "", buffer, sizeof(buffer) );
799 if (buffer[0] && strcmp( buffer, "INCLUDEALL" ))
801 TRACE(message, "Include=%s\n", buffer );
802 for (i = 0; i <= SPY_MAX_MSGNUM; i++)
803 SPY_Exclude[i] = (MessageTypeNames[i] && !strstr(buffer,MessageTypeNames[i]));
806 PROFILE_GetWineIniString( "Spy", "Exclude", "", buffer, sizeof(buffer) );
807 if (buffer[0])
809 TRACE(message, "Exclude=%s\n", buffer );
810 if (!strcmp( buffer, "EXCLUDEALL" ))
811 for (i = 0; i <= SPY_MAX_MSGNUM; i++) SPY_Exclude[i] = TRUE;
812 else
813 for (i = 0; i <= SPY_MAX_MSGNUM; i++)
814 SPY_Exclude[i] = (MessageTypeNames[i] && strstr(buffer,MessageTypeNames[i]));
817 SPY_ExcludeDWP = PROFILE_GetWineIniInt( "Spy", "ExcludeDWP", 0 );
819 return 1;