3 * Copyright 1994, Bob Amstadt
9 #include <X11/Xresource.h>
18 #define SPY_MAX_MSGNUM 0x0232
20 const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] =
38 "WM_CLOSE", /* 0x10 */
54 "WM_SETCURSOR", /* 0x20 */
70 "WM_SETFONT", /* 0x30 */
71 "WM_GETFONT", NULL, NULL, NULL, NULL, NULL, NULL,
72 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
75 NULL, NULL, NULL, NULL, NULL, NULL,
76 "WM_WINDOWPOSCHANGING", /* 0x0046 */
77 "WM_WINDOWPOSCHANGED", /* 0x0047 */
78 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
81 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
82 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
85 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
86 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
89 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
90 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
93 "WM_NCCREATE", /* 0x0081 */
94 "WM_NCDESTROY", /* 0x0082 */
95 "WM_NCCALCSIZE", /* 0x0083 */
96 "WM_NCHITTEST", /* 0x0084 */
97 "WM_NCPAINT", /* 0x0085 */
98 "WM_NCACTIVATE", /* 0x0086 */
99 "WM_GETDLGCODE", /* 0x0087 */
100 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
103 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
104 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
107 "WM_NCMOUSEMOVE", /* 0x00A0 */
108 "WM_NCLBUTTONDOWN", /* 0x00A1 */
109 "WM_NCLBUTTONUP", /* 0x00A2 */
110 "WM_NCLBUTTONDBLCLK", /* 0x00A3 */
111 "WM_NCRBUTTONDOWN", /* 0x00A4 */
112 "WM_NCRBUTTONUP", /* 0x00A5 */
113 "WM_NCRBUTTONDBLCLK", /* 0x00A6 */
114 "WM_NCMBUTTONDOWN", /* 0x00A7 */
115 "WM_NCMBUTTONUP", /* 0x00A8 */
116 "WM_NCMBUTTONDBLCLK", /* 0x00A9 */
117 NULL, NULL, NULL, NULL, NULL, NULL,
120 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
121 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
124 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
125 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
128 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
129 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
132 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
133 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
136 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
137 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
139 "WM_KEYDOWN", /* 0x0100 */
140 "WM_KEYUP", /* 0x0101 */
141 "WM_CHAR", /* 0x0102 */
142 "WM_DEADCHAR", /* 0x0103 */
143 "WM_SYSKEYDOWN", /* 0x0104 */
144 "WM_SYSKEYUP", /* 0x0105 */
145 "WM_SYSCHAR", /* 0x0106 */
146 "WM_SYSDEADCHAR", /* 0x0107 */
147 "WM_KEYLAST", /* 0x0108 */
148 NULL, NULL, NULL, NULL, NULL, NULL, NULL,
150 "WM_INITDIALOG", /* 0x0110 */
151 "WM_COMMAND", /* 0x0111 */
152 "WM_SYSCOMMAND", /* 0x0112 */
153 "WM_TIMER", /* 0x0113 */
154 "WM_HSCROLL", /* 0x0114 */
155 "WM_VSCROLL", /* 0x0115 */
156 "WM_INITMENU", /* 0x0116 */
157 "WM_INITMENUPOPUP", /* 0x0117 */
158 "WM_SYSTIMER", /* 0x0118 */
159 NULL, NULL, NULL, NULL, NULL, NULL,
160 "WM_MENUSELECT", /* 0x011f */
162 "WM_MENUCHAR", /* 0x0120 */
163 "WM_ENTERIDLE", /* 0x0121 */
164 NULL, NULL, NULL, NULL, NULL, NULL,
165 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
168 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
169 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
172 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
173 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
176 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
177 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
180 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
181 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
184 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
185 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
188 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
189 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
192 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
193 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
196 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
197 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
200 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
201 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
204 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
205 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
208 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
209 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
212 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
213 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
216 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
217 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
219 "WM_MOUSEMOVE", /* 0x0200 */
220 "WM_LBUTTONDOWN", /* 0x0201 */
221 "WM_LBUTTONUP", /* 0x0202 */
222 "WM_LBUTTONDBLCLK", /* 0x0203 */
223 "WM_RBUTTONDOWN", /* 0x0204 */
224 "WM_RBUTTONUP", /* 0x0205 */
225 "WM_RBUTTONDBLCLK", /* 0x0206 */
226 "WM_MBUTTONDOWN", /* 0x0207 */
227 "WM_MBUTTONUP", /* 0x0208 */
228 "WM_MBUTTONDBLCLK", /* 0x0209 */
229 NULL, NULL, NULL, NULL, NULL, NULL,
231 "WM_PARENTNOTIFY", /* 0x0210 */
232 "WM_ENTERMENULOOP", /* 0x0211 */
233 "WM_EXITMENULOOP", /* 0x0212 */
234 NULL, NULL, NULL, NULL, NULL,
235 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
237 "WM_MDICREATE", /* 0x0220 */
238 "WM_MDIDESTROY", /* 0x0221 */
239 "WM_MDIACTIVATE", /* 0x0222 */
240 "WM_MDIRESTORE", /* 0x0223 */
241 "WM_MDINEXT", /* 0x0224 */
242 "WM_MDIMAXIMIZE", /* 0x0225 */
243 "WM_MDITILE", /* 0x0226 */
244 "WM_MDICASCADE", /* 0x0227 */
245 "WM_MDIICONARRANGE", /* 0x0228 */
246 "WM_MDIGETACTIVE", /* 0x0229 */
248 "WM_MDISETMENU", /* 0x0230 */
249 "WM_ENTERSIZEMOVE", /* 0x0231 */
250 "WM_EXITSIZEMOVE" /* 0x0232 */
253 char SpyFilters[256+1];
254 char SpyIncludes[256+1];
258 /**********************************************************************
261 void SpyMessage(HWND hwnd, WORD msg, WORD wParam, LONG lParam)
269 if (msg > SPY_MAX_MSGNUM || MessageTypeNames[msg] == NULL)
270 sprintf(msg_name, "%04x", msg);
272 strcpy(msg_name, MessageTypeNames[msg]);
274 strcat(msg_name, ";");
276 if ((strlen(SpyIncludes) == 0 || strstr(SpyIncludes, msg_name) != NULL) &&
277 strstr(SpyFilters, msg_name) == NULL)
279 msg_name[strlen(msg_name) - 1] = '\0';
280 fprintf(SpyFp, "%04x %20.20s %04x %04x %08lx\n",
281 hwnd, msg_name, msg, wParam, lParam);
286 /**********************************************************************
297 if (Options.spyFilename == NULL)
299 GetPrivateProfileString("spy", "file", "", filename, sizeof(filename),
303 strncpy(filename, Options.spyFilename, 100);
305 if (strcasecmp(filename, "CON") == 0)
307 else if (strlen(filename))
308 SpyFp = fopen(filename, "a");
315 GetPrivateProfileString("spy", "exclude", "", SpyFilters,
316 sizeof(SpyFilters)-1, WINE_INI);
317 GetPrivateProfileString("spy", "include", "", SpyIncludes,
318 sizeof(SpyIncludes)-1, WINE_INI);
320 if (*SpyIncludes != 0) {
321 strcat(SpyIncludes, ";");
323 if (*SpyFilters != 0) {
324 strcat(SpyFilters, ";");