spy.c 91.4 KB
Newer Older
Alexandre Julliard's avatar
Alexandre Julliard committed
1 2
/*
 * Message spying routines
Alexandre Julliard's avatar
Alexandre Julliard committed
3 4
 *
 * Copyright 1994, Bob Amstadt
5
 *           1995, Alex Korobka
6 7 8 9 10 11 12 13 14 15 16 17 18
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
19
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
Alexandre Julliard's avatar
Alexandre Julliard committed
20 21 22
 */

#include <stdlib.h>
Alexandre Julliard's avatar
Alexandre Julliard committed
23
#include <string.h>
24
#include <stdarg.h>
25 26
#include <stdio.h>
#include "windef.h"
27
#include "winbase.h"
28
#include "wingdi.h"
29
#include "winreg.h"
30
#include "wine/unicode.h"
Alexandre Julliard's avatar
Alexandre Julliard committed
31
#include "win.h"
32
#include "user_private.h"
33
#include "wine/debug.h"
34
#include "commctrl.h"
35
#include "commdlg.h"
36
#include "richedit.h"
Alexandre Julliard's avatar
Alexandre Julliard committed
37

38
WINE_DEFAULT_DEBUG_CHANNEL(message);
39

Alexandre Julliard's avatar
Alexandre Julliard committed
40 41 42
#define SPY_MAX_MSGNUM   WM_USER
#define SPY_INDENT_UNIT  4  /* 4 spaces */

43 44
#define DEBUG_SPY 0

45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
static const char * const ClassLongOffsetNames[] =
{
    "GCLP_MENUNAME",      /*  -8 */
    "GCLP_HBRBACKGROUND", /* -10 */
    "GCLP_HCURSOR",       /* -12 */
    "GCLP_HICON",         /* -14 */
    "GCLP_HMODULE",       /* -16 */
    "GCL_CBWNDEXTRA",     /* -18 */
    "GCL_CBCLSEXTRA",     /* -20 */
    "?",
    "GCLP_WNDPROC",       /* -24 */
    "GCL_STYLE",          /* -26 */
    "?",
    "?",
    "GCW_ATOM",           /* -32 */
    "GCLP_HICONSM",       /* -34 */
};

Alexandre Julliard's avatar
Alexandre Julliard committed
63
static const char * const MessageTypeNames[SPY_MAX_MSGNUM + 1] =
Alexandre Julliard's avatar
Alexandre Julliard committed
64
{
65
    "WM_NULL",                  /* 0x00 */
66 67
    "WM_CREATE",
    "WM_DESTROY",
Alexandre Julliard's avatar
Alexandre Julliard committed
68
    "WM_MOVE",
Alexandre Julliard's avatar
Alexandre Julliard committed
69
    "wm_sizewait",
Alexandre Julliard's avatar
Alexandre Julliard committed
70 71 72 73
    "WM_SIZE",
    "WM_ACTIVATE",
    "WM_SETFOCUS",
    "WM_KILLFOCUS",
Alexandre Julliard's avatar
Alexandre Julliard committed
74
    "WM_SETVISIBLE",
Alexandre Julliard's avatar
Alexandre Julliard committed
75 76 77 78 79 80
    "WM_ENABLE",
    "WM_SETREDRAW",
    "WM_SETTEXT",
    "WM_GETTEXT",
    "WM_GETTEXTLENGTH",
    "WM_PAINT",
81
    "WM_CLOSE",                 /* 0x10 */
Alexandre Julliard's avatar
Alexandre Julliard committed
82 83 84 85 86 87
    "WM_QUERYENDSESSION",
    "WM_QUIT",
    "WM_QUERYOPEN",
    "WM_ERASEBKGND",
    "WM_SYSCOLORCHANGE",
    "WM_ENDSESSION",
Alexandre Julliard's avatar
Alexandre Julliard committed
88
    "wm_systemerror",
Alexandre Julliard's avatar
Alexandre Julliard committed
89 90 91 92 93 94 95 96
    "WM_SHOWWINDOW",
    "WM_CTLCOLOR",
    "WM_WININICHANGE",
    "WM_DEVMODECHANGE",
    "WM_ACTIVATEAPP",
    "WM_FONTCHANGE",
    "WM_TIMECHANGE",
    "WM_CANCELMODE",
97
    "WM_SETCURSOR",             /* 0x20 */
Alexandre Julliard's avatar
Alexandre Julliard committed
98 99 100 101
    "WM_MOUSEACTIVATE",
    "WM_CHILDACTIVATE",
    "WM_QUEUESYNC",
    "WM_GETMINMAXINFO",
Alexandre Julliard's avatar
Alexandre Julliard committed
102 103
    "wm_unused3",
    "wm_painticon",
Alexandre Julliard's avatar
Alexandre Julliard committed
104 105
    "WM_ICONERASEBKGND",
    "WM_NEXTDLGCTL",
Alexandre Julliard's avatar
Alexandre Julliard committed
106
    "wm_alttabactive",
Alexandre Julliard's avatar
Alexandre Julliard committed
107 108 109 110 111 112
    "WM_SPOOLERSTATUS",
    "WM_DRAWITEM",
    "WM_MEASUREITEM",
    "WM_DELETEITEM",
    "WM_VKEYTOITEM",
    "WM_CHARTOITEM",
113
    "WM_SETFONT",               /* 0x30 */
Alexandre Julliard's avatar
Alexandre Julliard committed
114
    "WM_GETFONT",
115 116 117
    "WM_SETHOTKEY",
    "WM_GETHOTKEY",
    "wm_filesyschange",
Alexandre Julliard's avatar
Alexandre Julliard committed
118 119
    "wm_isactiveicon",
    "wm_queryparkicon",
Alexandre Julliard's avatar
Alexandre Julliard committed
120
    "WM_QUERYDRAGICON",
Alexandre Julliard's avatar
Alexandre Julliard committed
121
    "wm_querysavestate",
122
    "WM_COMPAREITEM",
Alexandre Julliard's avatar
Alexandre Julliard committed
123
    "wm_testing",
124
    NULL,
125 126
    NULL,
    "WM_GETOBJECT",             /* 0x3d */
Alexandre Julliard's avatar
Alexandre Julliard committed
127
    "wm_activateshellwindow",
Alexandre Julliard's avatar
Alexandre Julliard committed
128
    NULL,
Alexandre Julliard's avatar
Alexandre Julliard committed
129

130
    NULL,                       /* 0x40 */
131 132
    "wm_compacting", NULL, NULL,
    "WM_COMMNOTIFY", NULL,
133 134
    "WM_WINDOWPOSCHANGING",     /* 0x0046 */
    "WM_WINDOWPOSCHANGED",      /* 0x0047 */
135 136 137
    "WM_POWER", NULL,
    "WM_COPYDATA",
    "WM_CANCELJOURNAL", NULL, NULL,
Alexandre Julliard's avatar
Alexandre Julliard committed
138
    "WM_NOTIFY", NULL,
Alexandre Julliard's avatar
Alexandre Julliard committed
139

Alexandre Julliard's avatar
Alexandre Julliard committed
140 141
    /* 0x0050 */
    "WM_INPUTLANGCHANGEREQUEST",
142 143 144 145 146
    "WM_INPUTLANGCHANGE",
    "WM_TCARD",
    "WM_HELP",
    "WM_USERCHANGED",
    "WM_NOTIFYFORMAT", NULL, NULL,
Alexandre Julliard's avatar
Alexandre Julliard committed
147 148 149 150 151 152 153 154
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,

    /* 0x0060 */
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,

    /* 0x0070 */
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
155 156 157 158 159
    NULL, NULL, NULL,
    "WM_CONTEXTMENU",
    "WM_STYLECHANGING",
    "WM_STYLECHANGED",
    "WM_DISPLAYCHANGE",
Alexandre Julliard's avatar
Alexandre Julliard committed
160
    "WM_GETICON",
Alexandre Julliard's avatar
Alexandre Julliard committed
161

162 163 164 165 166 167 168 169
    "WM_SETICON",               /* 0x0080 */
    "WM_NCCREATE",              /* 0x0081 */
    "WM_NCDESTROY",             /* 0x0082 */
    "WM_NCCALCSIZE",            /* 0x0083 */
    "WM_NCHITTEST",             /* 0x0084 */
    "WM_NCPAINT",               /* 0x0085 */
    "WM_NCACTIVATE",            /* 0x0086 */
    "WM_GETDLGCODE",            /* 0x0087 */
170
    "WM_SYNCPAINT",
171
    "WM_SYNCTASK", NULL, NULL, NULL, NULL, NULL, NULL,
Alexandre Julliard's avatar
Alexandre Julliard committed
172 173 174 175 176 177

    /* 0x0090 */
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,

    /* 0x00A0 */
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
    "WM_NCMOUSEMOVE",           /* 0x00a0 */
    "WM_NCLBUTTONDOWN",         /* 0x00a1 */
    "WM_NCLBUTTONUP",           /* 0x00a2 */
    "WM_NCLBUTTONDBLCLK",       /* 0x00a3 */
    "WM_NCRBUTTONDOWN",         /* 0x00a4 */
    "WM_NCRBUTTONUP",           /* 0x00a5 */
    "WM_NCRBUTTONDBLCLK",       /* 0x00a6 */
    "WM_NCMBUTTONDOWN",         /* 0x00a7 */
    "WM_NCMBUTTONUP",           /* 0x00a8 */
    "WM_NCMBUTTONDBLCLK",       /* 0x00a9 */
    NULL,                       /* 0x00aa */
    "WM_NCXBUTTONDOWN",         /* 0x00ab */
    "WM_NCXBUTTONUP",           /* 0x00ac */
    "WM_NCXBUTTONDBLCLK",       /* 0x00ad */
    NULL,                       /* 0x00ae */
    NULL,                       /* 0x00af */
Alexandre Julliard's avatar
Alexandre Julliard committed
194

Alexandre Julliard's avatar
Alexandre Julliard committed
195
    /* 0x00B0 - Win32 Edit controls */
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
    "EM_GETSEL",                /* 0x00b0 */
    "EM_SETSEL",                /* 0x00b1 */
    "EM_GETRECT",               /* 0x00b2 */
    "EM_SETRECT",               /* 0x00b3 */
    "EM_SETRECTNP",             /* 0x00b4 */
    "EM_SCROLL",                /* 0x00b5 */
    "EM_LINESCROLL",            /* 0x00b6 */
    "EM_SCROLLCARET",           /* 0x00b7 */
    "EM_GETMODIFY",             /* 0x00b8 */
    "EM_SETMODIFY",             /* 0x00b9 */
    "EM_GETLINECOUNT",          /* 0x00ba */
    "EM_LINEINDEX",             /* 0x00bb */
    "EM_SETHANDLE",             /* 0x00bc */
    "EM_GETHANDLE",             /* 0x00bd */
    "EM_GETTHUMB",              /* 0x00be */
Alexandre Julliard's avatar
Alexandre Julliard committed
211
    NULL,                       /* 0x00bf */
Alexandre Julliard's avatar
Alexandre Julliard committed
212

Alexandre Julliard's avatar
Alexandre Julliard committed
213
    NULL,                       /* 0x00c0 */
214 215
    "EM_LINELENGTH",            /* 0x00c1 */
    "EM_REPLACESEL",            /* 0x00c2 */
Alexandre Julliard's avatar
Alexandre Julliard committed
216
    NULL,                       /* 0x00c3 */
217 218 219 220 221 222
    "EM_GETLINE",               /* 0x00c4 */
    "EM_LIMITTEXT",             /* 0x00c5 */
    "EM_CANUNDO",               /* 0x00c6 */
    "EM_UNDO",                  /* 0x00c7 */
    "EM_FMTLINES",              /* 0x00c8 */
    "EM_LINEFROMCHAR",          /* 0x00c9 */
Alexandre Julliard's avatar
Alexandre Julliard committed
223
    NULL,                       /* 0x00ca */
224 225 226 227 228
    "EM_SETTABSTOPS",           /* 0x00cb */
    "EM_SETPASSWORDCHAR",       /* 0x00cc */
    "EM_EMPTYUNDOBUFFER",       /* 0x00cd */
    "EM_GETFIRSTVISIBLELINE",   /* 0x00ce */
    "EM_SETREADONLY",           /* 0x00cf */
Alexandre Julliard's avatar
Alexandre Julliard committed
229

230 231 232 233 234 235 236 237
    "EM_SETWORDBREAKPROC",      /* 0x00d0 */
    "EM_GETWORDBREAKPROC",      /* 0x00d1 */
    "EM_GETPASSWORDCHAR",       /* 0x00d2 */
    "EM_SETMARGINS",            /* 0x00d3 */
    "EM_GETMARGINS",            /* 0x00d4 */
    "EM_GETLIMITTEXT",          /* 0x00d5 */
    "EM_POSFROMCHAR",           /* 0x00d6 */
    "EM_CHARFROMPOS",           /* 0x00d7 */
238 239 240
    "EM_SETIMESTATUS",          /* 0x00d8 */
    "EM_GETIMESTATUS",          /* 0x00d9 */
    NULL, NULL, NULL, NULL, NULL, NULL,
Alexandre Julliard's avatar
Alexandre Julliard committed
241

Alexandre Julliard's avatar
Alexandre Julliard committed
242
    /* 0x00E0 - Win32 Scrollbars */
243 244 245 246 247
    "SBM_SETPOS",               /* 0x00e0 */
    "SBM_GETPOS",               /* 0x00e1 */
    "SBM_SETRANGE",             /* 0x00e2 */
    "SBM_GETRANGE",             /* 0x00e3 */
    "SBM_ENABLE_ARROWS",        /* 0x00e4 */
Alexandre Julliard's avatar
Alexandre Julliard committed
248
    NULL,
249
    "SBM_SETRANGEREDRAW",       /* 0x00e6 */
Alexandre Julliard's avatar
Alexandre Julliard committed
250
    NULL, NULL,
251 252
    "SBM_SETSCROLLINFO",        /* 0x00e9 */
    "SBM_GETSCROLLINFO",        /* 0x00ea */
Alexandre Julliard's avatar
Alexandre Julliard committed
253
    NULL, NULL, NULL, NULL, NULL,
Alexandre Julliard's avatar
Alexandre Julliard committed
254

Alexandre Julliard's avatar
Alexandre Julliard committed
255
    /* 0x00F0 - Win32 Buttons */
256 257 258 259 260 261 262 263
    "BM_GETCHECK",              /* 0x00f0 */
    "BM_SETCHECK",              /* 0x00f1 */
    "BM_GETSTATE",              /* 0x00f2 */
    "BM_SETSTATE",              /* 0x00f3 */
    "BM_SETSTYLE",              /* 0x00f4 */
    "BM_CLICK",                 /* 0x00f5 */
    "BM_GETIMAGE",              /* 0x00f6 */
    "BM_SETIMAGE",              /* 0x00f7 */
264 265 266
    NULL, NULL, NULL, NULL, NULL, NULL,
    "WM_INPUT_DEVICE_CHANGE",   /* 0x00fe */
    "WM_INPUT",                 /* 0x00ff */
Alexandre Julliard's avatar
Alexandre Julliard committed
267

268 269 270 271 272 273 274 275
    "WM_KEYDOWN",               /* 0x0100 */
    "WM_KEYUP",                 /* 0x0101 */
    "WM_CHAR",                  /* 0x0102 */
    "WM_DEADCHAR",              /* 0x0103 */
    "WM_SYSKEYDOWN",            /* 0x0104 */
    "WM_SYSKEYUP",              /* 0x0105 */
    "WM_SYSCHAR",               /* 0x0106 */
    "WM_SYSDEADCHAR",           /* 0x0107 */
276
    NULL,
277 278 279 280
    "WM_UNICHAR",               /* 0x0109 */
    "WM_CONVERTREQUEST",        /* 0x010a */
    "WM_CONVERTRESULT",         /* 0x010b */
    "WM_INTERIM",               /* 0x010c */
281 282 283 284 285 286 287 288 289 290
    "WM_IME_STARTCOMPOSITION",  /* 0x010d */
    "WM_IME_ENDCOMPOSITION",    /* 0x010e */
    "WM_IME_COMPOSITION",       /* 0x010f */

    "WM_INITDIALOG",            /* 0x0110 */
    "WM_COMMAND",               /* 0x0111 */
    "WM_SYSCOMMAND",            /* 0x0112 */
    "WM_TIMER",                 /* 0x0113 */
    "WM_HSCROLL",               /* 0x0114 */
    "WM_VSCROLL",               /* 0x0115 */
Alexandre Julliard's avatar
Alexandre Julliard committed
291 292
    "WM_INITMENU",              /* 0x0116 */
    "WM_INITMENUPOPUP",         /* 0x0117 */
293
    "WM_SYSTIMER",              /* 0x0118 */
Alexandre Julliard's avatar
Alexandre Julliard committed
294 295
    NULL, NULL, NULL, NULL, NULL, NULL,
    "WM_MENUSELECT",            /* 0x011f */
Alexandre Julliard's avatar
Alexandre Julliard committed
296

Alexandre Julliard's avatar
Alexandre Julliard committed
297 298
    "WM_MENUCHAR",              /* 0x0120 */
    "WM_ENTERIDLE",             /* 0x0121 */
299 300 301 302 303 304 305 306 307 308

    "WM_MENURBUTTONUP",         /* 0x0122 */
    "WM_MENUDRAG",              /* 0x0123 */
    "WM_MENUGETOBJECT",         /* 0x0124 */
    "WM_UNINITMENUPOPUP",       /* 0x0125 */
    "WM_MENUCOMMAND",           /* 0x0126 */
    "WM_CHANGEUISTATE",         /* 0x0127 */
    "WM_UPDATEUISTATE",         /* 0x0128 */
    "WM_QUERYUISTATE",          /* 0x0129 */

Alexandre Julliard's avatar
Alexandre Julliard committed
309
    NULL, NULL, NULL, NULL, NULL, NULL,
Alexandre Julliard's avatar
Alexandre Julliard committed
310 311

    /* 0x0130 */
Alexandre Julliard's avatar
Alexandre Julliard committed
312
    NULL,
313
    "WM_LBTRACKPOINT",          /* 0x0131 */
Alexandre Julliard's avatar
Alexandre Julliard committed
314 315 316 317 318 319 320 321
    "WM_CTLCOLORMSGBOX",        /* 0x0132 */
    "WM_CTLCOLOREDIT",          /* 0x0133 */
    "WM_CTLCOLORLISTBOX",       /* 0x0134 */
    "WM_CTLCOLORBTN",           /* 0x0135 */
    "WM_CTLCOLORDLG",           /* 0x0136 */
    "WM_CTLCOLORSCROLLBAR",     /* 0x0137 */
    "WM_CTLCOLORSTATIC",        /* 0x0138 */
    NULL, NULL, NULL, NULL, NULL, NULL, NULL,
Alexandre Julliard's avatar
Alexandre Julliard committed
322

Alexandre Julliard's avatar
Alexandre Julliard committed
323
    /* 0x0140 - Win32 Comboboxes */
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339
    "CB_GETEDITSEL",            /* 0x0140 */
    "CB_LIMITTEXT",             /* 0x0141 */
    "CB_SETEDITSEL",            /* 0x0142 */
    "CB_ADDSTRING",             /* 0x0143 */
    "CB_DELETESTRING",          /* 0x0144 */
    "CB_DIR",                   /* 0x0145 */
    "CB_GETCOUNT",              /* 0x0146 */
    "CB_GETCURSEL",             /* 0x0147 */
    "CB_GETLBTEXT",             /* 0x0148 */
    "CB_GETLBTEXTLEN",          /* 0x0149 */
    "CB_INSERTSTRING",          /* 0x014a */
    "CB_RESETCONTENT",          /* 0x014b */
    "CB_FINDSTRING",            /* 0x014c */
    "CB_SELECTSTRING",          /* 0x014d */
    "CB_SETCURSEL",             /* 0x014e */
    "CB_SHOWDROPDOWN",          /* 0x014f */
Alexandre Julliard's avatar
Alexandre Julliard committed
340

341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356
    "CB_GETITEMDATA",           /* 0x0150 */
    "CB_SETITEMDATA",           /* 0x0151 */
    "CB_GETDROPPEDCONTROLRECT", /* 0x0152 */
    "CB_SETITEMHEIGHT",         /* 0x0153 */
    "CB_GETITEMHEIGHT",         /* 0x0154 */
    "CB_SETEXTENDEDUI",         /* 0x0155 */
    "CB_GETEXTENDEDUI",         /* 0x0156 */
    "CB_GETDROPPEDSTATE",       /* 0x0157 */
    "CB_FINDSTRINGEXACT",       /* 0x0158 */
    "CB_SETLOCALE",             /* 0x0159 */
    "CB_GETLOCALE",             /* 0x015a */
    "CB_GETTOPINDEX",           /* 0x015b */
    "CB_SETTOPINDEX",           /* 0x015c */
    "CB_GETHORIZONTALEXTENT",   /* 0x015d */
    "CB_SETHORIZONTALEXTENT",   /* 0x015e */
    "CB_GETDROPPEDWIDTH",       /* 0x015f */
Alexandre Julliard's avatar
Alexandre Julliard committed
357

358 359
    "CB_SETDROPPEDWIDTH",       /* 0x0160 */
    "CB_INITSTORAGE",           /* 0x0161 */
Alexandre Julliard's avatar
Alexandre Julliard committed
360
    NULL, NULL, NULL, NULL, NULL, NULL,
Alexandre Julliard's avatar
Alexandre Julliard committed
361 362
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,

Alexandre Julliard's avatar
Alexandre Julliard committed
363
    /* 0x0170 - Win32 Static controls */
364 365 366 367 368
    "STM_SETICON",              /* 0x0170 */
    "STM_GETICON",              /* 0x0171 */
    "STM_SETIMAGE",             /* 0x0172 */
    "STM_GETIMAGE",             /* 0x0173 */
    NULL, NULL, NULL, NULL,
Alexandre Julliard's avatar
Alexandre Julliard committed
369 370
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,

Alexandre Julliard's avatar
Alexandre Julliard committed
371
    /* 0x0180 - Win32 Listboxes */
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387
    "LB_ADDSTRING",             /* 0x0180 */
    "LB_INSERTSTRING",          /* 0x0181 */
    "LB_DELETESTRING",          /* 0x0182 */
    "LB_SELITEMRANGEEX",        /* 0x0183 */
    "LB_RESETCONTENT",          /* 0x0184 */
    "LB_SETSEL",                /* 0x0185 */
    "LB_SETCURSEL",             /* 0x0186 */
    "LB_GETSEL",                /* 0x0187 */
    "LB_GETCURSEL",             /* 0x0188 */
    "LB_GETTEXT",               /* 0x0189 */
    "LB_GETTEXTLEN",            /* 0x018a */
    "LB_GETCOUNT",              /* 0x018b */
    "LB_SELECTSTRING",          /* 0x018c */
    "LB_DIR",                   /* 0x018d */
    "LB_GETTOPINDEX",           /* 0x018e */
    "LB_FINDSTRING",            /* 0x018f */
Alexandre Julliard's avatar
Alexandre Julliard committed
388

389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404
    "LB_GETSELCOUNT",           /* 0x0190 */
    "LB_GETSELITEMS",           /* 0x0191 */
    "LB_SETTABSTOPS",           /* 0x0192 */
    "LB_GETHORIZONTALEXTENT",   /* 0x0193 */
    "LB_SETHORIZONTALEXTENT",   /* 0x0194 */
    "LB_SETCOLUMNWIDTH",        /* 0x0195 */
    "LB_ADDFILE",               /* 0x0196 */
    "LB_SETTOPINDEX",           /* 0x0197 */
    "LB_GETITEMRECT",           /* 0x0198 */
    "LB_GETITEMDATA",           /* 0x0199 */
    "LB_SETITEMDATA",           /* 0x019a */
    "LB_SELITEMRANGE",          /* 0x019b */
    "LB_SETANCHORINDEX",        /* 0x019c */
    "LB_GETANCHORINDEX",        /* 0x019d */
    "LB_SETCARETINDEX",         /* 0x019e */
    "LB_GETCARETINDEX",         /* 0x019f */
Alexandre Julliard's avatar
Alexandre Julliard committed
405

406 407 408 409 410 411 412 413 414 415
    "LB_SETITEMHEIGHT",         /* 0x01a0 */
    "LB_GETITEMHEIGHT",         /* 0x01a1 */
    "LB_FINDSTRINGEXACT",       /* 0x01a2 */
    "LB_CARETON",               /* 0x01a3 */
    "LB_CARETOFF",              /* 0x01a4 */
    "LB_SETLOCALE",             /* 0x01a5 */
    "LB_GETLOCALE",             /* 0x01a6 */
    "LB_SETCOUNT",              /* 0x01a7 */
    "LB_INITSTORAGE",           /* 0x01a8 */
    "LB_ITEMFROMPOINT",         /* 0x01a9 */
Alexandre Julliard's avatar
Alexandre Julliard committed
416
    NULL, NULL, NULL, NULL, NULL, NULL,
Alexandre Julliard's avatar
Alexandre Julliard committed
417 418

    /* 0x01B0 */
419 420 421
    NULL, NULL,
    "LB_GETLISTBOXINFO",         /* 0x01b2 */
    NULL, NULL, NULL, NULL, NULL,
Alexandre Julliard's avatar
Alexandre Julliard committed
422 423 424 425 426 427 428 429 430 431 432
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,

    /* 0x01C0 */
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,

    /* 0x01D0 */
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,

    /* 0x01E0 */
433 434 435
    NULL,
    "MN_GETHMENU",              /* 0x01E1 */
    NULL, NULL, NULL, NULL, NULL, NULL,
Alexandre Julliard's avatar
Alexandre Julliard committed
436 437 438 439 440 441
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,

    /* 0x01F0 */
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,

442 443 444 445 446 447 448 449 450 451
    "WM_MOUSEMOVE",             /* 0x0200 */
    "WM_LBUTTONDOWN",           /* 0x0201 */
    "WM_LBUTTONUP",             /* 0x0202 */
    "WM_LBUTTONDBLCLK",         /* 0x0203 */
    "WM_RBUTTONDOWN",           /* 0x0204 */
    "WM_RBUTTONUP",             /* 0x0205 */
    "WM_RBUTTONDBLCLK",         /* 0x0206 */
    "WM_MBUTTONDOWN",           /* 0x0207 */
    "WM_MBUTTONUP",             /* 0x0208 */
    "WM_MBUTTONDBLCLK",         /* 0x0209 */
452
    "WM_MOUSEWHEEL",            /* 0x020A */
453 454 455
    "WM_XBUTTONDOWN",           /* 0x020B */
    "WM_XBUTTONUP",             /* 0x020C */
    "WM_XBUTTONDBLCLK",         /* 0x020D */
456 457
    "WM_MOUSEHWHEEL",           /* 0x020E */
    NULL,
Alexandre Julliard's avatar
Alexandre Julliard committed
458

459
    "WM_PARENTNOTIFY",          /* 0x0210 */
Alexandre Julliard's avatar
Alexandre Julliard committed
460 461
    "WM_ENTERMENULOOP",         /* 0x0211 */
    "WM_EXITMENULOOP",          /* 0x0212 */
462
    "WM_NEXTMENU",              /* 0x0213 */
463
    "WM_SIZING",
Alexandre Julliard's avatar
Alexandre Julliard committed
464 465
    "WM_CAPTURECHANGED",
    "WM_MOVING", NULL,
466
    "WM_POWERBROADCAST",
Alexandre Julliard's avatar
Alexandre Julliard committed
467
    "WM_DEVICECHANGE", NULL, NULL, NULL, NULL, NULL, NULL,
Alexandre Julliard's avatar
Alexandre Julliard committed
468 469 470 471 472 473 474 475 476 477 478 479

    "WM_MDICREATE",             /* 0x0220 */
    "WM_MDIDESTROY",            /* 0x0221 */
    "WM_MDIACTIVATE",           /* 0x0222 */
    "WM_MDIRESTORE",            /* 0x0223 */
    "WM_MDINEXT",               /* 0x0224 */
    "WM_MDIMAXIMIZE",           /* 0x0225 */
    "WM_MDITILE",               /* 0x0226 */
    "WM_MDICASCADE",            /* 0x0227 */
    "WM_MDIICONARRANGE",        /* 0x0228 */
    "WM_MDIGETACTIVE",          /* 0x0229 */

480 481
    "WM_DROPOBJECT",
    "WM_QUERYDROPOBJECT",
482 483 484 485
    "WM_BEGINDRAG",
    "WM_DRAGLOOP",
    "WM_DRAGSELECT",
    "WM_DRAGMOVE",
486

Alexandre Julliard's avatar
Alexandre Julliard committed
487
    /* 0x0230*/
Alexandre Julliard's avatar
Alexandre Julliard committed
488
    "WM_MDISETMENU",            /* 0x0230 */
489 490 491
    "WM_ENTERSIZEMOVE",         /* 0x0231 */
    "WM_EXITSIZEMOVE",          /* 0x0232 */
    "WM_DROPFILES",             /* 0x0233 */
492
    "WM_MDIREFRESHMENU", NULL, NULL, NULL,
Alexandre Julliard's avatar
Alexandre Julliard committed
493 494
    /* 0x0238*/
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
495

Alexandre Julliard's avatar
Alexandre Julliard committed
496 497 498 499 500 501 502
    /* 0x0240 */
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,

    /* 0x0250 */
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
503

Alexandre Julliard's avatar
Alexandre Julliard committed
504 505 506 507 508 509 510
    /* 0x0260 */
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,

    /* 0x0280 */
511 512 513 514 515 516 517 518 519 520 521 522 523
    NULL,
    "WM_IME_SETCONTEXT",        /* 0x0281 */
    "WM_IME_NOTIFY",            /* 0x0282 */
    "WM_IME_CONTROL",           /* 0x0283 */
    "WM_IME_COMPOSITIONFULL",   /* 0x0284 */
    "WM_IME_SELECT",            /* 0x0285 */
    "WM_IME_CHAR",              /* 0x0286 */
    NULL,
    "WM_IME_REQUEST",           /* 0x0288 */
    NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    "WM_IME_KEYDOWN",           /* 0x0290 */
    "WM_IME_KEYUP",             /* 0x0291 */
    NULL, NULL, NULL, NULL, NULL, NULL,
Alexandre Julliard's avatar
Alexandre Julliard committed
524 525
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,

526
    /* 0x02a0 */
527 528 529 530 531 532 533
    "WM_NCMOUSEHOVER",          /* 0x02A0 */
    "WM_MOUSEHOVER",            /* 0x02A1 */
    "WM_NCMOUSELEAVE",          /* 0x02A2 */
    "WM_MOUSELEAVE",            /* 0x02A3 */
    NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    "WM_WTSSESSION_CHANGE",     /* 0x02B1 */
Alexandre Julliard's avatar
Alexandre Julliard committed
534
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
535
    NULL, NULL, NULL, NULL, NULL, NULL,
Alexandre Julliard's avatar
Alexandre Julliard committed
536 537

    /* 0x02c0 */
538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569
    "WM_TABLET_FIRST",          /* 0x02c0 */
    "WM_TABLET_FIRST+1",        /* 0x02c1 */
    "WM_TABLET_FIRST+2",        /* 0x02c2 */
    "WM_TABLET_FIRST+3",        /* 0x02c3 */
    "WM_TABLET_FIRST+4",        /* 0x02c4 */
    "WM_TABLET_FIRST+5",        /* 0x02c5 */
    "WM_TABLET_FIRST+7",        /* 0x02c6 */
    "WM_TABLET_FIRST+8",        /* 0x02c7 */
    "WM_TABLET_FIRST+9",        /* 0x02c8 */
    "WM_TABLET_FIRST+10",       /* 0x02c9 */
    "WM_TABLET_FIRST+11",       /* 0x02ca */
    "WM_TABLET_FIRST+12",       /* 0x02cb */
    "WM_TABLET_FIRST+13",       /* 0x02cc */
    "WM_TABLET_FIRST+14",       /* 0x02cd */
    "WM_TABLET_FIRST+15",       /* 0x02ce */
    "WM_TABLET_FIRST+16",       /* 0x02cf */
    "WM_TABLET_FIRST+17",       /* 0x02d0 */
    "WM_TABLET_FIRST+18",       /* 0x02d1 */
    "WM_TABLET_FIRST+19",       /* 0x02d2 */
    "WM_TABLET_FIRST+20",       /* 0x02d3 */
    "WM_TABLET_FIRST+21",       /* 0x02d4 */
    "WM_TABLET_FIRST+22",       /* 0x02d5 */
    "WM_TABLET_FIRST+23",       /* 0x02d6 */
    "WM_TABLET_FIRST+24",       /* 0x02d7 */
    "WM_TABLET_FIRST+25",       /* 0x02d8 */
    "WM_TABLET_FIRST+26",       /* 0x02d9 */
    "WM_TABLET_FIRST+27",       /* 0x02da */
    "WM_TABLET_FIRST+28",       /* 0x02db */
    "WM_TABLET_FIRST+29",       /* 0x02dc */
    "WM_TABLET_FIRST+30",       /* 0x02dd */
    "WM_TABLET_FIRST+31",       /* 0x02de */
    "WM_TABLET_LAST",           /* 0x02df */
Alexandre Julliard's avatar
Alexandre Julliard committed
570 571 572 573 574 575

    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,

576
    "WM_CUT",                   /* 0x0300 */
577 578 579 580 581 582
    "WM_COPY",
    "WM_PASTE",
    "WM_CLEAR",
    "WM_UNDO",
    "WM_RENDERFORMAT",
    "WM_RENDERALLFORMATS",
Alexandre Julliard's avatar
Alexandre Julliard committed
583
    "WM_DESTROYCLIPBOARD",
584 585 586 587 588
    "WM_DRAWCLIPBOARD",
    "WM_PAINTCLIPBOARD",
    "WM_VSCROLLCLIPBOARD",
    "WM_SIZECLIPBOARD",
    "WM_ASKCBFORMATNAME",
Alexandre Julliard's avatar
Alexandre Julliard committed
589 590
    "WM_CHANGECBCHAIN",
    "WM_HSCROLLCLIPBOARD",
591
    "WM_QUERYNEWPALETTE",       /* 0x030f*/
Alexandre Julliard's avatar
Alexandre Julliard committed
592 593

    "WM_PALETTEISCHANGING",
Alexandre Julliard's avatar
Alexandre Julliard committed
594
    "WM_PALETTECHANGED",
595
    "WM_HOTKEY",                /* 0x0312 */
596 597
    "WM_POPUPSYSTEMMENU",       /* 0x0313 */
    NULL, NULL, NULL,
598 599 600 601
    "WM_PRINT",                 /* 0x0317 */
    "WM_PRINTCLIENT",           /* 0x0318 */
    "WM_APPCOMMAND",            /* 0x0319 */
    "WM_THEMECHANGED",          /* 0x031A */
602 603 604 605
    NULL, NULL,
    "WM_CLIPBOARDUPDATE",       /* 0x031D */
    "WM_DWMCOMPOSITIONCHANGED", /* 0x031E */
    "WM_DWMNCRENDERINGCHANGED", /* 0x031F */
Alexandre Julliard's avatar
Alexandre Julliard committed
606

607 608 609
    "WM_DWMCOLORIZATIONCOLORCHANGED", /* 0x0320 */
    "WM_DWMWINDOWMAXIMIZEDCHANGE", /* 0x0321 */
    NULL, NULL, NULL, NULL, NULL, NULL,
Alexandre Julliard's avatar
Alexandre Julliard committed
610
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
611

Alexandre Julliard's avatar
Alexandre Julliard committed
612
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
613 614
    NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    "WM_GETTITLEBARINFOEX",     /* 0x033F */
Alexandre Julliard's avatar
Alexandre Julliard committed
615 616 617 618

    /* 0x0340 */
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
619
    /* 0x0350 */
Alexandre Julliard's avatar
Alexandre Julliard committed
620
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
621 622 623 624 625 626 627 628
    "WM_HANDHELDFIRST",     /* 0x0358 */
    "WM_HANDHELDFIRST+1",   /* 0x0359 */
    "WM_HANDHELDFIRST+2",   /* 0x035A */
    "WM_HANDHELDFIRST+3",   /* 0x035B */
    "WM_HANDHELDFIRST+4",   /* 0x035C */
    "WM_HANDHELDFIRST+5",   /* 0x035D */
    "WM_HANDHELDFIRST+6",   /* 0x035E */
    "WM_HANDHELDLAST",      /* 0x035F */
Alexandre Julliard's avatar
Alexandre Julliard committed
629

630
    "WM_QUERYAFXWNDPROC",   /*  0x0360 WM_AFXFIRST */
Alexandre Julliard's avatar
Alexandre Julliard committed
631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656
    "WM_SIZEPARENT",        /*  0x0361 */
    "WM_SETMESSAGESTRING",  /*  0x0362 */
    "WM_IDLEUPDATECMDUI",   /*  0x0363 */
    "WM_INITIALUPDATE",     /*  0x0364 */
    "WM_COMMANDHELP",       /*  0x0365 */
    "WM_HELPHITTEST",       /*  0x0366 */
    "WM_EXITHELPMODE",      /*  0x0367 */
    "WM_RECALCPARENT",      /*  0x0368 */
    "WM_SIZECHILD",         /*  0x0369 */
    "WM_KICKIDLE",          /*  0x036A */
    "WM_QUERYCENTERWND",    /*  0x036B */
    "WM_DISABLEMODAL",      /*  0x036C */
    "WM_FLOATSTATUS",       /*  0x036D */
    "WM_ACTIVATETOPLEVEL",  /*  0x036E */
    "WM_QUERY3DCONTROLS",   /*  0x036F */
    NULL,NULL,NULL,
    "WM_SOCKET_NOTIFY",     /*  0x0373 */
    "WM_SOCKET_DEAD",       /*  0x0374 */
    "WM_POPMESSAGESTRING",  /*  0x0375 */
    "WM_OCC_LOADFROMSTREAM",     /* 0x0376 */
    "WM_OCC_LOADFROMSTORAGE",    /* 0x0377 */
    "WM_OCC_INITNEW",            /* 0x0378 */
    "WM_QUEUE_SENTINEL",         /* 0x0379 */
    "WM_OCC_LOADFROMSTREAM_EX",  /* 0x037A */
    "WM_OCC_LOADFROMSTORAGE_EX", /* 0x037B */

657 658
    NULL,NULL,NULL,
    "WM_AFXLAST",               /* 0x037F */
Alexandre Julliard's avatar
Alexandre Julliard committed
659

660 661 662 663 664 665 666 667 668 669 670 671 672 673
    "WM_PENWINFIRST",           /* 0x0380 */
    "WM_RCRESULT",              /* 0x0381 */
    "WM_HOOKRCRESULT",          /* 0x0382 */
    "WM_GLOBALRCCHANGE",        /* 0x0383 */
    "WM_SKB",                   /* 0x0384 */
    "WM_HEDITCTL",              /* 0x0385 */
    NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    "WM_PENWINLAST",            /* 0x038F */

    "WM_COALESCE_FIRST",        /* 0x0390 */
    NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    "WM_COALESCE_LAST",         /* 0x039F */
674

Alexandre Julliard's avatar
Alexandre Julliard committed
675
    /* 0x03a0 */
676 677 678 679
    "MM_JOY1MOVE",
    "MM_JOY2MOVE",
    "MM_JOY1ZMOVE",
    "MM_JOY2ZMOVE",
Alexandre Julliard's avatar
Alexandre Julliard committed
680 681 682 683
                            NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,

    /* 0x03b0 */
684 685 686
    NULL, NULL, NULL, NULL, NULL,
    "MM_JOY1BUTTONDOWN",
    "MM_JOY2BUTTONDOWN",
Alexandre Julliard's avatar
Alexandre Julliard committed
687 688
    "MM_JOY1BUTTONUP",
    "MM_JOY2BUTTONUP",
689
    "MM_MCINOTIFY",       /* 0x03B9 */
690
                NULL,
691 692 693 694 695
    "MM_WOM_OPEN",        /* 0x03BB */
    "MM_WOM_CLOSE",       /* 0x03BC */
    "MM_WOM_DONE",        /* 0x03BD */
    "MM_WIM_OPEN",        /* 0x03BE */
    "MM_WIM_CLOSE",       /* 0x03BF */
Alexandre Julliard's avatar
Alexandre Julliard committed
696 697

    /* 0x03c0 */
698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715
    "MM_WIM_DATA",        /* 0x03C0 */
    "MM_MIM_OPEN",        /* 0x03C1 */
    "MM_MIM_CLOSE",       /* 0x03C2 */
    "MM_MIM_DATA",        /* 0x03C3 */
    "MM_MIM_LONGDATA",    /* 0x03C4 */
    "MM_MIM_ERROR",       /* 0x03C5 */
    "MM_MIM_LONGERROR",   /* 0x03C6 */
    "MM_MOM_OPEN",        /* 0x03C7 */
    "MM_MOM_CLOSE",       /* 0x03C8 */
    "MM_MOM_DONE",        /* 0x03C9 */
    "MM_MOM_POSITIONCB",  /* 0x03CA */
    "MM_MCISIGNAL",       /* 0x03CB */
    "MM_MIM_MOREDATA",    /* 0x03CC */
                                  NULL, NULL, NULL,

    /* 0x03d0 */
    "MM_MIXM_LINE_CHANGE",
    "MM_MIXM_CONTROL_CHANGE",
Alexandre Julliard's avatar
Alexandre Julliard committed
716
                NULL, NULL, NULL, NULL, NULL, NULL,
Alexandre Julliard's avatar
Alexandre Julliard committed
717 718 719 720
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,

    /* 0x03e0 */
    "WM_DDE_INITIATE",  /* 0x3E0 */
721 722 723 724 725 726 727 728
    "WM_DDE_TERMINATE", /* 0x3E1 */
    "WM_DDE_ADVISE",    /* 0x3E2 */
    "WM_DDE_UNADVISE",  /* 0x3E3 */
    "WM_DDE_ACK",       /* 0x3E4 */
    "WM_DDE_DATA",      /* 0x3E5 */
    "WM_DDE_REQUEST",   /* 0x3E6 */
    "WM_DDE_POKE",      /* 0x3E7 */
    "WM_DDE_EXECUTE",   /* 0x3E8 */
Alexandre Julliard's avatar
Alexandre Julliard committed
729 730
    NULL, NULL, NULL, NULL, NULL, NULL, NULL,

731

Alexandre Julliard's avatar
Alexandre Julliard committed
732 733 734 735
    /* 0x03f0 */
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,

736
    "WM_USER"                   /* 0x0400 */
Alexandre Julliard's avatar
Alexandre Julliard committed
737 738
};

Alexandre Julliard's avatar
Alexandre Julliard committed
739

740
#define SPY_MAX_LVMMSGNUM   182
741 742
static const char * const LVMMessageTypeNames[SPY_MAX_LVMMSGNUM + 1] =
{
743
    "LVM_GETBKCOLOR",           /* 1000 */
744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774
    "LVM_SETBKCOLOR",
    "LVM_GETIMAGELIST",
    "LVM_SETIMAGELIST",
    "LVM_GETITEMCOUNT",
    "LVM_GETITEMA",
    "LVM_SETITEMA",
    "LVM_INSERTITEMA",
    "LVM_DELETEITEM",
    "LVM_DELETEALLITEMS",
    "LVM_GETCALLBACKMASK",
    "LVM_SETCALLBACKMASK",
    "LVM_GETNEXTITEM",
    "LVM_FINDITEMA",
    "LVM_GETITEMRECT",
    "LVM_SETITEMPOSITION",
    "LVM_GETITEMPOSITION",
    "LVM_GETSTRINGWIDTHA",
    "LVM_HITTEST",
    "LVM_ENSUREVISIBLE",
    "LVM_SCROLL",
    "LVM_REDRAWITEMS",
    "LVM_ARRANGE",
    "LVM_EDITLABELA",
    "LVM_GETEDITCONTROL",
    "LVM_GETCOLUMNA",
    "LVM_SETCOLUMNA",
    "LVM_INSERTCOLUMNA",
    "LVM_DELETECOLUMN",
    "LVM_GETCOLUMNWIDTH",
    "LVM_SETCOLUMNWIDTH",
    "LVM_GETHEADER",
775
    NULL,
776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881
    "LVM_CREATEDRAGIMAGE",
    "LVM_GETVIEWRECT",
    "LVM_GETTEXTCOLOR",
    "LVM_SETTEXTCOLOR",
    "LVM_GETTEXTBKCOLOR",
    "LVM_SETTEXTBKCOLOR",
    "LVM_GETTOPINDEX",
    "LVM_GETCOUNTPERPAGE",
    "LVM_GETORIGIN",
    "LVM_UPDATE",
    "LVM_SETITEMSTATE",
    "LVM_GETITEMSTATE",
    "LVM_GETITEMTEXTA",
    "LVM_SETITEMTEXTA",
    "LVM_SETITEMCOUNT",
    "LVM_SORTITEMS",
    "LVM_SETITEMPOSITION32",
    "LVM_GETSELECTEDCOUNT",
    "LVM_GETITEMSPACING",
    "LVM_GETISEARCHSTRINGA",
    "LVM_SETICONSPACING",
    "LVM_SETEXTENDEDLISTVIEWSTYLE",
    "LVM_GETEXTENDEDLISTVIEWSTYLE",
    "LVM_GETSUBITEMRECT",
    "LVM_SUBITEMHITTEST",
    "LVM_SETCOLUMNORDERARRAY",
    "LVM_GETCOLUMNORDERARRAY",
    "LVM_SETHOTITEM",
    "LVM_GETHOTITEM",
    "LVM_SETHOTCURSOR",
    "LVM_GETHOTCURSOR",
    "LVM_APPROXIMATEVIEWRECT",
    "LVM_SETWORKAREAS",
    "LVM_GETSELECTIONMARK",
    "LVM_SETSELECTIONMARK",
    "LVM_SETBKIMAGEA",
    "LVM_GETBKIMAGEA",
    "LVM_GETWORKAREAS",
    "LVM_SETHOVERTIME",
    "LVM_GETHOVERTIME",
    "LVM_GETNUMBEROFWORKAREAS",
    "LVM_SETTOOLTIPS",
    "LVM_GETITEMW",
    "LVM_SETITEMW",
    "LVM_INSERTITEMW",
    "LVM_GETTOOLTIPS",
    NULL,
    NULL,
    NULL,
    NULL,
    "LVM_FINDITEMW",
    NULL,
    NULL,
    NULL,
    "LVM_GETSTRINGWIDTHW",
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    "LVM_GETCOLUMNW",
    "LVM_SETCOLUMNW",
    "LVM_INSERTCOLUMNW",
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    "LVM_GETITEMTEXTW",
    "LVM_SETITEMTEXTW",
    "LVM_GETISEARCHSTRINGW",
    "LVM_EDITLABELW",
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    "LVM_SETBKIMAGEW",
882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925
    "LVM_GETBKIMAGEW",   /* 0x108B */
    "LVM_SETSELECTEDCOLUMN",
    "LVM_SETTILEWIDTH",
    "LVM_SETVIEW",
    "LVM_GETVIEW",
    NULL,
    "LVM_INSERTGROUP",
    NULL,
    "LVM_SETGROUPINFO",
    NULL,
    "LVM_GETGROUPINFO",
    "LVM_REMOVEGROUP",
    "LVM_MOVEGROUP",
    NULL,
    NULL,
    "LVM_MOVEITEMTOGROUP",
    "LVM_SETGROUPMETRICS",
    "LVM_GETGROUPMETRICS",
    "LVM_ENABLEGROUPVIEW",
    "LVM_SORTGROUPS",
    "LVM_INSERTGROUPSORTED",
    "LVM_REMOVEALLGROUPS",
    "LVM_HASGROUP",
    "LVM_SETTILEVIEWINFO",
    "LVM_GETTILEVIEWINFO",
    "LVM_SETTILEINFO",
    "LVM_GETTILEINFO",
    "LVM_SETINSERTMARK",
    "LVM_GETINSERTMARK",
    "LVM_INSERTMARKHITTEST",
    "LVM_GETINSERTMARKRECT",
    "LVM_SETINSERTMARKCOLOR",
    "LVM_GETINSERTMARKCOLOR",
    NULL,
    "LVM_SETINFOTIP",
    "LVM_GETSELECTEDCOLUMN",
    "LVM_ISGROUPVIEWENABLED",
    "LVM_GETOUTLINECOLOR",
    "LVM_SETOUTLINECOLOR",
    NULL,
    "LVM_CANCELEDITLABEL",
    "LVM_MAPINDEXTOID",
    "LVM_MAPIDTOINDEX",
    "LVM_ISITEMVISIBLE"
926 927
};

928 929 930 931

#define SPY_MAX_TVMSGNUM   65
static const char * const TVMessageTypeNames[SPY_MAX_TVMSGNUM + 1] =
{
932
    "TVM_INSERTITEMA",          /* 1100 */
933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003
    "TVM_DELETEITEM",
    "TVM_EXPAND",
    NULL,
    "TVM_GETITEMRECT",
    "TVM_GETCOUNT",
    "TVM_GETINDENT",
    "TVM_SETINDENT",
    "TVM_GETIMAGELIST",
    "TVM_SETIMAGELIST",
    "TVM_GETNEXTITEM",
    "TVM_SELECTITEM",
    "TVM_GETITEMA",
    "TVM_SETITEMA",
    "TVM_EDITLABELA",
    "TVM_GETEDITCONTROL",
    "TVM_GETVISIBLECOUNT",
    "TVM_HITTEST",
    "TVM_CREATEDRAGIMAGE",
    "TVM_SORTCHILDREN",
    "TVM_ENSUREVISIBLE",
    "TVM_SORTCHILDRENCB",
    "TVM_ENDEDITLABELNOW",
    "TVM_GETISEARCHSTRINGA",
    "TVM_SETTOOLTIPS",
    "TVM_GETTOOLTIPS",
    "TVM_SETINSERTMARK",
    "TVM_SETITEMHEIGHT",
    "TVM_GETITEMHEIGHT",
    "TVM_SETBKCOLOR",
    "TVM_SETTEXTCOLOR",
    "TVM_GETBKCOLOR",
    "TVM_GETTEXTCOLOR",
    "TVM_SETSCROLLTIME",
    "TVM_GETSCROLLTIME",
    "TVM_UNKNOWN35",
    "TVM_UNKNOWN36",
    "TVM_SETINSERTMARKCOLOR",
    "TVM_GETINSERTMARKCOLOR",
    "TVM_GETITEMSTATE",
    "TVM_SETLINECOLOR",
    "TVM_GETLINECOLOR",
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    "TVM_INSERTITEMW",
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    "TVM_GETITEMW",
    "TVM_SETITEMW",
    "TVM_GETISEARCHSTRINGW",
    "TVM_EDITLABELW"
};


#define SPY_MAX_HDMMSGNUM   19
static const char * const HDMMessageTypeNames[SPY_MAX_HDMMSGNUM + 1] =
{
1004
    "HDM_GETITEMCOUNT",         /* 1200 */
1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029
    "HDM_INSERTITEMA",
    "HDM_DELETEITEM",
    "HDM_GETITEMA",
    "HDM_SETITEMA",
    "HDM_LAYOUT",
    "HDM_HITTEST",
    "HDM_GETITEMRECT",
    "HDM_SETIMAGELIST",
    "HDM_GETIMAGELIST",
    "HDM_INSERTITEMW",
    "HDM_GETITEMW",
    "HDM_SETITEMW",
    NULL,
    NULL,
    "HDM_ORDERTOINDEX",
    "HDM_CREATEDRAGIMAGE",
    "GETORDERARRAYINDEX",
    "SETORDERARRAYINDEX",
    "SETHOTDIVIDER"
};


#define SPY_MAX_TCMMSGNUM   62
static const char * const TCMMessageTypeNames[SPY_MAX_TCMMSGNUM + 1] =
{
1030
    NULL,               /* 1300 */
1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097
    NULL,
    "TCM_SETIMAGELIST",
    "TCM_GETIMAGELIST",
    "TCM_GETITEMCOUNT",
    "TCM_GETITEMA",
    "TCM_SETITEMA",
    "TCM_INSERTITEMA",
    "TCM_DELETEITEM",
    "TCM_DELETEALLITEMS",
    "TCM_GETITEMRECT",
    "TCM_GETCURSEL",
    "TCM_SETCURSEL",
    "TCM_HITTEST",
    "TCM_SETITEMEXTRA",
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    "TCM_ADJUSTRECT",
    "TCM_SETITEMSIZE",
    "TCM_REMOVEIMAGE",
    "TCM_SETPADDING",
    "TCM_GETROWCOUNT",
    "TCM_GETTOOLTIPS",
    "TCM_SETTOOLTIPS",
    "TCM_GETCURFOCUS",
    "TCM_SETCURFOCUS",
    "TCM_SETMINTABWIDTH",
    "TCM_DESELECTALL",
    "TCM_HIGHLIGHTITEM",
    "TCM_SETEXTENDEDSTYLE",
    "TCM_GETEXTENDEDSTYLE",
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    "TCM_GETITEMW",
    "TCM_SETITEMW",
    "TCM_INSERTITEMW"
};

#define SPY_MAX_PGMMSGNUM   13
static const char * const PGMMessageTypeNames[SPY_MAX_PGMMSGNUM + 1] =
{
1098
    NULL,               /* 1400 */
1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114
    "PGM_SETCHILD",
    "PGM_RECALCSIZE",
    "PGM_FORWARDMOUSE",
    "PGM_SETBKCOLOR",
    "PGM_GETBKCOLOR",
    "PGM_SETBORDER",
    "PGM_GETBORDER",
    "PGM_SETPOS",
    "PGM_GETPOS",
    "PGM_SETBUTTONSIZE",
    "PGM_GETBUTTONSIZE",
    "PGM_GETBUTTONSTATE",
    "PGM_GETDROPTARGET"
};


1115
#define SPY_MAX_CCMMSGNUM   9
1116 1117
static const char * const CCMMessageTypeNames[SPY_MAX_CCMMSGNUM + 1] =
{
1118
    NULL,               /* 0x2000 */
1119 1120 1121 1122 1123
    "CCM_SETBKCOLOR",
    "CCM_SETCOLORSCHEME",
    "CCM_GETCOLORSCHEME",
    "CCM_GETDROPTARGET",
    "CCM_SETUNICODEFORMAT",
1124 1125 1126 1127
    "CCM_GETUNICODEFORMAT",
    "CCM_SETVERSION",
    "CCM_GETVERSION",
    "CCM_SETNOTIFYWINDOW"
1128 1129
};

1130
#define SPY_MAX_WINEMSGNUM   (WM_WINE_MOUSE_LL_HOOK - WM_WINE_DESTROYWINDOW)
1131 1132 1133 1134 1135 1136 1137
static const char * const WINEMessageTypeNames[SPY_MAX_WINEMSGNUM + 1] =
{
    "WM_WINE_DESTROYWINDOW",
    "WM_WINE_SETWINDOWPOS",
    "WM_WINE_SHOWWINDOW",
    "WM_WINE_SETPARENT",
    "WM_WINE_SETWINDOWLONG",
1138 1139 1140 1141
    "WM_WINE_ENABLEWINDOW",
    "WM_WINE_SETACTIVEWINDOW",
    "WM_WINE_KEYBOARD_LL_HOOK",
    "WM_WINE_MOUSE_LL_HOOK",
1142 1143
};

1144 1145 1146 1147
/* Virtual key names */
#define SPY_MAX_VKKEYSNUM 255
static const char * const VK_KeyNames[SPY_MAX_VKKEYSNUM + 1] =
{
1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175
    NULL,               /* 0x00 */
    "VK_LBUTTON",       /* 0x01 */
    "VK_RBUTTON",       /* 0x02 */
    "VK_CANCEL",        /* 0x03 */
    "VK_MBUTTON",       /* 0x04 */
    "VK_XBUTTON1",      /* 0x05 */
    "VK_XBUTTON2",      /* 0x06 */
    NULL,               /* 0x07 */
    "VK_BACK",          /* 0x08 */
    "VK_TAB",           /* 0x09 */
    NULL,               /* 0x0A */
    NULL,               /* 0x0B */
    "VK_CLEAR",         /* 0x0C */
    "VK_RETURN",        /* 0x0D */
    NULL,               /* 0x0E */
    NULL,               /* 0x0F */
    "VK_SHIFT",         /* 0x10 */
    "VK_CONTROL",       /* 0x11 */
    "VK_MENU",          /* 0x12 */
    "VK_PAUSE",         /* 0x13 */
    "VK_CAPITAL",       /* 0x14 */
    NULL,               /* 0x15 */
    NULL,               /* 0x16 */
    NULL,               /* 0x17 */
    NULL,               /* 0x18 */
    NULL,               /* 0x19 */
    NULL,               /* 0x1A */
    "VK_ESCAPE",        /* 0x1B */
1176 1177 1178 1179
    "VK_CONVERT",       /* 0x1C */
    "VK_NONCONVERT",    /* 0x1D */
    "VK_ACCEPT",        /* 0x1E */
    "VK_MODECHANGE",    /* 0x1F */
1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242
    "VK_SPACE",         /* 0x20 */
    "VK_PRIOR",         /* 0x21 */
    "VK_NEXT",          /* 0x22 */
    "VK_END",           /* 0x23 */
    "VK_HOME",          /* 0x24 */
    "VK_LEFT",          /* 0x25 */
    "VK_UP",            /* 0x26 */
    "VK_RIGHT",         /* 0x27 */
    "VK_DOWN",          /* 0x28 */
    "VK_SELECT",        /* 0x29 */
    "VK_PRINT",         /* 0x2A */
    "VK_EXECUTE",       /* 0x2B */
    "VK_SNAPSHOT",      /* 0x2C */
    "VK_INSERT",        /* 0x2D */
    "VK_DELETE",        /* 0x2E */
    "VK_HELP",          /* 0x2F */
    "VK_0",             /* 0x30 */
    "VK_1",             /* 0x31 */
    "VK_2",             /* 0x32 */
    "VK_3",             /* 0x33 */
    "VK_4",             /* 0x34 */
    "VK_5",             /* 0x35 */
    "VK_6",             /* 0x36 */
    "VK_7",             /* 0x37 */
    "VK_8",             /* 0x38 */
    "VK_9",             /* 0x39 */
    NULL,               /* 0x3A */
    NULL,               /* 0x3B */
    NULL,               /* 0x3C */
    NULL,               /* 0x3D */
    NULL,               /* 0x3E */
    NULL,               /* 0x3F */
    NULL,               /* 0x40 */
    "VK_A",             /* 0x41 */
    "VK_B",             /* 0x42 */
    "VK_C",             /* 0x43 */
    "VK_D",             /* 0x44 */
    "VK_E",             /* 0x45 */
    "VK_F",             /* 0x46 */
    "VK_G",             /* 0x47 */
    "VK_H",             /* 0x48 */
    "VK_I",             /* 0x49 */
    "VK_J",             /* 0x4A */
    "VK_K",             /* 0x4B */
    "VK_L",             /* 0x4C */
    "VK_M",             /* 0x4D */
    "VK_N",             /* 0x4E */
    "VK_O",             /* 0x4F */
    "VK_P",             /* 0x50 */
    "VK_Q",             /* 0x51 */
    "VK_R",             /* 0x52 */
    "VK_S",             /* 0x53 */
    "VK_T",             /* 0x54 */
    "VK_U",             /* 0x55 */
    "VK_V",             /* 0x56 */
    "VK_W",             /* 0x57 */
    "VK_X",             /* 0x58 */
    "VK_Y",             /* 0x59 */
    "VK_Z",             /* 0x5A */
    "VK_LWIN",          /* 0x5B */
    "VK_RWIN",          /* 0x5C */
    "VK_APPS",          /* 0x5D */
    NULL,               /* 0x5E */
1243
    "VK_SLEEP",         /* 0x5F */
1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293
    "VK_NUMPAD0",       /* 0x60 */
    "VK_NUMPAD1",       /* 0x61 */
    "VK_NUMPAD2",       /* 0x62 */
    "VK_NUMPAD3",       /* 0x63 */
    "VK_NUMPAD4",       /* 0x64 */
    "VK_NUMPAD5",       /* 0x65 */
    "VK_NUMPAD6",       /* 0x66 */
    "VK_NUMPAD7",       /* 0x67 */
    "VK_NUMPAD8",       /* 0x68 */
    "VK_NUMPAD9",       /* 0x69 */
    "VK_MULTIPLY",      /* 0x6A */
    "VK_ADD",           /* 0x6B */
    "VK_SEPARATOR",     /* 0x6C */
    "VK_SUBTRACT",      /* 0x6D */
    "VK_DECIMAL",       /* 0x6E */
    "VK_DIVIDE",        /* 0x6F */
    "VK_F1",            /* 0x70 */
    "VK_F2",            /* 0x71 */
    "VK_F3",            /* 0x72 */
    "VK_F4",            /* 0x73 */
    "VK_F5",            /* 0x74 */
    "VK_F6",            /* 0x75 */
    "VK_F7",            /* 0x76 */
    "VK_F8",            /* 0x77 */
    "VK_F9",            /* 0x78 */
    "VK_F10",           /* 0x79 */
    "VK_F11",           /* 0x7A */
    "VK_F12",           /* 0x7B */
    "VK_F13",           /* 0x7C */
    "VK_F14",           /* 0x7D */
    "VK_F15",           /* 0x7E */
    "VK_F16",           /* 0x7F */
    "VK_F17",           /* 0x80 */
    "VK_F18",           /* 0x81 */
    "VK_F19",           /* 0x82 */
    "VK_F20",           /* 0x83 */
    "VK_F21",           /* 0x84 */
    "VK_F22",           /* 0x85 */
    "VK_F23",           /* 0x86 */
    "VK_F24",           /* 0x87 */
    NULL,               /* 0x88 */
    NULL,               /* 0x89 */
    NULL,               /* 0x8A */
    NULL,               /* 0x8B */
    NULL,               /* 0x8C */
    NULL,               /* 0x8D */
    NULL,               /* 0x8E */
    NULL,               /* 0x8F */
    "VK_NUMLOCK",       /* 0x90 */
    "VK_SCROLL",        /* 0x91 */
1294 1295 1296 1297 1298
    "VK_OEM_NEC_EQUAL",       /* 0x92 aka. VK_OEM_FJ_JISHO */
    "VK_OEM_FJ_MASSHOU",      /* 0x93 */
    "VK_OEM_FJ_TOUROKU",      /* 0x94 */
    "VK_OEM_FJ_LOYA",         /* 0x95 */
    "VK_OEM_FJ_ROYA",         /* 0x96 */
1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313
    NULL,               /* 0x97 */
    NULL,               /* 0x98 */
    NULL,               /* 0x99 */
    NULL,               /* 0x9A */
    NULL,               /* 0x9B */
    NULL,               /* 0x9C */
    NULL,               /* 0x9D */
    NULL,               /* 0x9E */
    NULL,               /* 0x9F */
    "VK_LSHIFT",        /* 0xA0 */
    "VK_RSHIFT",        /* 0xA1 */
    "VK_LCONTROL",      /* 0xA2 */
    "VK_RCONTROL",      /* 0xA3 */
    "VK_LMENU",         /* 0xA4 */
    "VK_RMENU",         /* 0xA5 */
1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331
    "VK_BROWSER_BACK",        /* 0xA6 */
    "VK_BROWSER_FORWARD",     /* 0xA7 */
    "VK_BROWSER_REFRESH",     /* 0xA8 */
    "VK_BROWSER_STOP",        /* 0xA9 */
    "VK_BROWSER_SEARCH",      /* 0xAA */
    "VK_BROWSER_FAVORITES",   /* 0xAB */
    "VK_BROWSER_HOME",        /* 0xAC */
    "VK_VOLUME_MUTE",         /* 0xAD */
    "VK_VOLUME_DOWN",         /* 0xAE */
    "VK_VOLUME_UP",           /* 0xAF */
    "VK_MEDIA_NEXT_TRACK",    /* 0xB0 */
    "VK_MEDIA_PREV_TRACK",    /* 0xB1 */
    "VK_MEDIA_STOP",          /* 0xB2 */
    "VK_MEDIA_PLAY_PAUSE",    /* 0xB3 */
    "VK_LAUNCH_MAIL",         /* 0xB4 */
    "VK_LAUNCH_MEDIA_SELECT", /* 0xB5 */
    "VK_LAUNCH_APP1",         /* 0xB6 */
    "VK_LAUNCH_APP2",         /* 0xB7 */
1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378
    NULL,               /* 0xB8 */
    NULL,               /* 0xB9 */
    "VK_OEM_1",         /* 0xBA */
    "VK_OEM_PLUS",      /* 0xBB */
    "VK_OEM_COMMA",     /* 0xBC */
    "VK_OEM_MINUS",     /* 0xBD */
    "VK_OEM_PERIOD",    /* 0xBE */
    "VK_OEM_2",         /* 0xBF */
    "VK_OEM_3",         /* 0xC0 */
    NULL,               /* 0xC1 */
    NULL,               /* 0xC2 */
    NULL,               /* 0xC3 */
    NULL,               /* 0xC4 */
    NULL,               /* 0xC5 */
    NULL,               /* 0xC6 */
    NULL,               /* 0xC7 */
    NULL,               /* 0xC8 */
    NULL,               /* 0xC9 */
    NULL,               /* 0xCA */
    NULL,               /* 0xCB */
    NULL,               /* 0xCC */
    NULL,               /* 0xCD */
    NULL,               /* 0xCE */
    NULL,               /* 0xCF */
    NULL,               /* 0xD0 */
    NULL,               /* 0xD1 */
    NULL,               /* 0xD2 */
    NULL,               /* 0xD3 */
    NULL,               /* 0xD4 */
    NULL,               /* 0xD5 */
    NULL,               /* 0xD6 */
    NULL,               /* 0xD7 */
    NULL,               /* 0xD8 */
    NULL,               /* 0xD9 */
    NULL,               /* 0xDA */
    "VK_OEM_4",         /* 0xDB */
    "VK_OEM_5",         /* 0xDC */
    "VK_OEM_6",         /* 0xDD */
    "VK_OEM_7",         /* 0xDE */
    "VK_OEM_8",         /* 0xDF */
    NULL,               /* 0xE0 */
    "VK_OEM_AX",        /* 0xE1 */
    "VK_OEM_102",       /* 0xE2 */
    "VK_ICO_HELP",      /* 0xE3 */
    "VK_ICO_00",        /* 0xE4 */
    "VK_PROCESSKEY",    /* 0xE5 */
    NULL,               /* 0xE6 */
1379
    "VK_PACKET",        /* 0xE7 */
1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403
    NULL,               /* 0xE8 */
    NULL,               /* 0xE9 */
    NULL,               /* 0xEA */
    NULL,               /* 0xEB */
    NULL,               /* 0xEC */
    NULL,               /* 0xED */
    NULL,               /* 0xEE */
    NULL,               /* 0xEF */
    NULL,               /* 0xF0 */
    NULL,               /* 0xF1 */
    NULL,               /* 0xF2 */
    NULL,               /* 0xF3 */
    NULL,               /* 0xF4 */
    NULL,               /* 0xF5 */
    "VK_ATTN",          /* 0xF6 */
    "VK_CRSEL",         /* 0xF7 */
    "VK_EXSEL",         /* 0xF8 */
    "VK_EREOF",         /* 0xF9 */
    "VK_PLAY",          /* 0xFA */
    "VK_ZOOM",          /* 0xFB */
    "VK_NONAME",        /* 0xFC */
    "VK_PA1",           /* 0xFD */
    "VK_OEM_CLEAR",     /* 0xFE */
    NULL                /* 0xFF */
1404 1405
};

1406

1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421
/************************************************************************/


/* WM_USER+n message values for "common controls" */

typedef struct
{
    const char *name;      /* name of control message           */
    UINT        value;     /* message number (0x0401-0x0fff     */
    UINT        len;       /* length of space at lParam to dump */
} USER_MSG;


typedef struct
{
1422
const WCHAR      *classname;  /* class name to match                  */
1423
const USER_MSG   *classmsg;   /* pointer to first USER_MSG for class  */
1424
const USER_MSG   *lastmsg;    /* pointer to last USER_MSG for class   */
1425 1426
} CONTROL_CLASS;

1427 1428 1429 1430 1431
#define USM(a,b) { #a ,a,b}
#define SZOF(a)  sizeof(a)

/* To dump memory at the lParam for any of these messages,  */
/* replace the "0" with a "SZOF(structure)", or with a      */
1432
/* number. (First method preferred.)                         */
1433

1434 1435
#define RB_GETBANDINFO_OLD (WM_USER+5) /* obsoleted after IE3, but we have to support it anyway */

1436
static const USER_MSG rebar_array[] = {
1437 1438 1439 1440
          USM(RB_INSERTBANDA,          0),
          USM(RB_DELETEBAND,           0),
          USM(RB_GETBARINFO,           0),
          USM(RB_SETBARINFO,           0),
1441
          USM(RB_GETBANDINFO_OLD,      0),
1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471
          USM(RB_SETBANDINFOA,         0),
          USM(RB_SETPARENT,            0),
          USM(RB_HITTEST,              0),
          USM(RB_GETRECT,              0),
          USM(RB_INSERTBANDW,          0),
          USM(RB_SETBANDINFOW,         0),
          USM(RB_GETBANDCOUNT,         0),
          USM(RB_GETROWCOUNT,          0),
          USM(RB_GETROWHEIGHT,         0),
          USM(RB_IDTOINDEX,            0),
          USM(RB_GETTOOLTIPS,          0),
          USM(RB_SETTOOLTIPS,          0),
          USM(RB_SETBKCOLOR,           0),
          USM(RB_GETBKCOLOR,           0),
          USM(RB_SETTEXTCOLOR,         0),
          USM(RB_GETTEXTCOLOR,         0),
          USM(RB_SIZETORECT,           0),
          USM(RB_BEGINDRAG,            0),
          USM(RB_ENDDRAG,              0),
          USM(RB_DRAGMOVE,             0),
          USM(RB_GETBARHEIGHT,         0),
          USM(RB_GETBANDINFOW,         0),
          USM(RB_GETBANDINFOA,         0),
          USM(RB_MINIMIZEBAND,         0),
          USM(RB_MAXIMIZEBAND,         0),
          USM(RB_GETBANDBORDERS,       0),
          USM(RB_SHOWBAND,             0),
          USM(RB_SETPALETTE,           0),
          USM(RB_GETPALETTE,           0),
          USM(RB_MOVEBAND,             0),
1472 1473 1474 1475 1476 1477 1478 1479
          {0,0,0} };

static const USER_MSG toolbar_array[] = {
          USM(TB_ENABLEBUTTON          ,0),
          USM(TB_CHECKBUTTON           ,0),
          USM(TB_PRESSBUTTON           ,0),
          USM(TB_HIDEBUTTON            ,0),
          USM(TB_INDETERMINATE         ,0),
1480
          USM(TB_MARKBUTTON            ,0),
1481 1482 1483
          USM(TB_ISBUTTONENABLED       ,0),
          USM(TB_ISBUTTONCHECKED       ,0),
          USM(TB_ISBUTTONPRESSED       ,0),
1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497
          USM(TB_ISBUTTONHIDDEN        ,0),
          USM(TB_ISBUTTONINDETERMINATE ,0),
          USM(TB_ISBUTTONHIGHLIGHTED   ,0),
          USM(TB_SETSTATE              ,0),
          USM(TB_GETSTATE              ,0),
          USM(TB_ADDBITMAP             ,0),
          USM(TB_ADDBUTTONSA           ,0),
          USM(TB_INSERTBUTTONA         ,0),
          USM(TB_DELETEBUTTON          ,0),
          USM(TB_GETBUTTON             ,0),
          USM(TB_BUTTONCOUNT           ,0),
          USM(TB_COMMANDTOINDEX        ,0),
          USM(TB_SAVERESTOREA          ,0),
          USM(TB_CUSTOMIZE             ,0),
1498
          USM(TB_ADDSTRINGA            ,0),
1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544
          USM(TB_GETITEMRECT           ,0),
          USM(TB_BUTTONSTRUCTSIZE      ,0),
          USM(TB_SETBUTTONSIZE         ,0),
          USM(TB_SETBITMAPSIZE         ,0),
          USM(TB_AUTOSIZE              ,0),
          USM(TB_GETTOOLTIPS           ,0),
          USM(TB_SETTOOLTIPS           ,0),
          USM(TB_SETPARENT             ,0),
          USM(TB_SETROWS               ,0),
          USM(TB_GETROWS               ,0),
          USM(TB_GETBITMAPFLAGS        ,0),
          USM(TB_SETCMDID              ,0),
          USM(TB_CHANGEBITMAP          ,0),
          USM(TB_GETBITMAP             ,0),
          USM(TB_GETBUTTONTEXTA        ,0),
          USM(TB_REPLACEBITMAP         ,0),
          USM(TB_SETINDENT             ,0),
          USM(TB_SETIMAGELIST          ,0),
          USM(TB_GETIMAGELIST          ,0),
          USM(TB_LOADIMAGES            ,0),
          USM(TB_GETRECT               ,0),
          USM(TB_SETHOTIMAGELIST       ,0),
          USM(TB_GETHOTIMAGELIST       ,0),
          USM(TB_SETDISABLEDIMAGELIST  ,0),
          USM(TB_GETDISABLEDIMAGELIST  ,0),
          USM(TB_SETSTYLE              ,0),
          USM(TB_GETSTYLE              ,0),
          USM(TB_GETBUTTONSIZE         ,0),
          USM(TB_SETBUTTONWIDTH        ,0),
          USM(TB_SETMAXTEXTROWS        ,0),
          USM(TB_GETTEXTROWS           ,0),
          USM(TB_GETOBJECT             ,0),
          USM(TB_GETBUTTONINFOW        ,0),
          USM(TB_SETBUTTONINFOW        ,0),
          USM(TB_GETBUTTONINFOA        ,0),
          USM(TB_SETBUTTONINFOA        ,0),
          USM(TB_INSERTBUTTONW         ,0),
          USM(TB_ADDBUTTONSW           ,0),
          USM(TB_HITTEST               ,0),
          USM(TB_SETDRAWTEXTFLAGS      ,0),
          USM(TB_GETHOTITEM            ,0),
          USM(TB_SETHOTITEM            ,0),
          USM(TB_SETANCHORHIGHLIGHT    ,0),
          USM(TB_GETANCHORHIGHLIGHT    ,0),
          USM(TB_GETBUTTONTEXTW        ,0),
          USM(TB_SAVERESTOREW          ,0),
1545
          USM(TB_ADDSTRINGW            ,0),
1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558
          USM(TB_MAPACCELERATORA       ,0),
          USM(TB_GETINSERTMARK         ,0),
          USM(TB_SETINSERTMARK         ,0),
          USM(TB_INSERTMARKHITTEST     ,0),
          USM(TB_MOVEBUTTON            ,0),
          USM(TB_GETMAXSIZE            ,0),
          USM(TB_SETEXTENDEDSTYLE      ,0),
          USM(TB_GETEXTENDEDSTYLE      ,0),
          USM(TB_GETPADDING            ,0),
          USM(TB_SETPADDING            ,0),
          USM(TB_SETINSERTMARKCOLOR    ,0),
          USM(TB_GETINSERTMARKCOLOR    ,0),
          USM(TB_MAPACCELERATORW       ,0),
1559 1560 1561
          USM(TB_GETSTRINGW            ,0),
          USM(TB_GETSTRINGA            ,0),
          USM(TB_UNKWN45D              ,8),
1562 1563 1564 1565
          USM(TB_SETHOTITEM2           ,0),
          USM(TB_SETLISTGAP            ,0),
          USM(TB_GETIMAGELISTCOUNT     ,0),
          USM(TB_GETIDEALSIZE          ,8),
1566
          USM(TB_UNKWN464              ,0),
1567 1568
          {0,0,0} };

1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596
static const USER_MSG tooltips_array[] = {
          USM(TTM_ACTIVATE             ,0),
          USM(TTM_SETDELAYTIME         ,0),
          USM(TTM_ADDTOOLA             ,0),
          USM(TTM_DELTOOLA             ,0),
          USM(TTM_NEWTOOLRECTA         ,0),
          USM(TTM_RELAYEVENT           ,0),
          USM(TTM_GETTOOLINFOA         ,0),
          USM(TTM_HITTESTA             ,0),
          USM(TTM_GETTEXTA             ,0),
          USM(TTM_UPDATETIPTEXTA       ,0),
          USM(TTM_GETTOOLCOUNT         ,0),
          USM(TTM_ENUMTOOLSA           ,0),
          USM(TTM_GETCURRENTTOOLA      ,0),
          USM(TTM_WINDOWFROMPOINT      ,0),
          USM(TTM_TRACKACTIVATE        ,0),
          USM(TTM_TRACKPOSITION        ,0),
          USM(TTM_SETTIPBKCOLOR        ,0),
          USM(TTM_SETTIPTEXTCOLOR      ,0),
          USM(TTM_GETDELAYTIME         ,0),
          USM(TTM_GETTIPBKCOLOR        ,0),
          USM(TTM_GETTIPTEXTCOLOR      ,0),
          USM(TTM_SETMAXTIPWIDTH       ,0),
          USM(TTM_GETMAXTIPWIDTH       ,0),
          USM(TTM_SETMARGIN            ,0),
          USM(TTM_GETMARGIN            ,0),
          USM(TTM_POP                  ,0),
          USM(TTM_UPDATE               ,0),
1597
          USM(TTM_GETBUBBLESIZE        ,0),
1598 1599 1600 1601 1602 1603 1604 1605 1606 1607
          USM(TTM_ADDTOOLW             ,0),
          USM(TTM_DELTOOLW             ,0),
          USM(TTM_NEWTOOLRECTW         ,0),
          USM(TTM_GETTOOLINFOW         ,0),
          USM(TTM_SETTOOLINFOW         ,0),
          USM(TTM_HITTESTW             ,0),
          USM(TTM_GETTEXTW             ,0),
          USM(TTM_UPDATETIPTEXTW       ,0),
          USM(TTM_ENUMTOOLSW           ,0),
          USM(TTM_GETCURRENTTOOLW      ,0),
1608 1609
          {0,0,0} };

1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626
static const USER_MSG comboex_array[] = {
          USM(CBEM_INSERTITEMA        ,0),
          USM(CBEM_SETIMAGELIST       ,0),
          USM(CBEM_GETIMAGELIST       ,0),
          USM(CBEM_GETITEMA           ,0),
          USM(CBEM_SETITEMA           ,0),
          USM(CBEM_GETCOMBOCONTROL    ,0),
          USM(CBEM_GETEDITCONTROL     ,0),
          USM(CBEM_SETEXSTYLE         ,0),
          USM(CBEM_GETEXTENDEDSTYLE   ,0),
          USM(CBEM_HASEDITCHANGED     ,0),
          USM(CBEM_INSERTITEMW        ,0),
          USM(CBEM_SETITEMW           ,0),
          USM(CBEM_GETITEMW           ,0),
          USM(CBEM_SETEXTENDEDSTYLE   ,0),
          {0,0,0} };

Guy Albertelli's avatar
Guy Albertelli committed
1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648
static const USER_MSG propsht_array[] = {
          USM(PSM_SETCURSEL           ,0),
          USM(PSM_REMOVEPAGE          ,0),
          USM(PSM_ADDPAGE             ,0),
          USM(PSM_CHANGED             ,0),
          USM(PSM_RESTARTWINDOWS      ,0),
          USM(PSM_REBOOTSYSTEM        ,0),
          USM(PSM_CANCELTOCLOSE       ,0),
          USM(PSM_QUERYSIBLINGS       ,0),
          USM(PSM_UNCHANGED           ,0),
          USM(PSM_APPLY               ,0),
          USM(PSM_SETTITLEA           ,0),
          USM(PSM_SETWIZBUTTONS       ,0),
          USM(PSM_PRESSBUTTON         ,0),
          USM(PSM_SETCURSELID         ,0),
          USM(PSM_SETFINISHTEXTA      ,0),
          USM(PSM_GETTABCONTROL       ,0),
          USM(PSM_ISDIALOGMESSAGE     ,0),
          USM(PSM_GETCURRENTPAGEHWND  ,0),
          USM(PSM_SETTITLEW           ,0),
          USM(PSM_SETFINISHTEXTW      ,0),
          {0,0,0} };
1649
static const WCHAR PropSheetInfoStr[] =
1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667
    {'P','r','o','p','e','r','t','y','S','h','e','e','t','I','n','f','o',0 };

static const USER_MSG updown_array[] = {
          USM(UDM_SETRANGE            ,0),
          USM(UDM_GETRANGE            ,0),
          USM(UDM_SETPOS              ,0),
          USM(UDM_GETPOS              ,0),
          USM(UDM_SETBUDDY            ,0),
          USM(UDM_GETBUDDY            ,0),
          USM(UDM_SETACCEL            ,0),
          USM(UDM_GETACCEL            ,0),
          USM(UDM_SETBASE             ,0),
          USM(UDM_GETBASE             ,0),
          USM(UDM_SETRANGE32          ,0),
          USM(UDM_GETRANGE32          ,0),
          USM(UDM_SETPOS32            ,0),
          USM(UDM_GETPOS32            ,0),
          {0,0,0} };
Guy Albertelli's avatar
Guy Albertelli committed
1668

1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751
/* generated from:
 * $ for i in `grep EM_ include/richedit.h | cut -d' ' -f2 | cut -f1`; do echo -e "          USM($i\t\t,0),"; done
 */
static const USER_MSG richedit_array[] = {
          {"EM_SCROLLCARET", WM_USER+49 ,0},
          USM(EM_CANPASTE               ,0),
          USM(EM_DISPLAYBAND            ,0),
          USM(EM_EXGETSEL               ,0),
          USM(EM_EXLIMITTEXT            ,0),
          USM(EM_EXLINEFROMCHAR         ,0),
          USM(EM_EXSETSEL               ,0),
          USM(EM_FINDTEXT               ,0),
          USM(EM_FORMATRANGE            ,0),
          USM(EM_GETCHARFORMAT          ,0),
          USM(EM_GETEVENTMASK           ,0),
          USM(EM_GETOLEINTERFACE        ,0),
          USM(EM_GETPARAFORMAT          ,0),
          USM(EM_GETSELTEXT             ,0),
          USM(EM_HIDESELECTION          ,0),
          USM(EM_PASTESPECIAL           ,0),
          USM(EM_REQUESTRESIZE          ,0),
          USM(EM_SELECTIONTYPE          ,0),
          USM(EM_SETBKGNDCOLOR          ,0),
          USM(EM_SETCHARFORMAT          ,0),
          USM(EM_SETEVENTMASK           ,0),
          USM(EM_SETOLECALLBACK         ,0),
          USM(EM_SETPARAFORMAT          ,0),
          USM(EM_SETTARGETDEVICE        ,0),
          USM(EM_STREAMIN               ,0),
          USM(EM_STREAMOUT              ,0),
          USM(EM_GETTEXTRANGE           ,0),
          USM(EM_FINDWORDBREAK          ,0),
          USM(EM_SETOPTIONS             ,0),
          USM(EM_GETOPTIONS             ,0),
          USM(EM_FINDTEXTEX             ,0),
          USM(EM_GETWORDBREAKPROCEX     ,0),
          USM(EM_SETWORDBREAKPROCEX     ,0),
          USM(EM_SETUNDOLIMIT           ,0),
          USM(EM_REDO                   ,0),
          USM(EM_CANREDO                ,0),
          USM(EM_GETUNDONAME            ,0),
          USM(EM_GETREDONAME            ,0),
          USM(EM_STOPGROUPTYPING        ,0),
          USM(EM_SETTEXTMODE            ,0),
          USM(EM_GETTEXTMODE            ,0),
          USM(EM_AUTOURLDETECT          ,0),
          USM(EM_GETAUTOURLDETECT       ,0),
          USM(EM_SETPALETTE             ,0),
          USM(EM_GETTEXTEX              ,0),
          USM(EM_GETTEXTLENGTHEX        ,0),
          USM(EM_SHOWSCROLLBAR          ,0),
          USM(EM_SETTEXTEX              ,0),
          USM(EM_SETPUNCTUATION         ,0),
          USM(EM_GETPUNCTUATION         ,0),
          USM(EM_SETWORDWRAPMODE        ,0),
          USM(EM_GETWORDWRAPMODE        ,0),
          USM(EM_SETIMECOLOR            ,0),
          USM(EM_GETIMECOLOR            ,0),
          USM(EM_SETIMEOPTIONS          ,0),
          USM(EM_GETIMEOPTIONS          ,0),
          USM(EM_CONVPOSITION           ,0),
          USM(EM_SETLANGOPTIONS         ,0),
          USM(EM_GETLANGOPTIONS         ,0),
          USM(EM_GETIMECOMPMODE         ,0),
          USM(EM_FINDTEXTW              ,0),
          USM(EM_FINDTEXTEXW            ,0),
          USM(EM_RECONVERSION           ,0),
          USM(EM_SETIMEMODEBIAS         ,0),
          USM(EM_GETIMEMODEBIAS         ,0),
          USM(EM_SETBIDIOPTIONS         ,0),
          USM(EM_GETBIDIOPTIONS         ,0),
          USM(EM_SETTYPOGRAPHYOPTIONS   ,0),
          USM(EM_GETTYPOGRAPHYOPTIONS   ,0),
          USM(EM_SETEDITSTYLE           ,0),
          USM(EM_GETEDITSTYLE           ,0),
          USM(EM_OUTLINE                ,0),
          USM(EM_GETSCROLLPOS           ,0),
          USM(EM_SETSCROLLPOS           ,0),
          USM(EM_SETFONTSIZE            ,0),
          USM(EM_GETZOOM                ,0),
          USM(EM_SETZOOM                ,0),
          {0,0,0} };

1752
#undef SZOF
1753 1754 1755
#undef USM

static CONTROL_CLASS  cc_array[] = {
1756 1757 1758 1759 1760 1761
    {WC_COMBOBOXEXW,    comboex_array,  0},
    {WC_PROPSHEETW,     propsht_array,  0},
    {REBARCLASSNAMEW,   rebar_array,    0},
    {TOOLBARCLASSNAMEW, toolbar_array,  0},
    {TOOLTIPS_CLASSW,   tooltips_array, 0},
    {UPDOWN_CLASSW,     updown_array,   0},
1762
    {RICHEDIT_CLASS20W, richedit_array, 0},
1763 1764 1765 1766 1767 1768
    {0, 0, 0} };


/************************************************************************/


1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785
/* WM_NOTIFY function codes display */

typedef struct
{
    const char *name;     /* name of notify message        */
    UINT        value;     /* notify code value             */
    UINT        len;       /* length of extra space to dump */
} SPY_NOTIFY;

#define SPNFY(a,b) { #a ,a,sizeof(b)-sizeof(NMHDR)}

/* Array MUST be in descending order by the 'value' field  */
/* (since value is UNSIGNED, 0xffffffff is largest and     */
/*  0xfffffffe is smaller). A binary search is used to     */
/* locate the correct 'value'.                             */
static const SPY_NOTIFY spnfy_array[] = {
    /*  common        0U       to  0U-99U  */
1786 1787
    SPNFY(NM_OUTOFMEMORY,        NMHDR),
    SPNFY(NM_CLICK,              NMHDR),
1788
    SPNFY(NM_DBLCLK,             NMHDR),
1789
    SPNFY(NM_RETURN,             NMHDR),
1790
    SPNFY(NM_RCLICK,             NMHDR),
1791
    SPNFY(NM_RDBLCLK,            NMHDR),
1792 1793 1794 1795
    SPNFY(NM_SETFOCUS,           NMHDR),
    SPNFY(NM_KILLFOCUS,          NMHDR),
    SPNFY(NM_CUSTOMDRAW,         NMCUSTOMDRAW),
    SPNFY(NM_HOVER,              NMHDR),
1796
    SPNFY(NM_NCHITTEST,          NMMOUSE),
1797 1798 1799 1800
    SPNFY(NM_KEYDOWN,            NMKEY),
    SPNFY(NM_RELEASEDCAPTURE,    NMHDR),
    SPNFY(NM_SETCURSOR,          NMMOUSE),
    SPNFY(NM_CHAR,               NMCHAR),
1801
    SPNFY(NM_TOOLTIPSCREATED,    NMTOOLTIPSCREATED),
1802
    /* Listview       0U-100U  to  0U-199U  */
1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818
    SPNFY(LVN_ITEMCHANGING,      NMLISTVIEW),
    SPNFY(LVN_ITEMCHANGED,       NMLISTVIEW),
    SPNFY(LVN_INSERTITEM,        NMLISTVIEW),
    SPNFY(LVN_DELETEITEM,        NMLISTVIEW),
    SPNFY(LVN_DELETEALLITEMS,    NMLISTVIEW),
    SPNFY(LVN_BEGINLABELEDITA,   NMLVDISPINFOA),
    SPNFY(LVN_ENDLABELEDITA,     NMLVDISPINFOA),
    SPNFY(LVN_COLUMNCLICK,       NMLISTVIEW),
    SPNFY(LVN_BEGINDRAG,         NMLISTVIEW),
    SPNFY(LVN_BEGINRDRAG,        NMLISTVIEW),
    SPNFY(LVN_ODCACHEHINT,       NMLVCACHEHINT),
    SPNFY(LVN_ITEMACTIVATE,      NMITEMACTIVATE),
    SPNFY(LVN_ODSTATECHANGED,    NMLVODSTATECHANGE),
    SPNFY(LVN_HOTTRACK,          NMLISTVIEW),
    SPNFY(LVN_GETDISPINFOA,      NMLVDISPINFOA),
    SPNFY(LVN_SETDISPINFOA,      NMLVDISPINFOA),
1819
    SPNFY(LVN_ODFINDITEMA,       NMLVFINDITEMA),
1820 1821 1822 1823 1824 1825 1826 1827
    SPNFY(LVN_KEYDOWN,           NMLVKEYDOWN),
    SPNFY(LVN_MARQUEEBEGIN,      NMLISTVIEW),
    SPNFY(LVN_GETINFOTIPA,       NMLVGETINFOTIPA),
    SPNFY(LVN_GETINFOTIPW,       NMLVGETINFOTIPW),
    SPNFY(LVN_BEGINLABELEDITW,   NMLVDISPINFOW),
    SPNFY(LVN_ENDLABELEDITW,     NMLVDISPINFOW),
    SPNFY(LVN_GETDISPINFOW,      NMLVDISPINFOW),
    SPNFY(LVN_SETDISPINFOW,      NMLVDISPINFOW),
1828
    SPNFY(LVN_ODFINDITEMW,       NMLVFINDITEMW),
Guy Albertelli's avatar
Guy Albertelli committed
1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839
    /* PropertySheet  0U-200U  to  0U-299U  */
    SPNFY(PSN_SETACTIVE,         PSHNOTIFY),
    SPNFY(PSN_KILLACTIVE,        PSHNOTIFY),
    SPNFY(PSN_APPLY,             PSHNOTIFY),
    SPNFY(PSN_RESET,             PSHNOTIFY),
    SPNFY(PSN_HELP,              PSHNOTIFY),
    SPNFY(PSN_WIZBACK,           PSHNOTIFY),
    SPNFY(PSN_WIZNEXT,           PSHNOTIFY),
    SPNFY(PSN_WIZFINISH,         PSHNOTIFY),
    SPNFY(PSN_QUERYCANCEL,       PSHNOTIFY),
    SPNFY(PSN_GETOBJECT,         NMOBJECTNOTIFY),
1840 1841
    SPNFY(PSN_TRANSLATEACCELERATOR, PSHNOTIFY),
    SPNFY(PSN_QUERYINITIALFOCUS, PSHNOTIFY),
1842
    /* Header         0U-300U  to  0U-399U  */
1843 1844 1845 1846 1847 1848 1849 1850 1851
    SPNFY(HDN_ITEMCHANGINGA,     NMHEADERA),
    SPNFY(HDN_ITEMCHANGEDA,      NMHEADERA),
    SPNFY(HDN_ITEMCLICKA,        NMHEADERA),
    SPNFY(HDN_ITEMDBLCLICKA,     NMHEADERA),
    SPNFY(HDN_DIVIDERDBLCLICKA,  NMHEADERA),
    SPNFY(HDN_BEGINTRACKA,       NMHEADERA),
    SPNFY(HDN_ENDTRACKA,         NMHEADERA),
    SPNFY(HDN_TRACKA,            NMHEADERA),
    SPNFY(HDN_GETDISPINFOA,      NMHEADERA),
1852 1853 1854 1855 1856 1857 1858 1859 1860
    SPNFY(HDN_BEGINDRAG,         NMHDR),
    SPNFY(HDN_ENDDRAG,           NMHDR),
    SPNFY(HDN_ITEMCHANGINGW,     NMHDR),
    SPNFY(HDN_ITEMCHANGEDW,      NMHDR),
    SPNFY(HDN_ITEMCLICKW,        NMHDR),
    SPNFY(HDN_ITEMDBLCLICKW,     NMHDR),
    SPNFY(HDN_DIVIDERDBLCLICKW,  NMHDR),
    SPNFY(HDN_BEGINTRACKW,       NMHDR),
    SPNFY(HDN_ENDTRACKW,         NMHDR),
1861
    SPNFY(HDN_TRACKW,            NMHDR),
1862
    SPNFY(HDN_GETDISPINFOW,      NMHDR),
1863
    /* Treeview       0U-400U  to  0U-499U  */
1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886
    SPNFY(TVN_SELCHANGINGA,      NMTREEVIEWA),
    SPNFY(TVN_SELCHANGEDA,       NMTREEVIEWA),
    SPNFY(TVN_GETDISPINFOA,      NMTVDISPINFOA),
    SPNFY(TVN_SETDISPINFOA,      NMTVDISPINFOA),
    SPNFY(TVN_ITEMEXPANDINGA,    NMTREEVIEWA),
    SPNFY(TVN_ITEMEXPANDEDA,     NMTREEVIEWA),
    SPNFY(TVN_BEGINDRAGA,        NMTREEVIEWA),
    SPNFY(TVN_BEGINRDRAGA,       NMTREEVIEWA),
    SPNFY(TVN_DELETEITEMA,       NMTREEVIEWA),
    SPNFY(TVN_BEGINLABELEDITA,   NMTVDISPINFOA),
    SPNFY(TVN_ENDLABELEDITA,     NMTVDISPINFOA),
    SPNFY(TVN_KEYDOWN,           NMTVKEYDOWN),
    SPNFY(TVN_SELCHANGINGW,      NMTREEVIEWW),
    SPNFY(TVN_SELCHANGEDW,       NMTREEVIEWW),
    SPNFY(TVN_GETDISPINFOW,      NMTVDISPINFOW),
    SPNFY(TVN_SETDISPINFOW,      NMTVDISPINFOW),
    SPNFY(TVN_ITEMEXPANDINGW,    NMTREEVIEWW),
    SPNFY(TVN_ITEMEXPANDEDW,     NMTREEVIEWW),
    SPNFY(TVN_BEGINDRAGW,        NMTREEVIEWW),
    SPNFY(TVN_BEGINRDRAGW,       NMTREEVIEWW),
    SPNFY(TVN_DELETEITEMW,       NMTREEVIEWW),
    SPNFY(TVN_BEGINLABELEDITW,   NMTVDISPINFOW),
    SPNFY(TVN_ENDLABELEDITW,     NMTVDISPINFOW),
1887
    /* Tooltips       0U-520U  to  0U-549U  */
1888 1889 1890 1891
    SPNFY(TTN_GETDISPINFOA,      NMHDR),
    SPNFY(TTN_SHOW,              NMHDR),
    SPNFY(TTN_POP,               NMHDR),
    SPNFY(TTN_GETDISPINFOW,      NMHDR),
1892
    /* Tab            0U-550U  to  0U-580U  */
1893 1894 1895 1896
    SPNFY(TCN_KEYDOWN,           NMHDR),
    SPNFY(TCN_SELCHANGE,         NMHDR),
    SPNFY(TCN_SELCHANGING,       NMHDR),
    SPNFY(TCN_GETOBJECT,         NMHDR),
1897
    /* Common Dialog  0U-601U  to  0U-699U  */
1898 1899 1900 1901 1902 1903 1904
    SPNFY(CDN_INITDONE,          OFNOTIFYA),
    SPNFY(CDN_SELCHANGE,         OFNOTIFYA),
    SPNFY(CDN_FOLDERCHANGE,      OFNOTIFYA),
    SPNFY(CDN_SHAREVIOLATION,    OFNOTIFYA),
    SPNFY(CDN_HELP,              OFNOTIFYA),
    SPNFY(CDN_FILEOK,            OFNOTIFYA),
    SPNFY(CDN_TYPECHANGE,        OFNOTIFYA),
1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917
    /* Toolbar        0U-700U  to  0U-720U  */
    SPNFY(TBN_GETBUTTONINFOA,    NMTOOLBARA),
    SPNFY(TBN_BEGINDRAG,         NMTOOLBARA),
    SPNFY(TBN_ENDDRAG,           NMTOOLBARA),
    SPNFY(TBN_BEGINADJUST,       NMHDR),
    SPNFY(TBN_ENDADJUST,         NMHDR),
    SPNFY(TBN_RESET,             NMHDR),
    SPNFY(TBN_QUERYINSERT,       NMTOOLBARA),
    SPNFY(TBN_QUERYDELETE,       NMTOOLBARA),
    SPNFY(TBN_TOOLBARCHANGE,     NMHDR),
    SPNFY(TBN_CUSTHELP,          NMHDR),
    SPNFY(TBN_DROPDOWN,          NMTOOLBARA),
    SPNFY(TBN_GETOBJECT,         NMOBJECTNOTIFY),
1918
    SPNFY(TBN_HOTITEMCHANGE,     NMTBHOTITEM),
1919 1920
    SPNFY(TBN_DRAGOUT,           NMTOOLBARA),
    SPNFY(TBN_DELETINGBUTTON,    NMTOOLBARA),
1921 1922
    SPNFY(TBN_GETDISPINFOA,      NMTBDISPINFOA),
    SPNFY(TBN_GETDISPINFOW,      NMTBDISPINFOW),
1923 1924 1925 1926
    SPNFY(TBN_GETINFOTIPA,       NMTBGETINFOTIPA),
    SPNFY(TBN_GETINFOTIPW,       NMTBGETINFOTIPW),
    SPNFY(TBN_GETBUTTONINFOW,    NMTOOLBARW),
    /* Up/Down        0U-721U  to  0U-740U  */
1927
    SPNFY(UDN_DELTAPOS,          NM_UPDOWN),
1928
    /* Month Calendar 0U-750U  to  0U-759U  */
1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943
    /* ******************* WARNING ***************************** */
    /* The following appear backwards but needs to be this way.  */
    /* The reason is that MS (and us) define the MCNs as         */
    /*         MCN_FIRST + n                                     */
    /* instead of the way ALL other notifications are            */
    /*         TBN_FIRST - n                                     */
    /* The only place that this is important is in this list     */
    /*                                                           */
    /* Also since the same error was made with the DTN_ items,   */
    /* they overlay the MCN_ and need to be inserted in the      */
    /* other section of the table so that it is in order for     */
    /* the binary search.                                        */
    /*                                                           */
    /* Thank you MS for your obvious quality control!!           */
    /* ******************* WARNING ***************************** */
1944
    /* Date/Time      0U-760U  to  0U-799U  */
1945 1946 1947
    /* SPNFY(MCN_SELECT,            NMHDR), */
    /* SPNFY(MCN_GETDAYSTATE,       NMHDR), */
    /* SPNFY(MCN_SELCHANGE,         NMHDR), */
1948 1949 1950 1951 1952 1953 1954 1955
    /* ******************* WARNING ***************************** */
    /* The following appear backwards but needs to be this way.  */
    /* The reason is that MS (and us) define the MCNs as         */
    /*         DTN_FIRST + n                                     */
    /* instead of the way ALL other notifications are            */
    /*         TBN_FIRST - n                                     */
    /* The only place that this is important is in this list     */
    /* ******************* WARNING ***************************** */
1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969
    SPNFY(DTN_FORMATQUERYW,      NMHDR),
    SPNFY(DTN_FORMATW,           NMHDR),
    SPNFY(DTN_WMKEYDOWNW,        NMHDR),
    SPNFY(DTN_USERSTRINGW,       NMHDR),
    SPNFY(MCN_SELECT,            NMHDR),
    SPNFY(MCN_GETDAYSTATE,       NMHDR),
    SPNFY(MCN_SELCHANGE,         NMHDR),
    SPNFY(DTN_CLOSEUP,           NMHDR),
    SPNFY(DTN_DROPDOWN,          NMHDR),
    SPNFY(DTN_FORMATQUERYA,      NMHDR),
    SPNFY(DTN_FORMATA,           NMHDR),
    SPNFY(DTN_WMKEYDOWNA,        NMHDR),
    SPNFY(DTN_USERSTRINGA,       NMHDR),
    SPNFY(DTN_DATETIMECHANGE,    NMHDR),
1970
    /* ComboBoxEx     0U-800U  to  0U-830U  */
1971 1972 1973
    SPNFY(CBEN_GETDISPINFOA,     NMCOMBOBOXEXA),
    SPNFY(CBEN_INSERTITEM,       NMCOMBOBOXEXA),
    SPNFY(CBEN_DELETEITEM,       NMCOMBOBOXEXA),
1974
    SPNFY(CBEN_BEGINEDIT,        NMHDR),
1975 1976
    SPNFY(CBEN_ENDEDITA,         NMCBEENDEDITA),
    SPNFY(CBEN_ENDEDITW,         NMCBEENDEDITW),
1977 1978 1979
    SPNFY(CBEN_GETDISPINFOW,     NMCOMBOBOXEXW),
    SPNFY(CBEN_DRAGBEGINA,       NMCBEDRAGBEGINA),
    SPNFY(CBEN_DRAGBEGINW,       NMCBEDRAGBEGINW),
1980 1981 1982 1983 1984 1985 1986 1987 1988 1989
    /* Rebar          0U-831U  to  0U-859U  */
    SPNFY(RBN_HEIGHTCHANGE,      NMHDR),
    SPNFY(RBN_GETOBJECT,         NMOBJECTNOTIFY),
    SPNFY(RBN_LAYOUTCHANGED,     NMHDR),
    SPNFY(RBN_AUTOSIZE,          NMRBAUTOSIZE),
    SPNFY(RBN_BEGINDRAG,         NMREBAR),
    SPNFY(RBN_ENDDRAG,           NMREBAR),
    SPNFY(RBN_DELETINGBAND,      NMREBAR),
    SPNFY(RBN_DELETEDBAND,       NMREBAR),
    SPNFY(RBN_CHILDSIZE,         NMREBARCHILDSIZE),
Austin English's avatar
Austin English committed
1990
    /* IP address     0U-860U  to  0U-879U  */
1991
    SPNFY(IPN_FIELDCHANGED,      NMHDR),
1992
    /* Status bar     0U-880U  to  0U-899U  */
1993
    SPNFY(SBN_SIMPLEMODECHANGE,  NMHDR),
1994
    /* Pager          0U-900U  to  0U-950U  */
1995 1996
    SPNFY(PGN_SCROLL,            NMPGSCROLL),
    SPNFY(PGN_CALCSIZE,          NMPGCALCSIZE),
1997 1998 1999 2000 2001
    {0,0,0}};
static const SPY_NOTIFY *end_spnfy_array;     /* ptr to last good entry in array */
#undef SPNFY


2002 2003
static unsigned char SPY_Exclude[SPY_MAX_MSGNUM+1];
static unsigned char SPY_ExcludeDWP = 0;
Alexandre Julliard's avatar
Alexandre Julliard committed
2004

Alexandre Julliard's avatar
Alexandre Julliard committed
2005 2006
#define SPY_EXCLUDE(msg) \
    (SPY_Exclude[(msg) > SPY_MAX_MSGNUM ? SPY_MAX_MSGNUM : (msg)])
Alexandre Julliard's avatar
Alexandre Julliard committed
2007

2008 2009 2010 2011 2012 2013 2014 2015 2016

typedef struct
{
    UINT       msgnum;           /* message number */
    HWND       msg_hwnd;         /* window handle for message          */
    WPARAM     wParam;           /* message parameter                  */
    LPARAM     lParam;           /* message parameter                  */
    INT        data_len;         /* length of data to dump             */
    char       msg_name[60];     /* message name (see SPY_GetMsgName)  */
2017 2018
    WCHAR      wnd_class[60];    /* window class name (full)           */
    WCHAR      wnd_name[16];     /* window name for message            */
2019 2020
} SPY_INSTANCE;

2021 2022 2023 2024 2025
static int indent_tls_index;

/***********************************************************************
 *           get_indent_level
 */
2026
static inline INT_PTR get_indent_level(void)
2027
{
2028
    return (INT_PTR)TlsGetValue( indent_tls_index );
2029 2030 2031 2032 2033 2034
}


/***********************************************************************
 *           set_indent_level
 */
2035
static inline void set_indent_level( INT_PTR level )
2036 2037 2038 2039
{
    TlsSetValue( indent_tls_index, (void *)level );
}

2040

Alexandre Julliard's avatar
Alexandre Julliard committed
2041
/***********************************************************************
2042
 *           SPY_GetMsgInternal
Alexandre Julliard's avatar
Alexandre Julliard committed
2043
 */
2044
static const char *SPY_GetMsgInternal( UINT msg )
Alexandre Julliard's avatar
Alexandre Julliard committed
2045
{
Alexandre Julliard's avatar
Alexandre Julliard committed
2046 2047
    if (msg <= SPY_MAX_MSGNUM)
        return MessageTypeNames[msg];
2048 2049 2050 2051

    if (msg >= LVM_FIRST && msg <= LVM_FIRST + SPY_MAX_LVMMSGNUM)
        return LVMMessageTypeNames[msg-LVM_FIRST];

2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063
    if (msg >= TV_FIRST && msg <= TV_FIRST + SPY_MAX_TVMSGNUM)
        return TVMessageTypeNames[msg-TV_FIRST];

    if (msg >= HDM_FIRST && msg <= HDM_FIRST + SPY_MAX_HDMMSGNUM)
        return HDMMessageTypeNames[msg-HDM_FIRST];

    if (msg >= TCM_FIRST && msg <= TCM_FIRST + SPY_MAX_TCMMSGNUM)
        return TCMMessageTypeNames[msg-TCM_FIRST];

    if (msg >= PGM_FIRST && msg <= PGM_FIRST + SPY_MAX_PGMMSGNUM)
        return PGMMessageTypeNames[msg-PGM_FIRST];

2064 2065 2066
    if (msg >= CCM_FIRST && msg <= CCM_FIRST + SPY_MAX_CCMMSGNUM)
        return CCMMessageTypeNames[msg-CCM_FIRST];

2067 2068
    if (msg >= WM_WINE_DESTROYWINDOW && msg <= WM_WINE_DESTROYWINDOW + SPY_MAX_WINEMSGNUM)
        return WINEMessageTypeNames[msg-WM_WINE_DESTROYWINDOW];
2069 2070

    return NULL;
Alexandre Julliard's avatar
Alexandre Julliard committed
2071 2072
}

Alexandre Julliard's avatar
Alexandre Julliard committed
2073
/***********************************************************************
2074 2075
 *           SPY_Bsearch_Msg
 */
2076
static const USER_MSG *SPY_Bsearch_Msg( const USER_MSG *first, const USER_MSG *last, UINT code)
2077 2078 2079 2080 2081
{
    INT count;
    const USER_MSG *test;

    while (last >= first) {
2082 2083
        count = 1 + last - first;
        if (count < 3) {
2084
#if DEBUG_SPY
2085 2086
            TRACE("code=%d, f-value=%d, f-name=%s, l-value=%d, l-name=%s, l-len=%d,\n",
               code, first->value, first->name, last->value, last->name, last->len);
2087
#endif
2088 2089 2090 2091 2092 2093
            if (first->value == code) return first;
            if (last->value == code) return last;
            return NULL;
        }
        count = count / 2;
        test = first + count;
2094
#if DEBUG_SPY
2095 2096
        TRACE("first=%p, last=%p, test=%p, t-value=%d, code=%d, count=%d\n",
           first, last, test, test->value, code, count);
2097
#endif
2098 2099 2100 2101 2102
        if (test->value == code) return test;
        if (test->value > code)
            last = test - 1;
        else
            first = test + 1;
2103 2104 2105 2106
    }
    return NULL;
}

2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123
/***********************************************************************
 *           SPY_GetClassLongOffsetName
 *
 * Gets the name of a class long offset.
 */
const char *SPY_GetClassLongOffsetName( INT offset )
{
    INT index;
    if (offset < 0 && offset % 2 == 0 && ((index = -(offset + 8) / 2) <
	sizeof(ClassLongOffsetNames) / sizeof(*ClassLongOffsetNames)))
    {
        return ClassLongOffsetNames[index];
    }

    return "?";
}

2124 2125 2126 2127 2128 2129 2130 2131
/***********************************************************************
 *           SPY_GetClassName
 *
 *  Sets the value of "wnd_class" member of the instance structure.
 */
static void SPY_GetClassName( SPY_INSTANCE *sp_e )
{
    /* special code to detect a property sheet dialog   */
2132
    if ((GetClassLongW(sp_e->msg_hwnd, GCW_ATOM) == WC_DIALOG) &&
2133 2134 2135 2136 2137 2138 2139 2140
        (GetPropW(sp_e->msg_hwnd, PropSheetInfoStr))) {
        strcpyW(sp_e->wnd_class, WC_PROPSHEETW);
    }
    else {
        GetClassNameW(sp_e->msg_hwnd, sp_e->wnd_class, sizeof(sp_e->wnd_class)/sizeof(WCHAR));
    }
}

2141 2142 2143 2144
/***********************************************************************
 *           SPY_GetMsgStuff
 *
 *  Get message name and other information for dumping
Alexandre Julliard's avatar
Alexandre Julliard committed
2145
 */
2146
static void SPY_GetMsgStuff( SPY_INSTANCE *sp_e )
Alexandre Julliard's avatar
Alexandre Julliard committed
2147
{
2148
    const USER_MSG *p;
2149
    const char *msg_name = SPY_GetMsgInternal( sp_e->msgnum );
2150

2151
    sp_e->data_len = 0;
2152
    if (!msg_name)
2153
    {
2154
        INT i = 0;
2155

2156 2157 2158 2159 2160 2161 2162 2163 2164
        if (sp_e->msgnum >= 0xc000)
        {
            if (GlobalGetAtomNameA( sp_e->msgnum, sp_e->msg_name+1, sizeof(sp_e->msg_name)-2 ))
            {
                sp_e->msg_name[0] = '\"';
                strcat( sp_e->msg_name, "\"" );
                return;
            }
        }
2165 2166
        if (!sp_e->wnd_class[0]) SPY_GetClassName(sp_e);

2167
#if DEBUG_SPY
2168
        TRACE("looking class %s\n", debugstr_w(sp_e->wnd_class));
2169
#endif
2170

2171 2172
        while (cc_array[i].classname &&
               strcmpiW(cc_array[i].classname, sp_e->wnd_class) != 0) i++;
2173

2174
        if (cc_array[i].classname)
2175
        {
2176
#if DEBUG_SPY
2177 2178 2179
            TRACE("process class %s, first %p, last %p\n",
                  debugstr_w(cc_array[i].classname), cc_array[i].classmsg,
                  cc_array[i].lastmsg);
2180
#endif
2181 2182 2183
            p = SPY_Bsearch_Msg (cc_array[i].classmsg, cc_array[i].lastmsg,
                                 sp_e->msgnum);
            if (p) {
2184
                lstrcpynA (sp_e->msg_name, p->name, sizeof(sp_e->msg_name));
2185 2186 2187 2188
                sp_e->data_len = p->len;
                return;
            }
        }
2189 2190 2191 2192
        if (sp_e->msgnum >= WM_USER && sp_e->msgnum <= WM_APP)
            sprintf( sp_e->msg_name, "WM_USER+%d", sp_e->msgnum - WM_USER );
        else
            sprintf( sp_e->msg_name, "%04x", sp_e->msgnum );
2193 2194 2195
    }
    else
    {
2196
        lstrcpynA(sp_e->msg_name, msg_name, sizeof(sp_e->msg_name));
2197 2198 2199 2200 2201 2202
    }
}

/***********************************************************************
 *           SPY_GetWndName
 *
2203
 *  Sets the value of "wnd_name" and "wnd_class" members of the
2204 2205 2206
 *  instance structure.
 *
 */
2207
static void SPY_GetWndName( SPY_INSTANCE *sp_e )
2208
{
2209
    INT len;
2210

2211
    SPY_GetClassName( sp_e );
2212

2213 2214
    len = InternalGetWindowText(sp_e->msg_hwnd, sp_e->wnd_name, sizeof(sp_e->wnd_name)/sizeof(WCHAR));
    if(!len) /* get class name */
2215
    {
2216 2217 2218 2219 2220 2221 2222
        LPWSTR dst = sp_e->wnd_name;
        LPWSTR src = sp_e->wnd_class;
        int n = sizeof(sp_e->wnd_name)/sizeof(WCHAR) - 3;
        *dst++ = '{';
        while ((n-- > 0) && *src) *dst++ = *src++;
        *dst++ = '}';
        *dst = 0;
2223
    }
Alexandre Julliard's avatar
Alexandre Julliard committed
2224
}
2225

2226 2227 2228
/***********************************************************************
 *           SPY_GetMsgName
 *
2229
 *  ****  External function  ****
2230 2231 2232 2233 2234
 *
 *  Get message name
 */
const char *SPY_GetMsgName( UINT msg, HWND hWnd )
{
2235
    SPY_INSTANCE ext_sp_e;
2236
    DWORD save_error = GetLastError();
2237

2238 2239 2240 2241
    ext_sp_e.msgnum = msg;
    ext_sp_e.msg_hwnd   = hWnd;
    ext_sp_e.lParam = 0;
    ext_sp_e.wParam = 0;
2242
    ext_sp_e.wnd_class[0] = 0;
2243
    SPY_GetMsgStuff(&ext_sp_e);
2244
    SetLastError( save_error );
2245
    return wine_dbg_sprintf("%s", ext_sp_e.msg_name);
2246 2247
}

2248 2249 2250 2251 2252 2253 2254 2255
/***********************************************************************
 *           SPY_GetVKeyName
 */
const char *SPY_GetVKeyName(WPARAM wParam)
{
    const char *vk_key_name;

    if(wParam <= SPY_MAX_VKKEYSNUM && VK_KeyNames[wParam])
2256
        vk_key_name = VK_KeyNames[wParam];
2257
    else
2258
        vk_key_name = "VK_???";
2259 2260 2261 2262

    return vk_key_name;
}

2263 2264 2265
/***********************************************************************
 *           SPY_Bsearch_Notify
 */
2266
static const SPY_NOTIFY *SPY_Bsearch_Notify( const SPY_NOTIFY *first, const SPY_NOTIFY *last, UINT code)
2267 2268 2269 2270 2271
{
    INT count;
    const SPY_NOTIFY *test;

    while (last >= first) {
2272 2273
        count = 1 + last - first;
        if (count < 3) {
2274
#if DEBUG_SPY
2275 2276
            TRACE("code=%d, f-value=%d, f-name=%s, l-value=%d, l-name=%s, l-len=%d,\n",
               code, first->value, first->name, last->value, last->name, last->len);
2277
#endif
2278 2279 2280 2281 2282 2283
            if (first->value == code) return first;
            if (last->value == code) return last;
            return NULL;
        }
        count = count / 2;
        test = first + count;
2284
#if DEBUG_SPY
2285 2286
        TRACE("first=%p, last=%p, test=%p, t-value=%d, code=%d, count=%d\n",
           first, last, test, test->value, code, count);
2287
#endif
2288 2289 2290 2291 2292
        if (test->value == code) return test;
        if (test->value < code)
            last = test - 1;
        else
            first = test + 1;
2293 2294 2295 2296
    }
    return NULL;
}

2297 2298 2299
/***********************************************************************
 *           SPY_DumpMem
 */
2300
static void SPY_DumpMem (LPCSTR header, const UINT *q, INT len)
2301 2302 2303 2304
{
    int i;

    for(i=0; i<len-12; i+=16) {
2305 2306 2307
        TRACE("%s [%04x] %08x %08x %08x %08x\n",
              header, i, *q, *(q+1), *(q+2), *(q+3));
        q += 4;
2308
    }
2309 2310
    switch ((len - i + 3) & (~3)) {
    case 16:
2311 2312 2313
        TRACE("%s [%04x] %08x %08x %08x %08x\n",
              header, i, *q, *(q+1), *(q+2), *(q+3));
        break;
2314
    case 12:
2315 2316 2317
        TRACE("%s [%04x] %08x %08x %08x\n",
              header, i, *q, *(q+1), *(q+2));
        break;
2318
    case 8:
2319 2320 2321
        TRACE("%s [%04x] %08x %08x\n",
              header, i, *q, *(q+1));
        break;
2322
    case 4:
2323 2324 2325
        TRACE("%s [%04x] %08x\n",
              header, i, *q);
        break;
2326
    default:
2327
        break;
2328 2329 2330
    }
}

2331 2332 2333
/***********************************************************************
 *           SPY_DumpStructure
 */
2334
static void SPY_DumpStructure(const SPY_INSTANCE *sp_e, BOOL enter)
2335
{
2336
    switch (sp_e->msgnum)
2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369
        {
        case LVM_INSERTITEMW:
        case LVM_SETITEMW:
            if (!enter) break;
            /* fall through */
        case LVM_GETITEMW:
            {
                LPLVITEMA item = (LPLVITEMA) sp_e->lParam;
                if (item) {
                    SPY_DumpMem ("LVITEM", (UINT*)item, sizeof(LVITEMA));
                }
                break;
            }
        case TCM_INSERTITEMW:
        case TCM_INSERTITEMA:
        case TCM_SETITEMW:
        case TCM_SETITEMA:
            if (!enter) break;
            /* fall through */
        case TCM_GETITEMW:
        case TCM_GETITEMA:
            {
                TCITEMA *item = (TCITEMA *) sp_e->lParam;
                if (item) {
                    SPY_DumpMem ("TCITEM", (UINT*)item, sizeof(TCITEMA));
                }
                break;
            }
        case TCM_ADJUSTRECT:
        case LVM_GETITEMRECT:
        case LVM_GETSUBITEMRECT:
            {
                LPRECT rc = (LPRECT) sp_e->lParam;
2370 2371
                if (rc)
                    TRACE("lParam rect (%s)\n", wine_dbgstr_rect(rc));
2372 2373 2374 2375 2376 2377 2378 2379 2380 2381
                break;
            }
        case LVM_SETITEMPOSITION32:
            if (!enter) break;
            /* fall through */
        case LVM_GETITEMPOSITION:
        case LVM_GETORIGIN:
            {
                LPPOINT point = (LPPOINT) sp_e->lParam;
                if (point) {
2382
                    TRACE("lParam point x=%d, y=%d\n", point->x, point->y);
2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407
                }
                break;
            }
        case SBM_SETRANGE:
            if (!enter && (sp_e->msgnum == SBM_SETRANGE)) break;
            TRACE("min=%d max=%d\n", (INT)sp_e->wParam, (INT)sp_e->lParam);
            break;
        case SBM_GETRANGE:
            if ((enter && (sp_e->msgnum == SBM_GETRANGE)) ||
                (!enter && (sp_e->msgnum == SBM_SETRANGE))) break;
            {
                LPINT ptmin = (LPINT) sp_e->wParam;
                LPINT ptmax = (LPINT) sp_e->lParam;
                if (ptmin && ptmax)
                    TRACE("min=%d max=%d\n", *ptmin, *ptmax);
                else if (ptmin)
                    TRACE("min=%d max=n/a\n", *ptmin);
                else if (ptmax)
                    TRACE("min=n/a max=%d\n", *ptmax);
                break;
            }
        case EM_EXSETSEL:
            if (enter && sp_e->lParam)
            {
                CHARRANGE *cr = (CHARRANGE *) sp_e->lParam;
2408
                TRACE("CHARRANGE: cpMin=%d cpMax=%d\n", cr->cpMin, cr->cpMax);
2409 2410 2411 2412 2413 2414
            }
            break;
        case EM_SETCHARFORMAT:
            if (enter && sp_e->lParam)
            {
                CHARFORMATW *cf = (CHARFORMATW *) sp_e->lParam;
2415
                TRACE("CHARFORMAT: dwMask=0x%08x dwEffects=", cf->dwMask);
2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429
                if ((cf->dwMask & CFM_BOLD) && (cf->dwEffects & CFE_BOLD))
                    TRACE(" CFE_BOLD");
                if ((cf->dwMask & CFM_COLOR) && (cf->dwEffects & CFE_AUTOCOLOR))
                    TRACE(" CFE_AUTOCOLOR");
                if ((cf->dwMask & CFM_ITALIC) && (cf->dwEffects & CFE_ITALIC))
                    TRACE(" CFE_ITALIC");
                if ((cf->dwMask & CFM_PROTECTED) && (cf->dwEffects & CFE_PROTECTED))
                    TRACE(" CFE_PROTECTED");
                if ((cf->dwMask & CFM_STRIKEOUT) && (cf->dwEffects & CFE_STRIKEOUT))
                    TRACE(" CFE_STRIKEOUT");
                if ((cf->dwMask & CFM_UNDERLINE) && (cf->dwEffects & CFE_UNDERLINE))
                    TRACE(" CFE_UNDERLINE");
                TRACE("\n");
                if (cf->dwMask & CFM_SIZE)
2430
                    TRACE("yHeight=%d\n", cf->yHeight);
2431
                if (cf->dwMask & CFM_OFFSET)
2432
                    TRACE("yOffset=%d\n", cf->yOffset);
2433
                if ((cf->dwMask & CFM_COLOR) && !(cf->dwEffects & CFE_AUTOCOLOR))
2434
                    TRACE("crTextColor=%x\n", cf->crTextColor);
2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450
                TRACE("bCharSet=%x bPitchAndFamily=%x\n", cf->bCharSet, cf->bPitchAndFamily);
                /* FIXME: we should try to be a bit more intelligent about
                 * whether this is in ANSI or Unicode (it could be either) */
                if (cf->dwMask & CFM_FACE)
                    TRACE("szFaceName=%s\n", debugstr_wn(cf->szFaceName, LF_FACESIZE));
                /* FIXME: handle CHARFORMAT2 too */
            }
            break;
        case WM_DRAWITEM:
            if (!enter) break;
            {
                DRAWITEMSTRUCT *lpdis = (DRAWITEMSTRUCT*) sp_e->lParam;
                TRACE("DRAWITEMSTRUCT: CtlType=0x%08x CtlID=0x%08x\n",
                      lpdis->CtlType, lpdis->CtlID);
                TRACE("itemID=0x%08x itemAction=0x%08x itemState=0x%08x\n",
                      lpdis->itemID, lpdis->itemAction, lpdis->itemState);
2451 2452 2453
                TRACE("hWnd=%p hDC=%p (%s) itemData=0x%08lx\n",
                      lpdis->hwndItem, lpdis->hDC,
                      wine_dbgstr_rect(&lpdis->rcItem), lpdis->itemData);
2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465
            }
            break;
        case WM_MEASUREITEM:
            {
                MEASUREITEMSTRUCT *lpmis = (MEASUREITEMSTRUCT*) sp_e->lParam;
                TRACE("MEASUREITEMSTRUCT: CtlType=0x%08x CtlID=0x%08x\n",
                      lpmis->CtlType, lpmis->CtlID);
                TRACE("itemID=0x%08x itemWidth=0x%08x itemHeight=0x%08x\n",
                      lpmis->itemID, lpmis->itemWidth, lpmis->itemHeight);
                TRACE("itemData=0x%08lx\n", lpmis->itemData);
            }
            break;
2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482
        case WM_NCCREATE:
        case WM_CREATE:
        {
            BOOL unicode;
            CREATESTRUCTA *cs;

            if (!enter) break;

            unicode = IsWindowUnicode(sp_e->msg_hwnd);
            cs = (CREATESTRUCTA *)sp_e->lParam;
            TRACE("%s %s ex=%08x style=%08x %d,%d %dx%d parent=%p menu=%p inst=%p params=%p\n",
                  unicode ? debugstr_w((LPCWSTR)cs->lpszName) : debugstr_a(cs->lpszName),
                  unicode ? debugstr_w((LPCWSTR)cs->lpszClass) : debugstr_a(cs->lpszClass),
                  cs->dwExStyle, cs->style, cs->x, cs->y, cs->cx, cs->cy,
                  cs->hwndParent, cs->hMenu, cs->hInstance, cs->lpCreateParams);
            break;
        }
2483 2484 2485 2486
        case WM_SIZE:
            if (!enter) break;
            TRACE("cx=%d cy=%d\n", LOWORD(sp_e->lParam), HIWORD(sp_e->lParam));
            break;
2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501
        case WM_WINDOWPOSCHANGED:
            if (!enter) break;
        case WM_WINDOWPOSCHANGING:
            {
                WINDOWPOS *lpwp = (WINDOWPOS *)sp_e->lParam;
                TRACE("WINDOWPOS hwnd=%p, after=%p, at (%d,%d) w=%d h=%d, flags=0x%08x\n",
                      lpwp->hwnd, lpwp->hwndInsertAfter, lpwp->x, lpwp->y,
                      lpwp->cx, lpwp->cy, lpwp->flags);
            }
            break;
        case WM_STYLECHANGED:
            if (!enter) break;
        case WM_STYLECHANGING:
            {
                LPSTYLESTRUCT ss = (LPSTYLESTRUCT) sp_e->lParam;
2502
                TRACE("STYLESTRUCT: StyleOld=0x%08x, StyleNew=0x%08x\n",
2503 2504 2505 2506 2507 2508
                      ss->styleOld, ss->styleNew);
            }
            break;
        case WM_NCCALCSIZE:
            {
                RECT *rc = (RECT *)sp_e->lParam;
2509
                TRACE("Rect (%s)\n", wine_dbgstr_rect(rc));
2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523
            }
            break;
        case WM_NOTIFY:
            /* if (!enter) break; */
            {
                NMHDR * pnmh = (NMHDR*) sp_e->lParam;
                UINT *q, dumplen;
                const SPY_NOTIFY *p;
                WCHAR from_class[60];
                DWORD save_error;

                p = SPY_Bsearch_Notify (&spnfy_array[0], end_spnfy_array,
                                        pnmh->code);
                if (p) {
2524
                    TRACE("NMHDR hwndFrom=%p idFrom=0x%08lx code=%s<0x%08x>, extra=0x%x\n",
2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536
                          pnmh->hwndFrom, pnmh->idFrom, p->name, pnmh->code, p->len);
                    dumplen = p->len;

                    /* for CUSTOMDRAW, dump all the data for TOOLBARs */
                    if (pnmh->code == NM_CUSTOMDRAW) {
                        /* save and restore error code over the next call */
                        save_error = GetLastError();
                        GetClassNameW(pnmh->hwndFrom, from_class,
                                      sizeof(from_class)/sizeof(WCHAR));
                        SetLastError(save_error);
                        if (strcmpW(TOOLBARCLASSNAMEW, from_class) == 0)
                            dumplen = sizeof(NMTBCUSTOMDRAW)-sizeof(NMHDR);
2537 2538
                    } else if ( pnmh->code >= HDN_ENDDRAG
                                && pnmh->code <= HDN_ITEMCHANGINGA ) {
2539 2540 2541 2542 2543 2544 2545 2546
                        dumplen = sizeof(NMHEADERA)-sizeof(NMHDR);
                    }
                    if (dumplen > 0) {
                        q = (UINT *)(pnmh + 1);
                        SPY_DumpMem ("NM extra", q, (INT)dumplen);
                    }
                }
                else
2547
                    TRACE("NMHDR hwndFrom=%p idFrom=0x%08lx code=0x%08x\n",
2548 2549 2550 2551 2552 2553 2554
                          pnmh->hwndFrom, pnmh->idFrom, pnmh->code);
            }
        default:
            if (sp_e->data_len > 0)
                SPY_DumpMem ("MSG lParam", (UINT *)sp_e->lParam, sp_e->data_len);
            break;
        }
2555

2556
}
Alexandre Julliard's avatar
Alexandre Julliard committed
2557 2558
/***********************************************************************
 *           SPY_EnterMessage
Alexandre Julliard's avatar
Alexandre Julliard committed
2559
 */
2560 2561
void SPY_EnterMessage( INT iFlag, HWND hWnd, UINT msg,
                       WPARAM wParam, LPARAM lParam )
Alexandre Julliard's avatar
Alexandre Julliard committed
2562
{
2563
    SPY_INSTANCE sp_e;
2564
    int indent;
2565
    DWORD save_error = GetLastError();
Alexandre Julliard's avatar
Alexandre Julliard committed
2566

Alexandre Julliard's avatar
Alexandre Julliard committed
2567
    if (!TRACE_ON(message) || SPY_EXCLUDE(msg)) return;
Alexandre Julliard's avatar
Alexandre Julliard committed
2568

2569
    sp_e.msgnum = msg;
2570
    sp_e.msg_hwnd = hWnd;
2571 2572 2573 2574
    sp_e.lParam = lParam;
    sp_e.wParam = wParam;
    SPY_GetWndName(&sp_e);
    SPY_GetMsgStuff(&sp_e);
2575
    indent = get_indent_level();
2576

Alexandre Julliard's avatar
Alexandre Julliard committed
2577
    /* each SPY_SENDMESSAGE must be complemented by call to SPY_ExitMessage */
Alexandre Julliard's avatar
Alexandre Julliard committed
2578
    switch(iFlag)
Alexandre Julliard's avatar
Alexandre Julliard committed
2579
    {
2580
    case SPY_DISPATCHMESSAGE:
2581
        TRACE("%*s(%p) %-16s [%04x] %s dispatched  wp=%08lx lp=%08lx\n",
2582
                        indent, "", hWnd, debugstr_w(sp_e.wnd_name), msg,
2583
                        sp_e.msg_name, wParam, lParam);
Alexandre Julliard's avatar
Alexandre Julliard committed
2584 2585
        break;

2586
    case SPY_SENDMESSAGE:
Alexandre Julliard's avatar
Alexandre Julliard committed
2587
        {
2588 2589
            char taskName[20];
            DWORD tid = GetWindowThreadProcessId( hWnd, NULL );
Alexandre Julliard's avatar
Alexandre Julliard committed
2590

2591
            if (tid == GetCurrentThreadId()) strcpy( taskName, "self" );
2592
            else sprintf( taskName, "tid %04x", GetCurrentThreadId() );
Alexandre Julliard's avatar
Alexandre Julliard committed
2593

2594 2595 2596 2597
            TRACE("%*s(%p) %-16s [%04x] %s sent from %s wp=%08lx lp=%08lx\n",
                  indent, "", hWnd, debugstr_w(sp_e.wnd_name), msg,
                  sp_e.msg_name, taskName, wParam, lParam );
            SPY_DumpStructure(&sp_e, TRUE);
Alexandre Julliard's avatar
Alexandre Julliard committed
2598
        }
2599
        break;
Alexandre Julliard's avatar
Alexandre Julliard committed
2600

2601
    case SPY_DEFWNDPROC:
2602
        if( SPY_ExcludeDWP ) return;
2603 2604
        TRACE("%*s(%p)  DefWindowProc:[%04x] %s  wp=%08lx lp=%08lx\n",
              indent, "", hWnd, msg, sp_e.msg_name, wParam, lParam );
Alexandre Julliard's avatar
Alexandre Julliard committed
2605
        break;
2606 2607
    }
    set_indent_level( indent + SPY_INDENT_UNIT );
2608
    SetLastError( save_error );
Alexandre Julliard's avatar
Alexandre Julliard committed
2609
}
Alexandre Julliard's avatar
Alexandre Julliard committed
2610

Alexandre Julliard's avatar
Alexandre Julliard committed
2611 2612 2613 2614

/***********************************************************************
 *           SPY_ExitMessage
 */
2615 2616
void SPY_ExitMessage( INT iFlag, HWND hWnd, UINT msg, LRESULT lReturn,
                       WPARAM wParam, LPARAM lParam )
Alexandre Julliard's avatar
Alexandre Julliard committed
2617
{
2618
    SPY_INSTANCE sp_e;
2619
    int indent;
2620
    DWORD save_error = GetLastError();
Alexandre Julliard's avatar
Alexandre Julliard committed
2621

Alexandre Julliard's avatar
Alexandre Julliard committed
2622
    if (!TRACE_ON(message) || SPY_EXCLUDE(msg) ||
2623
        (SPY_ExcludeDWP && iFlag == SPY_RESULT_DEFWND))
2624
        return;
Alexandre Julliard's avatar
Alexandre Julliard committed
2625

2626 2627 2628 2629 2630 2631 2632
    sp_e.msgnum = msg;
    sp_e.msg_hwnd   = hWnd;
    sp_e.lParam = lParam;
    sp_e.wParam = wParam;
    SPY_GetWndName(&sp_e);
    SPY_GetMsgStuff(&sp_e);

2633 2634 2635 2636 2637
    if ((indent = get_indent_level()))
    {
        indent -= SPY_INDENT_UNIT;
        set_indent_level( indent );
    }
Alexandre Julliard's avatar
Alexandre Julliard committed
2638 2639

    switch(iFlag)
Alexandre Julliard's avatar
Alexandre Julliard committed
2640
    {
2641
    case SPY_RESULT_DEFWND:
2642 2643
        TRACE(" %*s(%p)  DefWindowProc: [%04x] %s returned %08lx\n",
              indent, "", hWnd, msg, sp_e.msg_name, lReturn );
Alexandre Julliard's avatar
Alexandre Julliard committed
2644
        break;
Alexandre Julliard's avatar
Alexandre Julliard committed
2645

2646
    case SPY_RESULT_OK:
2647
        TRACE(" %*s(%p) %-16s [%04x] %s returned %08lx\n",
2648
                        indent, "", hWnd, debugstr_w(sp_e.wnd_name), msg,
2649
                        sp_e.msg_name, lReturn );
2650
        SPY_DumpStructure(&sp_e, FALSE);
2651
        break;
2652 2653
    }
    SetLastError( save_error );
Alexandre Julliard's avatar
Alexandre Julliard committed
2654 2655
}

Alexandre Julliard's avatar
Alexandre Julliard committed
2656 2657 2658

/***********************************************************************
 *           SPY_Init
Alexandre Julliard's avatar
Alexandre Julliard committed
2659
 */
Alexandre Julliard's avatar
Alexandre Julliard committed
2660
int SPY_Init(void)
Alexandre Julliard's avatar
Alexandre Julliard committed
2661
{
2662 2663
    int i;
    UINT j;
Alexandre Julliard's avatar
Alexandre Julliard committed
2664
    char buffer[1024];
2665
    const SPY_NOTIFY *p;
2666
    const USER_MSG *q;
2667
    HKEY hkey;
Alexandre Julliard's avatar
Alexandre Julliard committed
2668

Alexandre Julliard's avatar
Alexandre Julliard committed
2669
    if (!TRACE_ON(message)) return TRUE;
Alexandre Julliard's avatar
Alexandre Julliard committed
2670

2671
    indent_tls_index = TlsAlloc();
2672 2673
    /* @@ Wine registry key: HKCU\Software\Wine\Debug */
    if(!RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Debug", &hkey))
2674
    {
2675
        DWORD type, count = sizeof(buffer);
Alexandre Julliard's avatar
Alexandre Julliard committed
2676

2677
        buffer[0] = 0;
2678
        if (!RegQueryValueExA(hkey, "SpyInclude", 0, &type, (LPBYTE) buffer, &count) &&
2679 2680 2681
            strcmp( buffer, "INCLUDEALL" ))
        {
            TRACE("Include=%s\n", buffer );
Alexandre Julliard's avatar
Alexandre Julliard committed
2682
            for (i = 0; i <= SPY_MAX_MSGNUM; i++)
2683 2684
                SPY_Exclude[i] = (MessageTypeNames[i] && !strstr(buffer,MessageTypeNames[i]));
        }
Alexandre Julliard's avatar
Alexandre Julliard committed
2685

2686 2687
        count = sizeof(buffer);
        buffer[0] = 0;
2688
        if (!RegQueryValueExA(hkey, "SpyExclude", 0, &type, (LPBYTE) buffer, &count))
2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699
        {
            TRACE("Exclude=%s\n", buffer );
            if (!strcmp( buffer, "EXCLUDEALL" ))
                for (i = 0; i <= SPY_MAX_MSGNUM; i++) SPY_Exclude[i] = TRUE;
            else
                for (i = 0; i <= SPY_MAX_MSGNUM; i++)
                    SPY_Exclude[i] = (MessageTypeNames[i] && strstr(buffer,MessageTypeNames[i]));
        }

        SPY_ExcludeDWP = 0;
        count = sizeof(buffer);
2700
        if(!RegQueryValueExA(hkey, "SpyExcludeDWP", 0, &type, (LPBYTE) buffer, &count))
2701 2702 2703
            SPY_ExcludeDWP = atoi(buffer);

        RegCloseKey(hkey);
2704
    }
Alexandre Julliard's avatar
Alexandre Julliard committed
2705

2706 2707
    /* find last good entry in spy notify array and save addr for b-search */
    p = &spnfy_array[0];
2708 2709
    j = 0xffffffff;
    while (p->name) {
2710
        if (p->value > j) {
2711 2712 2713 2714 2715 2716 2717
            ERR("Notify message array out of order\n");
            ERR("  between values [%08x] %s and [%08x] %s\n",
                j, (p-1)->name, p->value, p->name);
            break;
        }
        j = p->value;
        p++;
2718
    }
2719 2720 2721
    p--;
    end_spnfy_array = p;

2722
    /* find last good entry in each common control message array
2723 2724 2725 2726 2727
     *  and save addr for b-search.
     */
    i = 0;
    while (cc_array[i].classname) {

2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741
        j = 0x0400; /* minimum entry in array */
        q = cc_array[i].classmsg;
        while(q->name) {
            if (q->value <= j) {
                ERR("Class message array out of order for class %s\n",
                    debugstr_w(cc_array[i].classname));
                ERR("  between values [%04x] %s and [%04x] %s\n",
                    j, (q-1)->name, q->value, q->name);
                break;
            }
            j = q->value;
            q++;
        }
        q--;
2742
        cc_array[i].lastmsg = q;
2743 2744

        i++;
2745 2746
    }

Alexandre Julliard's avatar
Alexandre Julliard committed
2747 2748
    return 1;
}