uiautomationcore: Initialize VARIANT in test_uia_prov_from_acc_properties() (Coverity).
[wine.git] / tools / winapi / winapi_module_user.pm
blob53bce8e5b8a46427486ddf1882a977620aa4c92e
2 # Copyright 1999, 2000, 2001 Patrik Stridvall
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 package winapi_module_user;
21 use strict;
22 use warnings 'all';
24 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
25 require Exporter;
27 @ISA = qw(Exporter);
28 @EXPORT = qw();
29 @EXPORT_OK = qw(
30 is_user_function
31 get_message_result_type
32 get_message_result_kind
33 get_message_wparam_type
34 get_message_wparam_kind
35 get_message_lparam_type
36 get_message_lparam_kind
39 use config qw($wine_dir);
40 use options qw($options);
41 use output qw($output);
43 use c_parser;
45 ########################################################################
47 my $message;
49 ########################################################################
50 # is_user_function
52 sub is_user_function($) {
53 my $name = shift;
54 if($name =~ /^(?:DefWindowProc|SendMessage)[AW]?$/) {
58 ########################################################################
59 # $message
61 $message = {
62 WM_ACTIVATE => {
63 id => 0x0006, result => "void", wparam => ["", ""], lparam => "HWND" },
64 WM_ACTIVATEAPP => {
65 id => 0x001c, result => "void", wparam => "BOOL", lparam => "DWORD" },
66 WM_ACTIVATESHELLWINDOW => {
67 id => 0x003e, result => "", wparam => "", lparam => "" },
68 WM_ACTIVATETOPLEVEL => {
69 id => 0x036e, result => "", wparam => "", lparam => "" },
70 WM_ALTTABACTIVE => {
71 id => 0x0029, result => "", wparam => "", lparam => "" },
72 WM_APP => {
73 id => 0x8000, result => "", wparam => "", lparam => "" },
74 WM_ASKCBFORMATNAME => {
75 id => 0x030c, result => "void", wparam => "int", lparam => "LPTSTR" },
77 WM_BEGINDRAG => {
78 id => 0x022c, result => "", wparam => "", lparam => "" },
80 WM_CANCELMODE => {
81 id => 0x001f, result => "void", wparam => "void", lparam => "void" },
82 WM_CANCELJOURNAL => {
83 id => 0x004b, result => "", wparam => "", lparam => "" },
84 WM_CAPTURECHANGED => {
85 id => 0x0215, result => "void", wparam => "void", lparam => "HWND" },
86 WM_CHANGECBCHAIN => {
87 id => 0x030d, result => "void", wparam => "HWND", lparam => "HWND" },
88 WM_CHILDACTIVATE => {
89 id => 0x0022, result => "void", wparam => "void", lparam => "void" },
90 WM_CLEAR => {
91 id => 0x0303, result => "void", wparam => "void", lparam => "void" },
92 WM_CHAR => {
93 id => 0x0102, result => "void", wparam => "TCHAR", lparam => ["", ""] },
94 WM_CHARTOITEM => {
95 id => 0x002f, result => "int", wparam => ["UINT", "UINT"], lparam => "HWND" },
96 WM_CLOSE => {
97 id => 0x0010, result => "void", wparam => "void", lparam => "void" },
98 WM_COALESCE_FIRST => {
99 id => 0x0390, result => "", wparam => "", lparam => "" },
100 WM_COALESCE_LAST => {
101 id => 0x039f, result => "", wparam => "", lparam => "" },
102 WM_COMMAND => {
103 id => 0x0111, result => "void", wparam => ["UINT", "UINT"], lparam => "HWND" },
104 WM_COMMANDHELP => {
105 id => 0x0365, result => "", wparam => "", lparam => "" },
106 WM_COMMNOTIFY => {
107 id => 0x0044, result => "void", wparam => "int", lparam => ["", ""] },
108 WM_CONTEXTMENU => {
109 id => 0x007b, result => "void", wparam => "HWND", lparam => ["UINT", "UINT"] },
110 WM_COPY => {
111 id => 0x0301, result => "void", wparam => "void", lparam => "void" },
112 WM_COPYDATA => {
113 id => 0x004a, result => "", wparam => "", lparam => "" },
114 WM_COMPACTING => {
115 id => 0x0041, result => "void", wparam => "UINT", lparam => "void" },
116 WM_COMPAREITEM => {
117 id => 0x0039, result => "int", wparam => "UINT", lparam => "const COMPAREITEMSTRUCT *" },
118 WM_CREATE => {
119 id => 0x0001, result => "BOOL", wparam => "void", lparam => "LPCREATESTRUCT" },
120 WM_CTLCOLOR => {
121 id => 0x0019, result => "", wparam => "", lparam => "" },
122 WM_CTLCOLORBTN => {
123 id => 0x0135, result => "HBRUSH", wparam => "HDC", lparam => "HWND" },
124 WM_CTLCOLORDLG => {
125 id => 0x136, result => "HBRUSH", wparam => "HDC", lparam => "HWND" },
126 WM_CTLCOLOREDIT => {
127 id => 0x133, result => "HBRUSH", wparam => "HDC", lparam => "HWND" },
128 WM_CTLCOLORLISTBOX => {
129 id => 0x134, result => "HBRUSH", wparam => "HDC", lparam => "HWND" },
130 WM_CTLCOLORMSGBOX => {
131 id => 0x132, result => "HBRUSH", wparam => "HDC", lparam => "HWND" },
132 WM_CTLCOLORSCROLLBAR => {
133 id => 0x137, result => "HBRUSH", wparam => "HDC", lparam => "HWND" },
134 WM_CTLCOLORSTATIC => {
135 id => 0x138, result => "HBRUSH", wparam => "HDC", lparam => "HWND" },
136 WM_CUT => {
137 id => 0x0300, result => "void", wparam => "void", lparam => "void" },
139 WM_DDE_ACK => { # FIXME: Only correct if replying to WM_DDE_INITIATE
140 id => 0x03E4, result => "void", wparam => "HWND", lparam => ["ATOM", "ATOM"] },
141 WM_DDE_INITIATE => {
142 id => 0x03E0, result => "void", wparam => "HWND", lparam => ["ATOM", "ATOM"] },
143 WM_DEADCHAR => {
144 id => 0x0103, result => "void", wparam => "TCHAR", lparam => ["", ""] },
145 WM_DEVICECHANGE => {
146 id => 0x0219, result => "BOOL", wparam => "UINT", lparam => "DWORD" },
147 WM_DELETEITEM => {
148 id => 0x002d, result => "void", wparam => "UINT", lparam => "const DELETEITEMSTRUCT *" },
149 WM_DEVMODECHANGE => {
150 id => 0x001b, result => "void", wparam => "void", lparam => "LPCTSTR" },
151 WM_DESTROY => {
152 id => 0x0002, result => "void", wparam => "void", lparam => "void" },
153 WM_DESTROYCLIPBOARD => {
154 id => 0x0307, result => "void", wparam => "void", lparam => "void" },
155 WM_DISABLEMODAL => {
156 id => 0x036c, result => "", wparam => "", lparam => "" },
157 WM_DISPLAYCHANGE => {
158 id => 0x007e, result => "void", wparam => "UINT", lparam => ["UINT", "UINT"] },
159 WM_DRAGLOOP => {
160 id => 0x022d, result => "", wparam => "", lparam => "" },
161 WM_DRAGMOVE => {
162 id => 0x022f, result => "", wparam => "", lparam => "" },
163 WM_DRAGSELECT => {
164 id => 0x022e, result => "", wparam => "", lparam => "" },
165 WM_DRAWCLIPBOARD => {
166 id => 0x0308, result => "void", wparam => "void", lparam => "void" },
167 WM_DRAWITEM => {
168 id => 0x002b, result => "void", wparam => "UINT", lparam => "const DRAWITEMSTRUCT *" },
169 WM_DROPFILES => {
170 id => 0x0233, result => "void", wparam => "HDROP", lparam => "void" },
171 WM_DROPOBJECT => {
172 id => 0x022a, result => "", wparam => "", lparam => "" },
174 WM_ENABLE => {
175 id => 0x000a, result => "void", wparam => "BOOL", lparam => "void" },
176 WM_ENDSESSION => {
177 id => 0x0016, result => "void", wparam => "BOOL", lparam => "void" },
178 WM_ENTERIDLE => {
179 id => 0x0121, result => "void", wparam => "UINT", lparam => "HWND" },
180 WM_ENTERSIZEMOVE => {
181 id => 0x0231, result => "", wparam => "", lparam => "" },
182 WM_ENTERMENULOOP => {
183 id => 0x0211, result => "", wparam => "", lparam => "" },
184 WM_ERASEBKGND => {
185 id => 0x0014, result => "BOOL", wparam => "HDC", lparam => "void" },
186 WM_EXITHELPMODE => {
187 id => 0x0367, result => "", wparam => "", lparam => "" },
188 WM_EXITMENULOOP => {
189 id => 0x0212, result => "", wparam => "", lparam => "" },
190 WM_EXITSIZEMOVE => {
191 id => 0x0232, result => "", wparam => "", lparam => "" },
193 WM_FILESYSCHANGE => {
194 id => 0x0034, result => "", wparam => "", lparam => "" },
195 WM_FLOATSTATUS => {
196 id => 0x036d, result => "", wparam => "", lparam => "" },
197 WM_FONTCHANGE => {
198 id => 0x001d, result => "void", wparam => "void", lparam => "void" },
200 WM_GETDLGCODE => {
201 id => 0x0087, result => "UINT", wparam => "WPARAM", lparam => "LPMSG" },
202 WM_GETFONT => {
203 id => 0x0031, result => "HFONT", wparam => "void", lparam => "void" },
204 WM_GETHOTKEY => {
205 id => 0x0033, result => "", wparam => "", lparam => "" },
206 WM_GETICON => {
207 id => 0x007f, result => "", wparam => "", lparam => "" },
208 WM_GETMINMAXINFO => {
209 id => 0x0024, result => "void", wparam => "void", lparam => "LPMINMAXINFO" },
210 WM_GETTEXT => {
211 id => 0x000d, result => "int", wparam => "int", lparam => "LPTSTR" },
212 WM_GETTEXTLENGTH => {
213 id => 0x000e, result => "int", wparam => "void", lparam => "void" },
215 WM_HELP => {
216 id => 0x0053, result => "void", wparam => "void", lparam => "LPHELPINFO" },
217 WM_HELPHITTEST => {
218 id => 0x0366, result => "", wparam => "", lparam => "" },
219 WM_HOTKEY => {
220 id => 0x0312, result => "", wparam => "", lparam => "" },
221 WM_HSCROLL => {
222 id => 0x0114, result => "void", wparam => ["int", "int"], lparam => "HWND" },
223 WM_HSCROLLCLIPBOARD => {
224 id => 0x030e, result => "void", wparam => "HWND", lparam => "" },
226 WM_ICONERASEBKGND => {
227 id => 0x0027, result => "BOOL", wparam => "HDC", lparam => "void" },
228 WM_IME_CHAR => {
229 id => 0x0286, result => "", wparam => "", lparam => "" },
230 WM_IME_COMPOSITION => {
231 id => 0x010f, result => "", wparam => "", lparam => "" },
232 WM_IME_COMPOSITIONFULL => {
233 id => 0x0284, result => "", wparam => "", lparam => "" },
234 WM_IME_CONTROL => {
235 id => 0x0283, result => "", wparam => "", lparam => "" },
236 WM_IME_ENDCOMPOSITION => {
237 id => 0x010e, result => "", wparam => "", lparam => "" },
238 WM_IME_KEYDOWN => {
239 id => 0x0290, result => "void", wparam => "UINT", lparam => ["int", "UINT"] },
240 WM_IME_KEYLAST => {
241 id => 0x010f, result => "", wparam => "", lparam => "" },
242 WM_IME_KEYUP => {
243 id => 0x0291, result => "void", wparam => "UINT", lparam => ["int", "UINT"] },
244 WM_IME_NOTIFY => {
245 id => 0x0282, result => "", wparam => "", lparam => "" },
246 WM_IME_REQUEST => {
247 id => 0x0288, result => "", wparam => "", lparam => "" },
248 WM_IME_SELECT => {
249 id => 0x0285, result => "", wparam => "", lparam => "" },
250 WM_IME_SETCONTEXT => {
251 id => 0x0281, result => "", wparam => "", lparam => "" },
252 WM_IME_STARTCOMPOSITION => {
253 id => 0x010d, result => "", wparam => "", lparam => "" },
254 WM_IDLEUPDATECMDUI => {
255 id => 0x0363, result => "", wparam => "", lparam => "" },
256 WM_INITDIALOG => {
257 id => 0x0110, result => "BOOL", wparam => "HWND", lparam => "LPARAM" },
258 WM_INITIALUPDATE => {
259 id => 0x0364, result => "", wparam => "", lparam => "" },
260 WM_INITMENU => {
261 id => 0x0116, result => "void", wparam => "HMENU", lparam => "void" },
262 WM_INITMENUPOPUP => {
263 id => 0x0117, result => "void", wparam => "HMENU", lparam => ["UINT", "BOOL"] },
264 WM_INPUTLANGCHANGE => {
265 id => 0x0051, result => "", wparam => "", lparam => "" },
266 WM_INPUTLANGCHANGEREQUEST => {
267 id => 0x0050, result => "", wparam => "", lparam => "" },
268 WM_ISACTIVEICON => {
269 id => 0x0035, result => "", wparam => "", lparam => "" },
271 WM_KEYDOWN => {
272 id => 0x0100, result => "void", wparam => "UINT", lparam => ["int", "UINT"] },
273 WM_KEYLAST => {
274 id => 0x0108, result => "", wparam => "", lparam => "" },
275 WM_KICKIDLE => {
276 id => 0x036a, result => "", wparam => "", lparam => "" },
277 WM_KEYUP => {
278 id => 0x0101, result => "void", wparam => "UINT", lparam => ["", ""] },
279 WM_KILLFOCUS => {
280 id => 0x0008, result => "void", wparam => "HWND", lparam => "void" },
282 WM_LBTRACKPOINT => {
283 id => 0x0131, result => "", wparam => "", lparam => "" },
284 WM_LBUTTONDBLCLK => {
285 id => 0x0203, result => "void", wparam => "UINT", lparam => ["", ""] },
286 WM_LBUTTONDOWN => {
287 id => 0x0201, result => "void", wparam => "UINT", lparam => ["", ""] },
288 WM_LBUTTONUP => {
289 id => 0x0202, result => "void", wparam => "UINT", lparam => ["", ""] },
291 WM_MBUTTONDBLCLK => {
292 id => 0x0209, result => "void", wparam => "UINT", lparam => ["", ""] },
293 WM_MBUTTONDOWN => {
294 id => 0x0207, result => "void", wparam => "UINT", lparam => ["", ""] },
295 WM_MBUTTONUP => {
296 id => 0x0208, result => "void", wparam => "UINT", lparam => ["", ""] },
297 WM_MDIACTIVATE => {
298 id => 0x0222, result => "void", wparam => "HWND", lparam => "HWND" },
299 WM_MDICASCADE => {
300 id => 0x0227, result => "BOOL", wparam => "UINT", lparam => "void" },
301 WM_MDICREATE => {
302 id => 0x0220, result => "HWND", wparam => "void", lparam => "const LPMDICREATESTRUCT" },
303 WM_MDIDESTROY => {
304 id => 0x0221, result => "void", wparam => "HWND", lparam => "void" },
305 WM_MDIGETACTIVE => {
306 id => 0x0229, result => "HWND", wparam => "void", lparam => "void" },
307 WM_MDIICONARRANGE => {
308 id => 0x0228, result => "void", wparam => "void", lparam => "void" },
309 WM_MDIMAXIMIZE => {
310 id => 0x0225, result => "void", wparam => "HWND", lparam => "void" },
311 WM_MDINEXT => {
312 id => 0x0224, result => "HWND", wparam => "HWND", lparam => "BOOL" },
313 WM_MDIREFRESHMENU => {
314 id => 0x0234, result => "", wparam => "", lparam => "" },
315 WM_MDIRESTORE => {
316 id => 0x0223, result => "void", wparam => "HWND", lparam => "void" },
317 WM_MDISETMENU => {
318 id => 0x0230, result => "HMENU", wparam => "BOOL", lparam => "HMENU" },
319 WM_MDITILE => {
320 id => 0x0226, result => "BOOL", wparam => "UINT", lparam => "void" },
321 WM_MEASUREITEM => {
322 id => 0x002c, result => "void", wparam => "UINT", lparam => "MEASUREITEMSTRUCT *" },
323 WM_MENUSELECT => {
324 id => 0x011f, result => "void", wparam => ["", ""], lparam => "HMENU" },
325 WM_MENUCHAR => {
326 id => 0x0120, result => "DWORD", wparam => ["", "WORD"], lparam => "HMENU" },
327 WM_MOUSEACTIVATE => {
328 id => 0x0021, result => "int", wparam => "HWND", lparam => ["", ""] },
329 WM_MOUSEMOVE => {
330 id => 0x0200, result => "void", wparam => "UINT", lparam => ["", ""] },
331 WM_MOUSEWHEEL => {
332 id => 0x020a, result => "void", wparam => ["DWORD", "int"], lparam => ["UINT", "UINT"] },
333 WM_MOVE => {
334 id => 0x0003, result => "void", wparam => "void", lparam => ["", ""] },
335 WM_MOVING => {
336 id => 0x0216, result => "", wparam => "", lparam => "" },
338 WM_NCACTIVATE => {
339 id => 0x0086, result => "BOOL", wparam => "BOOL", lparam => "void" },
340 WM_NCLBUTTONDBLCLK => {
341 id => 0x00a3, result => "void", wparam => "UINT", lparam => ["", ""] },
342 WM_NCLBUTTONDOWN => {
343 id => 0x00a1, result => "void", wparam => "UINT", lparam => ["", ""] },
344 WM_NCLBUTTONUP => {
345 id => 0x00a2, result => "void", wparam => "UINT", lparam => ["", ""] },
346 WM_NCMOUSEMOVE => {
347 id => 0x00a0, result => "void", wparam => "UINT", lparam => ["", ""] },
348 WM_NCMBUTTONDBLCLK => {
349 id => 0x00a9, result => "void", wparam => "UINT", lparam => ["", ""] },
350 WM_NCMBUTTONDOWN => {
351 id => 0x00a7, result => "void", wparam => "UINT", lparam => ["", ""] },
352 WM_NCMBUTTONUP => {
353 id => 0x00a8, result => "void", wparam => "UINT", lparam => ["", ""] },
354 WM_NCRBUTTONDBLCLK => {
355 id => 0x00a6, result => "void", wparam => "UINT", lparam => ["", ""] },
356 WM_NCRBUTTONDOWN => {
357 id => 0x00a4, result => "void", wparam => "UINT", lparam => ["", ""] },
358 WM_NCRBUTTONUP => {
359 id => 0x00a5, result => "void", wparam => "UINT", lparam => ["", ""] },
360 WM_NCCALCSIZE => {
361 id => 0x0083, result => "UINT", wparam => "void", lparam => "NCCALCSIZE_PARAMS *" },
362 WM_NCCREATE => {
363 id => 0x0081, result => "BOOL", wparam => "void", lparam => "LPCREATESTRUCT" },
364 WM_NCDESTROY => {
365 id => 0x0082, result => "void", wparam => "void", lparam => "void" },
366 WM_NCHITTEST => {
367 id => 0x0084, result => "UINT", wparam => "void", lparam => ["int", "int"] },
368 WM_NCPAINT => {
369 id => 0x0085, result => "void", wparam => "HRGN", lparam => "void" },
370 WM_NEXTDLGCTL => {
371 id => 0x0028, result => "HWND", wparam => "HWND", lparam => "BOOL" },
372 WM_NEXTMENU => {
373 id => 0x0213, result => "void", wparam => "UINT", lparam => "LPMDINEXTMENU" },
374 WM_NOTIFY => {
375 id => 0x004e, result => "LRESULT", wparam => "int", lparam => "NMHDR *" },
376 WM_NOTIFYFORMAT => {
377 id => 0x0055, result => "", wparam => "", lparam => "" },
378 WM_NULL => {
379 id => 0x0000, result => "", wparam => "", lparam => "" },
381 WM_OCC_INITNEW => {
382 id => 0x0378, result => "", wparam => "", lparam => "" },
383 WM_OCC_LOADFROMSTORAGE => {
384 id => 0x0377, result => "", wparam => "", lparam => "" },
385 WM_OCC_LOADFROMSTORAGE_EX => {
386 id => 0x037b, result => "", wparam => "", lparam => "" },
387 WM_OCC_LOADFROMSTREAM => {
388 id => 0x0376, result => "", wparam => "", lparam => "" },
389 WM_OCC_LOADFROMSTREAM_EX => {
390 id => 0x037a, result => "", wparam => "", lparam => "" },
391 WM_OTHERWINDOWCREATED => {
392 id => 0x003c, result => "", wparam => "", lparam => "" },
393 WM_OTHERWINDOWDESTROYED => {
394 id => 0x003d, result => "", wparam => "", lparam => "" },
396 WM_PAINT => {
397 id => 0x000f, result => "void", wparam => "void", lparam => "void" },
398 WM_PAINTCLIPBOARD => {
399 id => 0x0309, result => "void", wparam => "HWND", lparam => "const LPPAINTSTRUCT" },
400 WM_PAINTICON => {
401 id => 0x0026, result => "", wparam => "", lparam => "" },
402 WM_PALETTEISCHANGING => {
403 id => 0x0310, result => "void", wparam => "HWND", lparam => "void" },
404 WM_PALETTECHANGED => {
405 id => 0x0311, result => "void", wparam => "HWND", lparam => "void" },
406 WM_PARENTNOTIFY => {
407 id => 0x0210, result => "void", wparam => ["UINT", "int"], lparam => "HWND" },
408 WM_PASTE => {
409 id => 0x0302, result => "void", wparam => "void", lparam => "void" },
410 WM_PENWINFIRST => {
411 id => 0x0380, result => "", wparam => "", lparam => "" },
412 WM_PENWINLAST => {
413 id => 0x038f, result => "", wparam => "", lparam => "" },
414 WM_POPMESSAGESTRING => {
415 id => 0x0375, result => "", wparam => "", lparam => "" },
416 WM_POWER => {
417 id => 0x0048, result => "void", wparam => "int", lparam => "void" },
418 WM_POWERBROADCAST => {
419 id => 0x0218, result => "", wparam => "", lparam => "" },
420 WM_PRINT => {
421 id => 0x0317, result => "", wparam => "", lparam => "" },
422 WM_PRINTCLIENT => {
423 id => 0x0318, result => "void", wparam => "HDC", lparam => "DWORD" },
425 WM_QUERY3DCONTROLS => {
426 id => 0x036f, result => "", wparam => "", lparam => "" },
427 WM_QUERYAFXWNDPROC => {
428 id => 0x0360, result => "", wparam => "", lparam => "" },
429 WM_QUERYCENTERWND => {
430 id => 0x036b, result => "", wparam => "", lparam => "" },
431 WM_QUERYDRAGICON => {
432 id => 0x0037, result => "HICON", wparam => "void", lparam => "void" },
433 WM_QUERYDROPOBJECT => {
434 id => 0x022b, result => "", wparam => "", lparam => "" },
435 WM_QUERYENDSESSION => {
436 id => 0x0011, result => "BOOL", wparam => "void", lparam => "void" },
437 WM_QUERYNEWPALETTE => {
438 id => 0x030f, result => "BOOL", wparam => "void", lparam => "void" },
439 WM_QUERYOPEN => {
440 id => 0x0013, result => "BOOL", wparam => "void", lparam => "void" },
441 WM_QUERYPARKICON => {
442 id => 0x0036, result => "", wparam => "", lparam => "" },
443 WM_QUERYSAVESTATE => {
444 id => 0x0038, result => "", wparam => "", lparam => "" },
445 WM_QUEUESYNC => {
446 id => 0x0023, result => "void", wparam => "void", lparam => "void" },
447 WM_QUEUE_SENTINEL => {
448 id => 0x0379, result => "", wparam => "", lparam => "" },
449 WM_QUIT => {
450 id => 0x0012, result => "void", wparam => "int", lparam => "void" },
452 WM_RBUTTONDBLCLK => {
453 id => 0x0206, result => "void", wparam => "UINT", lparam => ["", ""] },
454 WM_RBUTTONDOWN => {
455 id => 0x0204, result => "void", wparam => "UINT", lparam => ["", ""] },
456 WM_RBUTTONUP => {
457 id => 0x0205, result => "void", wparam => "UINT", lparam => ["", ""] },
458 WM_RECALCPARENT => {
459 id => 0x0368, result => "", wparam => "", lparam => "" },
460 WM_RENDERALLFORMATS => {
461 id => 0x0306, result => "void", wparam => "void", lparam => "void" },
462 WM_RENDERFORMAT => {
463 id => 0x0305, result => "HANDLE", wparam => "UINT", lparam => "void" },
465 WM_SETCURSOR => {
466 id => 0x0020, result => "BOOL", wparam => "HWND", lparam => ["UINT", "UINT"] },
467 WM_SETFOCUS => {
468 id => 0x0007, result => "void", wparam => "HWND", lparam => "void" },
469 WM_SETFONT => {
470 id => 0x0030, result => "void", wparam => "HFONT", lparam => "BOOL" },
471 WM_SETHOTKEY => {
472 id => 0x0032, result => "", wparam => "", lparam => "" },
473 WM_SETICON => {
474 id => 0x0080, result => "HICON", wparam => "DWORD", lparam => "HICON" },
475 WM_SETMESSAGESTRING => {
476 id => 0x0362, result => "", wparam => "", lparam => "" },
477 WM_SETREDRAW => {
478 id => 0x000b, result => "void", wparam => "BOOL", lparam => "void" },
479 WM_SETTEXT => {
480 id => 0x000c, result => "void", wparam => "void", lparam => "LPCTSTR" },
481 WM_SETVISIBLE => {
482 id => 0x0009, result => "", wparam => "", lparam => "" },
483 WM_SHOWWINDOW => {
484 id => 0x0018, result => "void", wparam => "BOOL", lparam => "UINT" },
485 WM_SIZE => {
486 id => 0x0005, result => "void", wparam => "UINT", lparam => ["", ""] },
487 WM_SIZECHILD => {
488 id => 0x0369, result => "", wparam => "", lparam => "" },
489 WM_SIZECLIPBOARD => {
490 id => 0x030b, result => "void", wparam => "HWND", lparam => "const LPRECT" },
491 WM_SIZEPARENT => {
492 id => 0x0361, result => "", wparam => "", lparam => "" },
493 WM_SIZEWAIT => {
494 id => 0x0004, result => "", wparam => "", lparam => "" },
495 WM_SIZING => {
496 id => 0x0214, result => "", wparam => "", lparam => "" },
497 WM_SOCKET_DEAD => {
498 id => 0x0374, result => "", wparam => "", lparam => "" },
499 WM_SOCKET_NOTIFY => {
500 id => 0x0373, result => "", wparam => "", lparam => "" },
501 WM_SPOOLERSTATUS => {
502 id => 0x002a, result => "void", wparam => "UINT", lparam => ["", ""] },
503 WM_STYLECHANGED => {
504 id => 0x007d, result => "void", wparam => "DWORD", lparam => "LPSTYLESTRUCT" },
505 WM_STYLECHANGING => {
506 id => 0x007c, result => "void", wparam => "DWORD", lparam => "LPSTYLESTRUCT" },
507 WM_SYNCPAINT => {
508 id => 0x0088, result => "", wparam => "", lparam => "" },
509 WM_SYNCTASK => {
510 id => 0x0089, result => "", wparam => "", lparam => "" },
511 WM_SYSCHAR => {
512 id => 0x0106, result => "void", wparam => "TCHAR", lparam => ["", ""] },
513 WM_SYSCOLORCHANGE => {
514 id => 0x0015, result => "void", wparam => "void", lparam => "void" },
515 WM_SYSCOMMAND => {
516 id => 0x0112, result => "void", wparam => "UINT", lparam => "int" },
517 WM_SYSDEADCHAR => {
518 id => 0x0107, result => "void", wparam => "TCHAR", lparam => ["", ""] },
519 WM_SYSKEYDOWN => {
520 id => 0x0104, result => "void", wparam => "UINT", lparam => ["", ""] },
521 WM_SYSKEYUP => {
522 id => 0x0105, result => "void", wparam => "UINT", lparam => ["", ""] },
523 WM_SYSTEMERROR => {
524 id => 0x0017, result => "", wparam => "", lparam => "" },
525 WM_SYSTIMER => {
526 id => 0x0118, result => "", wparam => "", lparam => "" },
528 WM_TCARD => {
529 id => 0x0052, result => "", wparam => "", lparam => "" },
530 WM_TESTING => {
531 id => 0x003a, result => "", wparam => "", lparam => "" },
532 WM_TIMECHANGE => {
533 id => 0x001e, result => "void", wparam => "void", lparam => "void" },
534 WM_TIMER => {
535 id => 0x0113, result => "void", wparam => "UINT", lparam => "void" },
537 WM_UNDO => {
538 id => 0x0304, result => "void", wparam => "void", lparam => "void" },
539 WM_USER => {
540 id => 0x0400, result => "", wparam => "", lparam => "" },
541 WM_USERCHANGED => {
542 id => 0x0054, result => "", wparam => "", lparam => "" },
544 WM_VKEYTOITEM => {
545 id => 0x002e, result => "int", wparam => ["UINT", "int"], lparam => "HWND" },
546 WM_VSCROLL => {
547 id => 0x0115, result => "void", wparam => ["int", "int"], lparam => "HWND" },
548 WM_VSCROLLCLIPBOARD => {
549 id => 0x030a, result => "void", wparam => "HWND", lparam => ["", ""] },
551 WM_WINDOWPOSCHANGING => {
552 id => 0x0046, result => "BOOL", wparam => "void", lparam => "LPWINDOWPOS" },
553 WM_WINDOWPOSCHANGED => {
554 id => 0x0047, result => "void", wparam => "void", lparam => "const LPWINDOWPOS" },
555 WM_WININICHANGE => {
556 id => 0x001a, result => "void", wparam => "void", lparam => "LPCTSTR" }
559 ########################################################################
560 # _get_kind
562 sub _get_kind($) {
563 local $_ = shift;
565 if(!$_) {
566 return undef;
567 } elsif(/^(?:HBRUSH|HDC|HFONT|HMENU|HRGN|HWND)$/ || /\*$/ ||
568 /^LP(?!ARAM)/)
570 return "ptr";
571 } else {
572 return "long";
576 ########################################################################
577 # get_message_result_type
579 sub get_message_result_type($) {
580 my $name = shift;
581 return $$message{$name}{result};
584 ########################################################################
585 # get_message_result_kind
587 sub get_message_result_kind(@) {
588 return _get_kind(get_message_result_type(@_));
591 ########################################################################
592 # get_message_wparam_type
594 sub get_message_wparam_type($) {
595 my $name = shift;
596 return $$message{$name}{wparam};
599 ########################################################################
600 # get_message_wparam_kind
602 sub get_message_wparam_kind(@) {
603 return _get_kind(get_message_wparam_type(@_));
606 ########################################################################
607 # get_message_lparam_type
609 sub get_message_lparam_type($) {
610 my $name = shift;
611 return $$message{$name}{lparam};
614 ########################################################################
615 # get_message_lparam_kind
617 sub get_message_lparam_kind(@) {
618 return _get_kind(get_message_lparam_type(@_));
621 ########################################################################
622 # _parse_file
624 sub _parse_file($$$) {
625 my $file = shift;
626 my $found_preprocessor = shift;
627 my $found_comment = shift;
630 open(IN, "< $file") || die "Error: Can't open $file: $!\n";
631 local $/ = undef;
632 $_ = <IN>;
633 close(IN);
636 my @lines = split(/\n/, $_);
637 my $max_line = scalar(@lines);
639 my $parser = new c_parser($file);
641 $parser->set_found_preprocessor_callback($found_preprocessor);
642 $parser->set_found_comment_callback($found_comment);
644 my $found_line = sub {
645 my $line = shift;
646 local $_ = shift;
648 $output->progress("$file: line $line of $max_line");
651 $parser->set_found_line_callback($found_line);
653 my $line = 1;
654 my $column = 0;
656 my $old_prefix = $output->prefix;
657 $output->progress("$file");
658 $output->prefix("$file: ");
660 if(!$parser->parse_c_file(\$_, \$line, \$column)) {
661 $output->write("can't parse file\n");
664 $output->prefix($old_prefix);
667 ########################################################################
668 # _get_tuple_arguments
670 sub _get_tuple_arguments($) {
671 local $_ = shift;
673 my $parser = new c_parser;
675 my $line = 1;
676 my $column = 0;
678 my @arguments;
679 my @argument_lines;
680 my @argument_columns;
681 if(!$parser->parse_c_tuple(\$_, \$line, \$column, \@arguments, \@argument_lines, \@argument_columns)) {
682 return undef;
685 return @arguments;
688 ########################################################################
689 # _parse_windowsx_h
692 sub _parse_windowsx_h($$$) {
693 my $last_comment;
695 my $found_preprocessor = sub {
696 my $begin_line = shift;
697 my $begin_column = shift;
698 local $_ = shift;
700 if(!s/^\#\s*define\s*// || !/^FORWARD_WM_/) {
701 return 1;
704 my $name;
705 if(s/^FORWARD_(\w+)\([^\)]*\)\s*(.*?)\s*$/$2/s) {
706 $name = $1;
709 if($name eq "WM_SYSTEMERROR") {
710 return 1;
713 my $result;
714 if(s/^\(\s*(\w+)\s*\)(?:\(\s*\w+\s*\))*\(\s*\w+\s*\)//) {
715 $result = $1;
716 } else {
717 die "$name: '$_'";
720 (undef, $_, my $wparam, my $lparam) = _get_tuple_arguments($_);
722 my @names = ();
723 if(/^$name$/) {
724 @names = $name;
725 } elsif(/^\(\w+\)\s*\?\s*(\w+)\s*:\s*(\w+)$/) {
726 @names = ($1, $2);
727 } else {
728 die "$name: '$_'";
731 local $_ = $last_comment;
732 s%^/\*\s*(.*?)\s*\*/$%$1%;
734 my %arguments;
735 if(s/^(\w+)\s+\w+\s*\(\s*(.*?)\s*\)$/$2/) {
736 my $result2 = $1;
737 if($result2 eq "INT") { $result2 = "int"; }
738 if($result ne $result2) {
739 $output->write("message $name: result type mismatch '$result' != '$result2'\n");
741 foreach (split(/\s*,\s*/)) {
742 if(/^((?:const\s+|volatile\s+)?\w+(?:\s*\*\s*|\s+)?)(\w+)$/) {
743 my $type = $1;
744 my $name = $2;
746 $type =~ s/^\s*(.*?)\s*$/$1/;
748 $arguments{$name} = $type;
749 } else {
750 die "$name: '$_'";
753 # $output->write("$1: $_\n");
754 } else {
755 die "$name: '$_'";
758 my $find_inner_cast = sub {
759 local $_ = shift;
760 if(/^(?:\(\s*((?:const\s+|volatile\s+)?\w+(?:\s*\*)?)\s*\))*\(.*?\)$/) {
761 if(defined($1)) {
762 return $1;
763 } else {
764 return "";
770 my @entries = (
771 [ \$wparam, "W", "w" ],
772 [ \$lparam, "L", "l" ]
774 foreach my $entry (@entries) {
775 (my $refparam, my $upper, my $lower) = @$entry;
777 local $_ = $$refparam;
778 if(s/^\(\s*$upper(?:)PARAM\s*\)\s*(?:\(\s*((?:const\s+|volatile\s+)?\w+(?:\s*\*)?)\s*\))*\(\s*(.*?)\s*\)$/$2/) {
779 if(defined($1)) {
780 $$refparam = $1;
781 } else {
782 $$refparam = "";
785 if(/^\w+$/) {
786 if(exists($arguments{$_})) {
787 $$refparam = $arguments{$_};
789 } elsif(/^\(\s*(\w+)\s*\)\s*\?\s*\(\s*(\w+)\s*\)\s*:\s*(?:\(\s*(\w+)\s*\)|0)$/) {
790 foreach ($1, $2, $3) {
791 if(exists($arguments{$_})) {
792 $$refparam = $arguments{$_};
793 last;
796 } elsif(/^\(\((?:const\s+|volatile\s+)?\w+\s*(?:\*\s*)?\)\s*(?:\(\s*\w+\s*\)|\w+)\s*\)\s*\->\s*\w+$/) {
797 $$refparam = "UINT";
798 } else {
799 die "$name: '$_'";
801 } elsif(s/^(?:\(\s*$upper(?:)PARAM\s*\)\s*)?MAKE$upper(?:)PARAM\s*//) {
802 (my $low, my $high) = _get_tuple_arguments($_);
804 $low = &$find_inner_cast($low);
805 $high = &$find_inner_cast($high);
807 $$refparam = "($low,$high)";
808 } elsif(s/^\(.*?$lower(?:)Param.*?\)$//) {
809 $$refparam = $upper . "PARAM";
810 } elsif(s/^\(\s*(.*?)\s*\)$//) {
811 $$refparam = "$1";
812 } elsif(s/^0L$//) {
813 $$refparam = "void";
814 } else {
815 die "$name: '$_'";
819 # $output->write("$result: '@names', '$wparam', '$lparam'\n");
821 foreach my $name (@names) {
822 my $result2 = $$message{$name}{result};
823 my $wparam2 = $$message{$name}{wparam};
824 my $lparam2 = $$message{$name}{lparam};
826 if(ref($wparam2)) {
827 $wparam2 = "(" . join(",", @$wparam2) . ")";
830 if(ref($lparam2)) {
831 $lparam2 = "(" . join(",", @$lparam2) . ")";
834 if($result ne $result2) {
835 $output->write("message $name: wrong result type '$result2' should be '$result'\n");
838 if($wparam ne $wparam2) {
839 # if($wparam ne "WPARAM" && $wparam ne "(,)") {
840 $output->write("message $name: wrong wparam type '$wparam2' should be '$wparam'\n");
844 if($lparam ne $lparam2) {
845 # if($lparam ne "LPARAM" && $lparam ne "(,)") {
846 $output->write("message $name: wrong lparam type '$lparam2' should be '$lparam'\n");
851 return 1;
854 my $found_comment = sub {
855 my $begin_line = shift;
856 my $begin_column = shift;
857 my $comment = shift;
859 $last_comment = $comment;
861 return 1;
864 _parse_file("$wine_dir/include/windowsx.h", $found_preprocessor, $found_comment);
868 ########################################################################
869 # _parse_winuser_h
871 sub _parse_winuser_h($$$) {
872 my %not_found = ();
874 my $found_preprocessor = sub {
875 my $begin_line = shift;
876 my $begin_column = shift;
877 local $_ = shift;
879 if(/^\#\s*define\s+(WM_\w+)\s+(0x[0-9a-fA-F]+)\s*$/) {
880 my $name = $1;
881 my $id = lc($2);
883 if(exists($$message{$name})) {
884 my $id2 = sprintf("0x%04x", $$message{$name}{id});
885 if($id ne $id2) {
886 $output->write("message $name: wrong value ($id2) should be $id\n");
888 } else {
889 $output->write("message $name: exists but is not supported\n");
890 $not_found{$name} = $id;
894 return 1;
897 _parse_file("$wine_dir/include/winuser.h", $found_preprocessor);
899 foreach my $name (sort(keys(%not_found))) {
900 my $id = $not_found{$name};
902 print " $name => {\n";
903 print "\tid => $id, result => \"\", wparam => \"\", lparam => \"\" },\n";
907 # _parse_windowsx_h;
908 # _parse_winuser_h;