Modified lstrcpynWtoA to put terminating null at end of string, not
[wine/multimedia.git] / misc / spy.c
blob0033ece5e0fc7ac93035fdfc6edf75b9f14ed958
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 "debugtools.h"
16 #include "spy.h"
17 #include "commctrl.h"
19 DEFAULT_DEBUG_CHANNEL(message)
21 #define SPY_MAX_MSGNUM WM_USER
22 #define SPY_INDENT_UNIT 4 /* 4 spaces */
24 static const char * const MessageTypeNames[SPY_MAX_MSGNUM + 1] =
26 "wm_null", /* 0x00 */
27 "WM_CREATE",
28 "WM_DESTROY",
29 "WM_MOVE",
30 "wm_sizewait",
31 "WM_SIZE",
32 "WM_ACTIVATE",
33 "WM_SETFOCUS",
34 "WM_KILLFOCUS",
35 "WM_SETVISIBLE",
36 "WM_ENABLE",
37 "WM_SETREDRAW",
38 "WM_SETTEXT",
39 "WM_GETTEXT",
40 "WM_GETTEXTLENGTH",
41 "WM_PAINT",
42 "WM_CLOSE", /* 0x10 */
43 "WM_QUERYENDSESSION",
44 "WM_QUIT",
45 "WM_QUERYOPEN",
46 "WM_ERASEBKGND",
47 "WM_SYSCOLORCHANGE",
48 "WM_ENDSESSION",
49 "wm_systemerror",
50 "WM_SHOWWINDOW",
51 "WM_CTLCOLOR",
52 "WM_WININICHANGE",
53 "WM_DEVMODECHANGE",
54 "WM_ACTIVATEAPP",
55 "WM_FONTCHANGE",
56 "WM_TIMECHANGE",
57 "WM_CANCELMODE",
58 "WM_SETCURSOR", /* 0x20 */
59 "WM_MOUSEACTIVATE",
60 "WM_CHILDACTIVATE",
61 "WM_QUEUESYNC",
62 "WM_GETMINMAXINFO",
63 "wm_unused3",
64 "wm_painticon",
65 "WM_ICONERASEBKGND",
66 "WM_NEXTDLGCTL",
67 "wm_alttabactive",
68 "WM_SPOOLERSTATUS",
69 "WM_DRAWITEM",
70 "WM_MEASUREITEM",
71 "WM_DELETEITEM",
72 "WM_VKEYTOITEM",
73 "WM_CHARTOITEM",
74 "WM_SETFONT", /* 0x30 */
75 "WM_GETFONT",
76 "WM_SETHOTKEY",
77 "WM_GETHOTKEY",
78 "wm_filesyschange",
79 "wm_isactiveicon",
80 "wm_queryparkicon",
81 "WM_QUERYDRAGICON",
82 "wm_querysavestate",
83 "WM_COMPAREITEM",
84 "wm_testing",
85 NULL,
86 "wm_otherwindowcreated",
87 "wm_otherwindowdestroyed",
88 "wm_activateshellwindow",
89 NULL,
91 NULL, /* 0x40 */
92 "wm_compacting", NULL, NULL,
93 "WM_COMMNOTIFY", NULL,
94 "WM_WINDOWPOSCHANGING", /* 0x0046 */
95 "WM_WINDOWPOSCHANGED", /* 0x0047 */
96 "WM_POWER", NULL,
97 "WM_COPYDATA",
98 "WM_CANCELJOURNAL", NULL, NULL,
99 "WM_NOTIFY", NULL,
101 /* 0x0050 */
102 "WM_INPUTLANGCHANGEREQUEST",
103 "WM_INPUTLANGCHANGE",
104 "WM_TCARD",
105 "WM_HELP",
106 "WM_USERCHANGED",
107 "WM_NOTIFYFORMAT", NULL, NULL,
108 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
110 /* 0x0060 */
111 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
112 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
114 /* 0x0070 */
115 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
116 NULL, NULL, NULL,
117 "WM_CONTEXTMENU",
118 "WM_STYLECHANGING",
119 "WM_STYLECHANGED",
120 "WM_DISPLAYCHANGE",
121 "WM_GETICON",
123 "WM_SETICON", /* 0x0080 */
124 "WM_NCCREATE", /* 0x0081 */
125 "WM_NCDESTROY", /* 0x0082 */
126 "WM_NCCALCSIZE", /* 0x0083 */
127 "WM_NCHITTEST", /* 0x0084 */
128 "WM_NCPAINT", /* 0x0085 */
129 "WM_NCACTIVATE", /* 0x0086 */
130 "WM_GETDLGCODE", /* 0x0087 */
131 "WM_SYNCPAINT",
132 "WM_SYNCTASK", NULL, NULL, NULL, NULL, NULL, NULL,
134 /* 0x0090 */
135 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
136 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
138 /* 0x00A0 */
139 "WM_NCMOUSEMOVE", /* 0x00A0 */
140 "WM_NCLBUTTONDOWN", /* 0x00A1 */
141 "WM_NCLBUTTONUP", /* 0x00A2 */
142 "WM_NCLBUTTONDBLCLK", /* 0x00A3 */
143 "WM_NCRBUTTONDOWN", /* 0x00A4 */
144 "WM_NCRBUTTONUP", /* 0x00A5 */
145 "WM_NCRBUTTONDBLCLK", /* 0x00A6 */
146 "WM_NCMBUTTONDOWN", /* 0x00A7 */
147 "WM_NCMBUTTONUP", /* 0x00A8 */
148 "WM_NCMBUTTONDBLCLK", /* 0x00A9 */
149 NULL, NULL, NULL, NULL, NULL, NULL,
151 /* 0x00B0 - Win32 Edit controls */
152 "EM_GETSEL32", /* 0x00b0 */
153 "EM_SETSEL32", /* 0x00b1 */
154 "EM_GETRECT32", /* 0x00b2 */
155 "EM_SETRECT32", /* 0x00b3 */
156 "EM_SETRECTNP32", /* 0x00b4 */
157 "EM_SCROLL32", /* 0x00b5 */
158 "EM_LINESCROLL32", /* 0x00b6 */
159 "EM_SCROLLCARET32", /* 0x00b7 */
160 "EM_GETMODIFY32", /* 0x00b8 */
161 "EM_SETMODIFY32", /* 0x00b9 */
162 "EM_GETLINECOUNT32", /* 0x00ba */
163 "EM_LINEINDEX32", /* 0x00bb */
164 "EM_SETHANDLE32", /* 0x00bc */
165 "EM_GETHANDLE32", /* 0x00bd */
166 "EM_GETTHUMB32", /* 0x00be */
167 NULL, /* 0x00bf */
169 NULL, /* 0x00c0 */
170 "EM_LINELENGTH32", /* 0x00c1 */
171 "EM_REPLACESEL32", /* 0x00c2 */
172 NULL, /* 0x00c3 */
173 "EM_GETLINE32", /* 0x00c4 */
174 "EM_LIMITTEXT32", /* 0x00c5 */
175 "EM_CANUNDO32", /* 0x00c6 */
176 "EM_UNDO32", /* 0x00c7 */
177 "EM_FMTLINES32", /* 0x00c8 */
178 "EM_LINEFROMCHAR32", /* 0x00c9 */
179 NULL, /* 0x00ca */
180 "EM_SETTABSTOPS32", /* 0x00cb */
181 "EM_SETPASSWORDCHAR32", /* 0x00cc */
182 "EM_EMPTYUNDOBUFFER32", /* 0x00cd */
183 "EM_GETFIRSTVISIBLELINE32", /* 0x00ce */
184 "EM_SETREADONLY32", /* 0x00cf */
186 "EM_SETWORDBREAKPROC32", /* 0x00d0 */
187 "EM_GETWORDBREAKPROC32", /* 0x00d1 */
188 "EM_GETPASSWORDCHAR32", /* 0x00d2 */
189 "EM_SETMARGINS32", /* 0x00d3 */
190 "EM_GETMARGINS32", /* 0x00d4 */
191 "EM_GETLIMITTEXT32", /* 0x00d5 */
192 "EM_POSFROMCHAR32", /* 0x00d6 */
193 "EM_CHARFROMPOS32", /* 0x00d7 */
194 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
196 /* 0x00E0 - Win32 Scrollbars */
197 "SBM_SETPOS32", /* 0x00e0 */
198 "SBM_GETPOS32", /* 0x00e1 */
199 "SBM_SETRANGE32", /* 0x00e2 */
200 "SBM_GETRANGE32", /* 0x00e3 */
201 "SBM_ENABLE_ARROWS32", /* 0x00e4 */
202 NULL,
203 "SBM_SETRANGEREDRAW32", /* 0x00e6 */
204 NULL, NULL,
205 "SBM_SETSCROLLINFO32", /* 0x00e9 */
206 "SBM_GETSCROLLINFO32", /* 0x00ea */
207 NULL, NULL, NULL, NULL, NULL,
209 /* 0x00F0 - Win32 Buttons */
210 "BM_GETCHECK32", /* 0x00f0 */
211 "BM_SETCHECK32", /* 0x00f1 */
212 "BM_GETSTATE32", /* 0x00f2 */
213 "BM_SETSTATE32", /* 0x00f3 */
214 "BM_SETSTYLE32", /* 0x00f4 */
215 "BM_CLICK32", /* 0x00f5 */
216 "BM_GETIMAGE32", /* 0x00f6 */
217 "BM_SETIMAGE32", /* 0x00f7 */
218 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
220 "WM_KEYDOWN", /* 0x0100 */
221 "WM_KEYUP", /* 0x0101 */
222 "WM_CHAR", /* 0x0102 */
223 "WM_DEADCHAR", /* 0x0103 */
224 "WM_SYSKEYDOWN", /* 0x0104 */
225 "WM_SYSKEYUP", /* 0x0105 */
226 "WM_SYSCHAR", /* 0x0106 */
227 "WM_SYSDEADCHAR", /* 0x0107 */
228 "WM_KEYLAST", /* 0x0108 */
229 NULL,
230 "WM_CONVERTREQUEST",
231 "WM_CONVERTRESULT",
232 "WM_INTERIM", NULL, NULL, NULL,
234 "WM_INITDIALOG", /* 0x0110 */
235 "WM_COMMAND", /* 0x0111 */
236 "WM_SYSCOMMAND", /* 0x0112 */
237 "WM_TIMER", /* 0x0113 */
238 "WM_HSCROLL", /* 0x0114 */
239 "WM_VSCROLL", /* 0x0115 */
240 "WM_INITMENU", /* 0x0116 */
241 "WM_INITMENUPOPUP", /* 0x0117 */
242 "WM_SYSTIMER", /* 0x0118 */
243 NULL, NULL, NULL, NULL, NULL, NULL,
244 "WM_MENUSELECT", /* 0x011f */
246 "WM_MENUCHAR", /* 0x0120 */
247 "WM_ENTERIDLE", /* 0x0121 */
248 NULL, NULL, NULL, NULL, NULL, NULL,
249 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
251 /* 0x0130 */
252 NULL,
253 "WM_LBTRACKPOINT", /* 0x0131 */
254 "WM_CTLCOLORMSGBOX", /* 0x0132 */
255 "WM_CTLCOLOREDIT", /* 0x0133 */
256 "WM_CTLCOLORLISTBOX", /* 0x0134 */
257 "WM_CTLCOLORBTN", /* 0x0135 */
258 "WM_CTLCOLORDLG", /* 0x0136 */
259 "WM_CTLCOLORSCROLLBAR", /* 0x0137 */
260 "WM_CTLCOLORSTATIC", /* 0x0138 */
261 NULL, NULL, NULL, NULL, NULL, NULL, NULL,
263 /* 0x0140 - Win32 Comboboxes */
264 "CB_GETEDITSEL32", /* 0x0140 */
265 "CB_LIMITTEXT32", /* 0x0141 */
266 "CB_SETEDITSEL32", /* 0x0142 */
267 "CB_ADDSTRING32", /* 0x0143 */
268 "CB_DELETESTRING32", /* 0x0144 */
269 "CB_DIR32", /* 0x0145 */
270 "CB_GETCOUNT32", /* 0x0146 */
271 "CB_GETCURSEL32", /* 0x0147 */
272 "CB_GETLBTEXT32", /* 0x0148 */
273 "CB_GETLBTEXTLEN32", /* 0x0149 */
274 "CB_INSERTSTRING32", /* 0x014a */
275 "CB_RESETCONTENT32", /* 0x014b */
276 "CB_FINDSTRING32", /* 0x014c */
277 "CB_SELECTSTRING32", /* 0x014d */
278 "CB_SETCURSEL32", /* 0x014e */
279 "CB_SHOWDROPDOWN32", /* 0x014f */
281 "CB_GETITEMDATA32", /* 0x0150 */
282 "CB_SETITEMDATA32", /* 0x0151 */
283 "CB_GETDROPPEDCONTROLRECT32",/* 0x0152 */
284 "CB_SETITEMHEIGHT32", /* 0x0153 */
285 "CB_GETITEMHEIGHT32", /* 0x0154 */
286 "CB_SETEXTENDEDUI32", /* 0x0155 */
287 "CB_GETEXTENDEDUI32", /* 0x0156 */
288 "CB_GETDROPPEDSTATE32", /* 0x0157 */
289 "CB_FINDSTRINGEXACT32", /* 0x0158 */
290 "CB_SETLOCALE32", /* 0x0159 */
291 "CB_GETLOCALE32", /* 0x015a */
292 "CB_GETTOPINDEX32", /* 0x015b */
293 "CB_SETTOPINDEX32", /* 0x015c */
294 "CB_GETHORIZONTALEXTENT32", /* 0x015d */
295 "CB_SETHORIZONTALEXTENT32", /* 0x015e */
296 "CB_GETDROPPEDWIDTH32", /* 0x015f */
298 "CB_SETDROPPEDWIDTH32", /* 0x0160 */
299 "CB_INITSTORAGE32", /* 0x0161 */
300 NULL, NULL, NULL, NULL, NULL, NULL,
301 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
303 /* 0x0170 - Win32 Static controls */
304 "STM_SETICON32", /* 0x0170 */
305 "STM_GETICON32", /* 0x0171 */
306 "STM_SETIMAGE32", /* 0x0172 */
307 "STM_GETIMAGE32", /* 0x0173 */
308 NULL, NULL, NULL, NULL,
309 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
311 /* 0x0180 - Win32 Listboxes */
312 "LB_ADDSTRING32", /* 0x0180 */
313 "LB_INSERTSTRING32", /* 0x0181 */
314 "LB_DELETESTRING32", /* 0x0182 */
315 "LB_SELITEMRANGEEX32", /* 0x0183 */
316 "LB_RESETCONTENT32", /* 0x0184 */
317 "LB_SETSEL32", /* 0x0185 */
318 "LB_SETCURSEL32", /* 0x0186 */
319 "LB_GETSEL32", /* 0x0187 */
320 "LB_GETCURSEL32", /* 0x0188 */
321 "LB_GETTEXT32", /* 0x0189 */
322 "LB_GETTEXTLEN32", /* 0x018a */
323 "LB_GETCOUNT32", /* 0x018b */
324 "LB_SELECTSTRING32", /* 0x018c */
325 "LB_DIR32", /* 0x018d */
326 "LB_GETTOPINDEX32", /* 0x018e */
327 "LB_FINDSTRING32", /* 0x018f */
329 "LB_GETSELCOUNT32", /* 0x0190 */
330 "LB_GETSELITEMS32", /* 0x0191 */
331 "LB_SETTABSTOPS32", /* 0x0192 */
332 "LB_GETHORIZONTALEXTENT32", /* 0x0193 */
333 "LB_SETHORIZONTALEXTENT32", /* 0x0194 */
334 "LB_SETCOLUMNWIDTH32", /* 0x0195 */
335 "LB_ADDFILE32", /* 0x0196 */
336 "LB_SETTOPINDEX32", /* 0x0197 */
337 "LB_GETITEMRECT32", /* 0x0198 */
338 "LB_GETITEMDATA32", /* 0x0199 */
339 "LB_SETITEMDATA32", /* 0x019a */
340 "LB_SELITEMRANGE32", /* 0x019b */
341 "LB_SETANCHORINDEX32", /* 0x019c */
342 "LB_GETANCHORINDEX32", /* 0x019d */
343 "LB_SETCARETINDEX32", /* 0x019e */
344 "LB_GETCARETINDEX32", /* 0x019f */
346 "LB_SETITEMHEIGHT32", /* 0x01a0 */
347 "LB_GETITEMHEIGHT32", /* 0x01a1 */
348 "LB_FINDSTRINGEXACT32", /* 0x01a2 */
349 "LB_CARETON32", /* 0x01a3 */
350 "LB_CARETOFF32", /* 0x01a4 */
351 "LB_SETLOCALE32", /* 0x01a5 */
352 "LB_GETLOCALE32", /* 0x01a6 */
353 "LB_SETCOUNT32", /* 0x01a7 */
354 "LB_INITSTORAGE32", /* 0x01a8 */
355 "LB_ITEMFROMPOINT32", /* 0x01a9 */
356 NULL, NULL, NULL, NULL, NULL, NULL,
358 /* 0x01B0 */
359 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
360 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
362 /* 0x01C0 */
363 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
364 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
366 /* 0x01D0 */
367 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
368 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
370 /* 0x01E0 */
371 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
372 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
374 /* 0x01F0 */
375 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
376 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
378 "WM_MOUSEMOVE", /* 0x0200 */
379 "WM_LBUTTONDOWN", /* 0x0201 */
380 "WM_LBUTTONUP", /* 0x0202 */
381 "WM_LBUTTONDBLCLK", /* 0x0203 */
382 "WM_RBUTTONDOWN", /* 0x0204 */
383 "WM_RBUTTONUP", /* 0x0205 */
384 "WM_RBUTTONDBLCLK", /* 0x0206 */
385 "WM_MBUTTONDOWN", /* 0x0207 */
386 "WM_MBUTTONUP", /* 0x0208 */
387 "WM_MBUTTONDBLCLK", /* 0x0209 */
388 NULL, NULL, NULL, NULL, NULL, NULL,
390 "WM_PARENTNOTIFY", /* 0x0210 */
391 "WM_ENTERMENULOOP", /* 0x0211 */
392 "WM_EXITMENULOOP", /* 0x0212 */
393 "WM_NEXTMENU", /* 0x0213 */
394 "WM_SIZING",
395 "WM_CAPTURECHANGED",
396 "WM_MOVING", NULL,
397 "WM_POWERBROADCAST",
398 "WM_DEVICECHANGE", NULL, NULL, NULL, NULL, NULL, NULL,
400 "WM_MDICREATE", /* 0x0220 */
401 "WM_MDIDESTROY", /* 0x0221 */
402 "WM_MDIACTIVATE", /* 0x0222 */
403 "WM_MDIRESTORE", /* 0x0223 */
404 "WM_MDINEXT", /* 0x0224 */
405 "WM_MDIMAXIMIZE", /* 0x0225 */
406 "WM_MDITILE", /* 0x0226 */
407 "WM_MDICASCADE", /* 0x0227 */
408 "WM_MDIICONARRANGE", /* 0x0228 */
409 "WM_MDIGETACTIVE", /* 0x0229 */
411 "WM_DROPOBJECT",
412 "WM_QUERYDROPOBJECT",
413 "WM_BEGINDRAG",
414 "WM_DRAGLOOP",
415 "WM_DRAGSELECT",
416 "WM_DRAGMOVE",
418 /* 0x0230*/
419 "WM_MDISETMENU", /* 0x0230 */
420 "WM_ENTERSIZEMOVE", /* 0x0231 */
421 "WM_EXITSIZEMOVE", /* 0x0232 */
422 "WM_DROPFILES", /* 0x0233 */
423 "WM_MDIREFRESHMENU", NULL, NULL, NULL,
424 /* 0x0238*/
425 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
427 /* 0x0240 */
428 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
429 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
431 /* 0x0250 */
432 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
433 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
435 /* 0x0260 */
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,
439 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
441 /* 0x0280 */
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,
445 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,
450 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
452 /* 0x02c0 */
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,
456 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,
461 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
463 "WM_CUT", /* 0x0300 */
464 "WM_COPY",
465 "WM_PASTE",
466 "WM_CLEAR",
467 "WM_UNDO",
468 "WM_RENDERFORMAT",
469 "WM_RENDERALLFORMATS",
470 "WM_DESTROYCLIPBOARD",
471 "WM_DRAWCLIPBOARD",
472 "WM_PAINTCLIPBOARD",
473 "WM_VSCROLLCLIPBOARD",
474 "WM_SIZECLIPBOARD",
475 "WM_ASKCBFORMATNAME",
476 "WM_CHANGECBCHAIN",
477 "WM_HSCROLLCLIPBOARD",
478 "WM_QUERYNEWPALETTE", /* 0x030f*/
480 "WM_PALETTEISCHANGING",
481 "WM_PALETTECHANGED",
482 "WM_HOTKEY", /* 0x0312 */
483 NULL, NULL, NULL, NULL,
484 "WM_PRINT",
485 "WM_PRINTCLIENT",
486 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,
491 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
493 /* 0x0340 */
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,
497 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
499 "WM_QUERYAFXWNDPROC", /* 0x0360 */
500 "WM_SIZEPARENT", /* 0x0361 */
501 "WM_SETMESSAGESTRING", /* 0x0362 */
502 "WM_IDLEUPDATECMDUI", /* 0x0363 */
503 "WM_INITIALUPDATE", /* 0x0364 */
504 "WM_COMMANDHELP", /* 0x0365 */
505 "WM_HELPHITTEST", /* 0x0366 */
506 "WM_EXITHELPMODE", /* 0x0367 */
507 "WM_RECALCPARENT", /* 0x0368 */
508 "WM_SIZECHILD", /* 0x0369 */
509 "WM_KICKIDLE", /* 0x036A */
510 "WM_QUERYCENTERWND", /* 0x036B */
511 "WM_DISABLEMODAL", /* 0x036C */
512 "WM_FLOATSTATUS", /* 0x036D */
513 "WM_ACTIVATETOPLEVEL", /* 0x036E */
514 "WM_QUERY3DCONTROLS", /* 0x036F */
515 NULL,NULL,NULL,
516 "WM_SOCKET_NOTIFY", /* 0x0373 */
517 "WM_SOCKET_DEAD", /* 0x0374 */
518 "WM_POPMESSAGESTRING", /* 0x0375 */
519 "WM_OCC_LOADFROMSTREAM", /* 0x0376 */
520 "WM_OCC_LOADFROMSTORAGE", /* 0x0377 */
521 "WM_OCC_INITNEW", /* 0x0378 */
522 "WM_QUEUE_SENTINEL", /* 0x0379 */
523 "WM_OCC_LOADFROMSTREAM_EX", /* 0x037A */
524 "WM_OCC_LOADFROMSTORAGE_EX", /* 0x037B */
526 NULL,NULL,NULL,NULL,
528 /* 0x0380 */
529 "WM_PENWINFIRST",
530 "WM_RCRESULT",
531 "WM_HOOKRCRESULT",
532 "WM_GLOBALRCCHANGE",
533 "WM_SKB",
534 "WM_HEDITCTL",
535 NULL, NULL,
536 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
538 "WM_COALESCE_FIRST",
539 NULL, NULL, NULL, NULL, NULL, NULL, NULL,
540 NULL, NULL, NULL, NULL, NULL, NULL, NULL,
541 "WM_COALESCE_LAST",
543 /* 0x03a0 */
544 "MM_JOY1MOVE",
545 "MM_JOY2MOVE",
546 "MM_JOY1ZMOVE",
547 "MM_JOY2ZMOVE",
548 NULL, NULL, NULL, NULL,
549 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
551 /* 0x03b0 */
552 NULL, NULL, NULL, NULL, NULL,
553 "MM_JOY1BUTTONDOWN",
554 "MM_JOY2BUTTONDOWN",
555 "MM_JOY1BUTTONUP",
556 "MM_JOY2BUTTONUP",
557 "MM_MCINOTIFY",
558 NULL,
559 "MM_WOM_OPEN",
560 "MM_WOM_CLOSE",
561 "MM_WOM_DONE",
562 "MM_WIM_OPEN",
563 "MM_WIM_CLOSE",
565 /* 0x03c0 */
566 "MM_WIM_DATA",
567 "MM_MIM_OPEN",
568 "MM_MIM_CLOSE",
569 "MM_MIM_DATA",
570 "MM_MIM_LONGDATA",
571 "MM_MIM_ERROR",
572 "MM_MIM_LONGERROR",
573 "MM_MOM_OPEN",
574 "MM_MOM_CLOSE",
575 "MM_MOM_DONE",
576 NULL, NULL, NULL, NULL, NULL, NULL,
577 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
578 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
580 /* 0x03e0 */
581 "WM_DDE_INITIATE", /* 0x3E0 */
582 "WM_DDE_TERMINATE", /* 0x3E1 */
583 "WM_DDE_ADVISE", /* 0x3E2 */
584 "WM_DDE_UNADVISE", /* 0x3E3 */
585 "WM_DDE_ACK", /* 0x3E4 */
586 "WM_DDE_DATA", /* 0x3E5 */
587 "WM_DDE_REQUEST", /* 0x3E6 */
588 "WM_DDE_POKE", /* 0x3E7 */
589 "WM_DDE_EXECUTE", /* 0x3E8 */
590 NULL, NULL, NULL, NULL, NULL, NULL, NULL,
593 /* 0x03f0 */
594 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
595 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
597 "WM_USER"
601 #define SPY_MAX_LVMMSGNUM 139
602 static const char * const LVMMessageTypeNames[SPY_MAX_LVMMSGNUM + 1] =
604 "LVM_GETBKCOLOR", /* 1000 */
605 "LVM_SETBKCOLOR",
606 "LVM_GETIMAGELIST",
607 "LVM_SETIMAGELIST",
608 "LVM_GETITEMCOUNT",
609 "LVM_GETITEMA",
610 "LVM_SETITEMA",
611 "LVM_INSERTITEMA",
612 "LVM_DELETEITEM",
613 "LVM_DELETEALLITEMS",
614 "LVM_GETCALLBACKMASK",
615 "LVM_SETCALLBACKMASK",
616 "LVM_GETNEXTITEM",
617 "LVM_FINDITEMA",
618 "LVM_GETITEMRECT",
619 "LVM_SETITEMPOSITION",
620 "LVM_GETITEMPOSITION",
621 "LVM_GETSTRINGWIDTHA",
622 "LVM_HITTEST",
623 "LVM_ENSUREVISIBLE",
624 "LVM_SCROLL",
625 "LVM_REDRAWITEMS",
626 "LVM_ARRANGE",
627 "LVM_EDITLABELA",
628 "LVM_GETEDITCONTROL",
629 "LVM_GETCOLUMNA",
630 "LVM_SETCOLUMNA",
631 "LVM_INSERTCOLUMNA",
632 "LVM_DELETECOLUMN",
633 "LVM_GETCOLUMNWIDTH",
634 "LVM_SETCOLUMNWIDTH",
635 "LVM_GETHEADER",
636 "LVM_CREATEDRAGIMAGE",
637 "LVM_GETVIEWRECT",
638 "LVM_GETTEXTCOLOR",
639 "LVM_SETTEXTCOLOR",
640 "LVM_GETTEXTBKCOLOR",
641 "LVM_SETTEXTBKCOLOR",
642 "LVM_GETTOPINDEX",
643 "LVM_GETCOUNTPERPAGE",
644 "LVM_GETORIGIN",
645 "LVM_UPDATE",
646 "LVM_SETITEMSTATE",
647 "LVM_GETITEMSTATE",
648 "LVM_GETITEMTEXTA",
649 "LVM_SETITEMTEXTA",
650 "LVM_SETITEMCOUNT",
651 "LVM_SORTITEMS",
652 "LVM_SETITEMPOSITION32",
653 "LVM_GETSELECTEDCOUNT",
654 "LVM_GETITEMSPACING",
655 "LVM_GETISEARCHSTRINGA",
656 "LVM_SETICONSPACING",
657 "LVM_SETEXTENDEDLISTVIEWSTYLE",
658 "LVM_GETEXTENDEDLISTVIEWSTYLE",
659 "LVM_GETSUBITEMRECT",
660 "LVM_SUBITEMHITTEST",
661 "LVM_SETCOLUMNORDERARRAY",
662 "LVM_GETCOLUMNORDERARRAY",
663 "LVM_SETHOTITEM",
664 "LVM_GETHOTITEM",
665 "LVM_SETHOTCURSOR",
666 "LVM_GETHOTCURSOR",
667 "LVM_APPROXIMATEVIEWRECT",
668 "LVM_SETWORKAREAS",
669 "LVM_GETSELECTIONMARK",
670 "LVM_SETSELECTIONMARK",
671 "LVM_SETBKIMAGEA",
672 "LVM_GETBKIMAGEA",
673 "LVM_GETWORKAREAS",
674 "LVM_SETHOVERTIME",
675 "LVM_GETHOVERTIME",
676 "LVM_GETNUMBEROFWORKAREAS",
677 "LVM_SETTOOLTIPS",
678 "LVM_GETITEMW",
679 "LVM_SETITEMW",
680 "LVM_INSERTITEMW",
681 "LVM_GETTOOLTIPS",
682 NULL,
683 NULL,
684 NULL,
685 NULL,
686 "LVM_FINDITEMW",
687 NULL,
688 NULL,
689 NULL,
690 "LVM_GETSTRINGWIDTHW",
691 NULL,
692 NULL,
693 NULL,
694 NULL,
695 NULL,
696 NULL,
697 NULL,
698 "LVM_GETCOLUMNW",
699 "LVM_SETCOLUMNW",
700 "LVM_INSERTCOLUMNW",
701 NULL,
702 NULL,
703 NULL,
704 NULL,
705 NULL,
706 NULL,
707 NULL,
708 NULL,
709 NULL,
710 NULL,
711 NULL,
712 NULL,
713 NULL,
714 NULL,
715 NULL,
716 NULL,
717 NULL,
718 "LVM_GETITEMTEXTW",
719 "LVM_SETITEMTEXTW",
720 "LVM_GETISEARCHSTRINGW",
721 "LVM_EDITLABELW",
722 NULL,
723 NULL,
724 NULL,
725 NULL,
726 NULL,
727 NULL,
728 NULL,
729 NULL,
730 NULL,
731 NULL,
732 NULL,
733 NULL,
734 NULL,
735 NULL,
736 NULL,
737 NULL,
738 NULL,
739 NULL,
740 NULL,
741 NULL,
742 "LVM_SETBKIMAGEW",
743 "LVM_GETBKIMAGEW" /* 0x108B */
746 #define SPY_MAX_CCMMSGNUM 6
747 static const char * const CCMMessageTypeNames[SPY_MAX_CCMMSGNUM + 1] =
749 NULL, /* 0x2000 */
750 "CCM_SETBKCOLOR",
751 "CCM_SETCOLORSCHEME",
752 "CCM_GETCOLORSCHEME",
753 "CCM_GETDROPTARGET",
754 "CCM_SETUNICODEFORMAT",
755 "CCM_GETUNICODEFORMAT"
758 static BOOL16 SPY_Exclude[SPY_MAX_MSGNUM+1];
759 static BOOL16 SPY_ExcludeDWP = 0;
760 static int SPY_IndentLevel = 0;
762 #define SPY_EXCLUDE(msg) \
763 (SPY_Exclude[(msg) > SPY_MAX_MSGNUM ? SPY_MAX_MSGNUM : (msg)])
765 /***********************************************************************
766 * SPY_GetMsgName
768 const char *SPY_GetMsgName( UINT msg )
770 static char msg_buffer[20];
772 if (msg <= SPY_MAX_MSGNUM)
774 if (!MessageTypeNames[msg]) return "???";
775 return MessageTypeNames[msg];
778 if (msg >= LVM_FIRST && msg <= LVM_FIRST + SPY_MAX_LVMMSGNUM)
780 if (!LVMMessageTypeNames[msg-LVM_FIRST]) return "LVM_?";
781 return LVMMessageTypeNames[msg-LVM_FIRST];
784 if (msg >= CCM_FIRST && msg <= CCM_FIRST + SPY_MAX_CCMMSGNUM)
786 if (!CCMMessageTypeNames[msg-CCM_FIRST]) return "???";
787 return CCMMessageTypeNames[msg-CCM_FIRST];
790 sprintf( msg_buffer, "WM_USER+%04x", msg - WM_USER );
791 return msg_buffer;
794 /***********************************************************************
795 * SPY_GetWndName
797 const char *SPY_GetWndName( HWND hwnd )
799 static char wnd_buffer[16];
801 WND* pWnd = WIN_FindWndPtr( hwnd );
802 if( pWnd )
804 INT n = sizeof(wnd_buffer) - 6;
805 LPSTR p = wnd_buffer;
806 LPSTR src;
808 char postfix;
810 if( pWnd->text && pWnd->text[0] != '\0' )
812 src = pWnd->text;
813 *(p++) = postfix = '\"';
814 while ((n-- > 1) && *src) *p++ = *src++;
816 else /* get class name */
818 INT len;
820 *(p++)='{';
821 GlobalGetAtomNameA((ATOM) GetClassWord(pWnd->hwndSelf, GCW_ATOM), p, n + 1);
822 src = p += (len = lstrlenA(p));
823 if( len >= n ) src = wnd_buffer; /* something nonzero */
824 postfix = '}';
826 if( *src ) for( n = 0; n < 3; n++ ) *(p++)='.';
827 *(p++) = postfix;
828 *(p++) = '\0';
829 WIN_ReleaseWndPtr(pWnd);
832 else lstrcpyA( wnd_buffer, "\"NULL\"" );
833 return wnd_buffer;
835 /***********************************************************************
836 * SPY_DumpStructure
838 void SPY_DumpStructure (UINT msg, LPARAM structure)
840 switch (msg)
842 case WM_DRAWITEM:
843 { DRAWITEMSTRUCT *lpdis = (DRAWITEMSTRUCT*) structure;
844 TRACE("DRAWITEMSTRUCT: CtlType=0x%08x CtlID=0x%08x\n", lpdis->CtlType, lpdis->CtlID);
845 TRACE("itemID=0x%08x itemAction=0x%08x itemState=0x%08x\n", lpdis->itemID, lpdis->itemAction, lpdis->itemState);
846 TRACE("hWnd=0x%04x hDC=0x%04x (%d,%d)-(%d,%d) itemData=0x%08lx\n",
847 lpdis->hwndItem, lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, lpdis->rcItem.right, lpdis->rcItem.bottom, lpdis->itemData);
849 break;
850 case WM_MEASUREITEM:
851 { MEASUREITEMSTRUCT *lpmis = (MEASUREITEMSTRUCT*) structure;
852 TRACE("MEASUREITEMSTRUCT: CtlType=0x%08x CtlID=0x%08x\n", lpmis->CtlType, lpmis->CtlID);
853 TRACE("itemID=0x%08x itemWidth=0x%08x itemHeight=0x%08x\n", lpmis->itemID, lpmis->itemWidth, lpmis->itemHeight);
854 TRACE("itemData=0x%08lx\n", lpmis->itemData);
856 break;
857 case WM_NOTIFY:
858 { NMHDR * pnmh = (NMHDR*) structure;
859 TRACE("NMHDR hwndFrom=0x%08x idFrom=0x%08x code=0x%08x\n", pnmh->hwndFrom, pnmh->idFrom, pnmh->code);
861 default:
862 break;
866 /***********************************************************************
867 * SPY_EnterMessage
869 void SPY_EnterMessage( INT iFlag, HWND hWnd, UINT msg,
870 WPARAM wParam, LPARAM lParam )
872 LPCSTR pname;
874 if (!TRACE_ON(message) || SPY_EXCLUDE(msg)) return;
876 /* each SPY_SENDMESSAGE must be complemented by call to SPY_ExitMessage */
877 switch(iFlag)
879 case SPY_DISPATCHMESSAGE16:
880 pname = SPY_GetWndName(hWnd);
881 TRACE("%*s(%04x) %-16s message [%04x] %s dispatched wp=%04x lp=%08lx\n",
882 SPY_IndentLevel, "", hWnd, pname, msg, SPY_GetMsgName( msg ),
883 wParam, lParam);
884 break;
886 case SPY_DISPATCHMESSAGE:
887 pname = SPY_GetWndName(hWnd);
888 TRACE("%*s(%08x) %-16s message [%04x] %s dispatched wp=%08x lp=%08lx\n",
889 SPY_IndentLevel, "", hWnd, pname, msg, SPY_GetMsgName( msg ),
890 wParam, lParam);
891 break;
893 case SPY_SENDMESSAGE16:
894 case SPY_SENDMESSAGE:
896 char taskName[30];
897 HTASK16 hTask = GetWindowTask16(hWnd);
899 if (hTask == GetCurrentTask()) strcpy( taskName, "self" );
900 else if (!hTask) strcpy( taskName, "Wine" );
901 else
903 sprintf( taskName, "task %04x ???", hTask );
904 GetModuleName16( hTask, taskName + 10, sizeof(taskName) - 10 );
906 pname = SPY_GetWndName(hWnd);
908 if (iFlag == SPY_SENDMESSAGE16)
909 TRACE("%*s(%04x) %-16s message [%04x] %s sent from %s wp=%04x lp=%08lx\n",
910 SPY_IndentLevel, "", hWnd, pname, msg, SPY_GetMsgName( msg ),
911 taskName, wParam, lParam );
912 else
913 { TRACE("%*s(%08x) %-16s message [%04x] %s sent from %s wp=%08x lp=%08lx\n",
914 SPY_IndentLevel, "", hWnd, pname, msg, SPY_GetMsgName( msg ),
915 taskName, wParam, lParam );
916 SPY_DumpStructure(msg, lParam);
919 break;
921 case SPY_DEFWNDPROC16:
922 if( SPY_ExcludeDWP ) return;
923 TRACE("%*s(%04x) DefWindowProc16: %s [%04x] wp=%04x lp=%08lx\n",
924 SPY_IndentLevel, "", hWnd, SPY_GetMsgName( msg ),
925 msg, wParam, lParam );
926 break;
928 case SPY_DEFWNDPROC:
929 if( SPY_ExcludeDWP ) return;
930 TRACE("%*s(%08x) DefWindowProc32: %s [%04x] wp=%08x lp=%08lx\n",
931 SPY_IndentLevel, "", hWnd, SPY_GetMsgName( msg ),
932 msg, wParam, lParam );
933 break;
935 SPY_IndentLevel += SPY_INDENT_UNIT;
939 /***********************************************************************
940 * SPY_ExitMessage
942 void SPY_ExitMessage( INT iFlag, HWND hWnd, UINT msg, LRESULT lReturn )
944 LPCSTR pname;
946 if (!TRACE_ON(message) || SPY_EXCLUDE(msg) ||
947 (SPY_ExcludeDWP && (iFlag == SPY_RESULT_DEFWND16 || iFlag == SPY_RESULT_DEFWND)) )
948 return;
950 if (SPY_IndentLevel) SPY_IndentLevel -= SPY_INDENT_UNIT;
952 switch(iFlag)
954 case SPY_RESULT_DEFWND16:
955 TRACE(" %*s(%04x) DefWindowProc16: %s [%04x] returned %08lx\n",
956 SPY_IndentLevel, "", hWnd, SPY_GetMsgName( msg ), msg, lReturn );
957 break;
959 case SPY_RESULT_DEFWND:
960 TRACE(" %*s(%08x) DefWindowProc32: %s [%04x] returned %08lx\n",
961 SPY_IndentLevel, "", hWnd, SPY_GetMsgName( msg ), msg, lReturn );
962 break;
964 case SPY_RESULT_OK16:
965 pname = SPY_GetWndName(hWnd);
966 TRACE(" %*s(%04x) %-16s message [%04x] %s returned %08lx\n",
967 SPY_IndentLevel, "", hWnd, pname, msg,
968 SPY_GetMsgName( msg ), lReturn );
969 break;
971 case SPY_RESULT_OK:
972 pname = SPY_GetWndName(hWnd);
973 TRACE(" %*s(%08x) %-16s message [%04x] %s returned %08lx\n",
974 SPY_IndentLevel, "", hWnd, pname, msg,
975 SPY_GetMsgName( msg ), lReturn );
976 break;
978 case SPY_RESULT_INVALIDHWND16:
979 pname = SPY_GetWndName(hWnd);
980 WARN(" %*s(%04x) %-16s message [%04x] %s HAS INVALID HWND\n",
981 SPY_IndentLevel, "", hWnd, pname, msg,
982 SPY_GetMsgName( msg ) );
983 break;
985 case SPY_RESULT_INVALIDHWND:
986 pname = SPY_GetWndName(hWnd);
987 WARN(" %*s(%08x) %-16s message [%04x] %s HAS INVALID HWND\n",
988 SPY_IndentLevel, "", hWnd, pname, msg,
989 SPY_GetMsgName( msg ) );
990 break;
995 /***********************************************************************
996 * SPY_Init
998 int SPY_Init(void)
1000 int i;
1001 char buffer[1024];
1003 if (!TRACE_ON(message)) return TRUE;
1005 PROFILE_GetWineIniString( "Spy", "Include", "", buffer, sizeof(buffer) );
1006 if (buffer[0] && strcmp( buffer, "INCLUDEALL" ))
1008 TRACE("Include=%s\n", buffer );
1009 for (i = 0; i <= SPY_MAX_MSGNUM; i++)
1010 SPY_Exclude[i] = (MessageTypeNames[i] && !strstr(buffer,MessageTypeNames[i]));
1013 PROFILE_GetWineIniString( "Spy", "Exclude", "", buffer, sizeof(buffer) );
1014 if (buffer[0])
1016 TRACE("Exclude=%s\n", buffer );
1017 if (!strcmp( buffer, "EXCLUDEALL" ))
1018 for (i = 0; i <= SPY_MAX_MSGNUM; i++) SPY_Exclude[i] = TRUE;
1019 else
1020 for (i = 0; i <= SPY_MAX_MSGNUM; i++)
1021 SPY_Exclude[i] = (MessageTypeNames[i] && strstr(buffer,MessageTypeNames[i]));
1024 SPY_ExcludeDWP = PROFILE_GetWineIniInt( "Spy", "ExcludeDWP", 0 );
1026 return 1;