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