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
;
24 use vars
qw($VERSION @ISA @EXPORT @EXPORT_OK);
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);
45 ########################################################################
49 ########################################################################
52 sub is_user_function($) {
54 if($name =~ /^(?:DefWindowProc|SendMessage)[AW]?$/) {
58 ########################################################################
63 id => 0x0006, result => "void", wparam => ["", ""], lparam => "HWND" },
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 => "" },
71 id => 0x0029, result => "", wparam => "", lparam => "" },
73 id => 0x8000, result => "", wparam => "", lparam => "" },
74 WM_ASKCBFORMATNAME => {
75 id => 0x030c, result => "void", wparam => "int", lparam => "LPTSTR" },
78 id => 0x022c, result => "", wparam => "", lparam => "" },
81 id => 0x001f, result => "void", wparam => "void", lparam => "void" },
83 id => 0x004b, result => "", wparam => "", lparam => "" },
84 WM_CAPTURECHANGED => {
85 id => 0x0215, result => "void", wparam => "void", lparam => "HWND" },
87 id => 0x030d, result => "void", wparam => "HWND", lparam => "HWND" },
89 id => 0x0022, result => "void", wparam => "void", lparam => "void" },
91 id => 0x0303, result => "void", wparam => "void", lparam => "void" },
93 id => 0x0102, result => "void", wparam => "TCHAR", lparam => ["", ""] },
95 id => 0x002f, result => "int", wparam => ["UINT", "UINT"], lparam => "HWND" },
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 => "" },
103 id => 0x0111, result => "void", wparam => ["UINT", "UINT"], lparam => "HWND" },
105 id => 0x0365, result => "", wparam => "", lparam => "" },
107 id => 0x0044, result => "void", wparam => "int", lparam => ["", ""] },
109 id => 0x007b, result => "void", wparam => "HWND", lparam => ["UINT", "UINT"] },
111 id => 0x0301, result => "void", wparam => "void", lparam => "void" },
113 id => 0x004a, result => "", wparam => "", lparam => "" },
115 id => 0x0041, result => "void", wparam => "UINT", lparam => "void" },
117 id => 0x0039, result => "int", wparam => "UINT", lparam => "const COMPAREITEMSTRUCT *" },
119 id => 0x0001, result => "BOOL", wparam => "void", lparam => "LPCREATESTRUCT" },
121 id => 0x0019, result => "", wparam => "", lparam => "" },
123 id => 0x0135, result => "HBRUSH", wparam => "HDC", lparam => "HWND" },
125 id => 0x136, result => "HBRUSH", wparam => "HDC", lparam => "HWND" },
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" },
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"] },
142 id => 0x03E0, result => "void", wparam => "HWND", lparam => ["ATOM", "ATOM"] },
144 id => 0x0103, result => "void", wparam => "TCHAR", lparam => ["", ""] },
146 id => 0x0219, result => "BOOL", wparam => "UINT", lparam => "DWORD" },
148 id => 0x002d, result => "void", wparam => "UINT", lparam => "const DELETEITEMSTRUCT *" },
149 WM_DEVMODECHANGE => {
150 id => 0x001b, result => "void", wparam => "void", lparam => "LPCTSTR" },
152 id => 0x0002, result => "void", wparam => "void", lparam => "void" },
153 WM_DESTROYCLIPBOARD => {
154 id => 0x0307, result => "void", wparam => "void", lparam => "void" },
156 id => 0x036c, result => "", wparam => "", lparam => "" },
157 WM_DISPLAYCHANGE => {
158 id => 0x007e, result => "void", wparam => "UINT", lparam => ["UINT", "UINT"] },
160 id => 0x022d, result => "", wparam => "", lparam => "" },
162 id => 0x022f, result => "", wparam => "", lparam => "" },
164 id => 0x022e, result => "", wparam => "", lparam => "" },
165 WM_DRAWCLIPBOARD => {
166 id => 0x0308, result => "void", wparam => "void", lparam => "void" },
168 id => 0x002b, result => "void", wparam => "UINT", lparam => "const DRAWITEMSTRUCT *" },
170 id => 0x0233, result => "void", wparam => "HDROP", lparam => "void" },
172 id => 0x022a, result => "", wparam => "", lparam => "" },
175 id => 0x000a, result => "void", wparam => "BOOL", lparam => "void" },
177 id => 0x0016, result => "void", wparam => "BOOL", lparam => "void" },
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 => "" },
185 id => 0x0014, result => "BOOL", wparam => "HDC", lparam => "void" },
187 id => 0x0367, result => "", wparam => "", lparam => "" },
189 id => 0x0212, result => "", wparam => "", lparam => "" },
191 id => 0x0232, result => "", wparam => "", lparam => "" },
193 WM_FILESYSCHANGE => {
194 id => 0x0034, result => "", wparam => "", lparam => "" },
196 id => 0x036d, result => "", wparam => "", lparam => "" },
198 id => 0x001d, result => "void", wparam => "void", lparam => "void" },
201 id => 0x0087, result => "UINT", wparam => "WPARAM", lparam => "LPMSG" },
203 id => 0x0031, result => "HFONT", wparam => "void", lparam => "void" },
205 id => 0x0033, result => "", wparam => "", lparam => "" },
207 id => 0x007f, result => "", wparam => "", lparam => "" },
208 WM_GETMINMAXINFO => {
209 id => 0x0024, result => "void", wparam => "void", lparam => "LPMINMAXINFO" },
211 id => 0x000d, result => "int", wparam => "int", lparam => "LPTSTR" },
212 WM_GETTEXTLENGTH => {
213 id => 0x000e, result => "int", wparam => "void", lparam => "void" },
216 id => 0x0053, result => "void", wparam => "void", lparam => "LPHELPINFO" },
218 id => 0x0366, result => "", wparam => "", lparam => "" },
220 id => 0x0312, result => "", wparam => "", lparam => "" },
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" },
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 => "" },
235 id => 0x0283, result => "", wparam => "", lparam => "" },
236 WM_IME_ENDCOMPOSITION => {
237 id => 0x010e, result => "", wparam => "", lparam => "" },
239 id => 0x0290, result => "void", wparam => "UINT", lparam => ["int", "UINT"] },
241 id => 0x010f, result => "", wparam => "", lparam => "" },
243 id => 0x0291, result => "void", wparam => "UINT", lparam => ["int", "UINT"] },
245 id => 0x0282, result => "", wparam => "", lparam => "" },
247 id => 0x0288, result => "", wparam => "", lparam => "" },
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 => "" },
257 id => 0x0110, result => "BOOL", wparam => "HWND", lparam => "LPARAM" },
258 WM_INITIALUPDATE => {
259 id => 0x0364, result => "", wparam => "", lparam => "" },
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 => "" },
269 id => 0x0035, result => "", wparam => "", lparam => "" },
272 id => 0x0100, result => "void", wparam => "UINT", lparam => ["int", "UINT"] },
274 id => 0x0108, result => "", wparam => "", lparam => "" },
276 id => 0x036a, result => "", wparam => "", lparam => "" },
278 id => 0x0101, result => "void", wparam => "UINT", lparam => ["", ""] },
280 id => 0x0008, result => "void", wparam => "HWND", lparam => "void" },
283 id => 0x0131, result => "", wparam => "", lparam => "" },
284 WM_LBUTTONDBLCLK => {
285 id => 0x0203, result => "void", wparam => "UINT", lparam => ["", ""] },
287 id => 0x0201, result => "void", wparam => "UINT", lparam => ["", ""] },
289 id => 0x0202, result => "void", wparam => "UINT", lparam => ["", ""] },
291 WM_MBUTTONDBLCLK => {
292 id => 0x0209, result => "void", wparam => "UINT", lparam => ["", ""] },
294 id => 0x0207, result => "void", wparam => "UINT", lparam => ["", ""] },
296 id => 0x0208, result => "void", wparam => "UINT", lparam => ["", ""] },
298 id => 0x0222, result => "void", wparam => "HWND", lparam => "HWND" },
300 id => 0x0227, result => "BOOL", wparam => "UINT", lparam => "void" },
302 id => 0x0220, result => "HWND", wparam => "void", lparam => "const LPMDICREATESTRUCT" },
304 id => 0x0221, result => "void", wparam => "HWND", lparam => "void" },
306 id => 0x0229, result => "HWND", wparam => "void", lparam => "void" },
307 WM_MDIICONARRANGE => {
308 id => 0x0228, result => "void", wparam => "void", lparam => "void" },
310 id => 0x0225, result => "void", wparam => "HWND", lparam => "void" },
312 id => 0x0224, result => "HWND", wparam => "HWND", lparam => "BOOL" },
313 WM_MDIREFRESHMENU => {
314 id => 0x0234, result => "", wparam => "", lparam => "" },
316 id => 0x0223, result => "void", wparam => "HWND", lparam => "void" },
318 id => 0x0230, result => "HMENU", wparam => "BOOL", lparam => "HMENU" },
320 id => 0x0226, result => "BOOL", wparam => "UINT", lparam => "void" },
322 id => 0x002c, result => "void", wparam => "UINT", lparam => "MEASUREITEMSTRUCT *" },
324 id => 0x011f, result => "void", wparam => ["", ""], lparam => "HMENU" },
326 id => 0x0120, result => "DWORD", wparam => ["", "WORD"], lparam => "HMENU" },
327 WM_MOUSEACTIVATE => {
328 id => 0x0021, result => "int", wparam => "HWND", lparam => ["", ""] },
330 id => 0x0200, result => "void", wparam => "UINT", lparam => ["", ""] },
332 id => 0x020a, result => "void", wparam => ["DWORD", "int"], lparam => ["UINT", "UINT"] },
334 id => 0x0003, result => "void", wparam => "void", lparam => ["", ""] },
336 id => 0x0216, result => "", wparam => "", lparam => "" },
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 => ["", ""] },
345 id => 0x00a2, result => "void", wparam => "UINT", lparam => ["", ""] },
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 => ["", ""] },
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 => ["", ""] },
359 id => 0x00a5, result => "void", wparam => "UINT", lparam => ["", ""] },
361 id => 0x0083, result => "UINT", wparam => "void", lparam => "NCCALCSIZE_PARAMS *" },
363 id => 0x0081, result => "BOOL", wparam => "void", lparam => "LPCREATESTRUCT" },
365 id => 0x0082, result => "void", wparam => "void", lparam => "void" },
367 id => 0x0084, result => "UINT", wparam => "void", lparam => ["int", "int"] },
369 id => 0x0085, result => "void", wparam => "HRGN", lparam => "void" },
371 id => 0x0028, result => "HWND", wparam => "HWND", lparam => "BOOL" },
373 id => 0x0213, result => "void", wparam => "UINT", lparam => "LPMDINEXTMENU" },
375 id => 0x004e, result => "LRESULT", wparam => "int", lparam => "NMHDR *" },
377 id => 0x0055, result => "", wparam => "", lparam => "" },
379 id => 0x0000, result => "", wparam => "", lparam => "" },
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 => "" },
397 id => 0x000f, result => "void", wparam => "void", lparam => "void" },
398 WM_PAINTCLIPBOARD => {
399 id => 0x0309, result => "void", wparam => "HWND", lparam => "const LPPAINTSTRUCT" },
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" },
407 id => 0x0210, result => "void", wparam => ["UINT", "int"], lparam => "HWND" },
409 id => 0x0302, result => "void", wparam => "void", lparam => "void" },
411 id => 0x0380, result => "", wparam => "", lparam => "" },
413 id => 0x038f, result => "", wparam => "", lparam => "" },
414 WM_POPMESSAGESTRING => {
415 id => 0x0375, result => "", wparam => "", lparam => "" },
417 id => 0x0048, result => "void", wparam => "int", lparam => "void" },
418 WM_POWERBROADCAST => {
419 id => 0x0218, result => "", wparam => "", lparam => "" },
421 id => 0x0317, result => "", wparam => "", lparam => "" },
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" },
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 => "" },
446 id => 0x0023, result => "void", wparam => "void", lparam => "void" },
447 WM_QUEUE_SENTINEL => {
448 id => 0x0379, result => "", wparam => "", lparam => "" },
450 id => 0x0012, result => "void", wparam => "int", lparam => "void" },
452 WM_RBUTTONDBLCLK => {
453 id => 0x0206, result => "void", wparam => "UINT", lparam => ["", ""] },
455 id => 0x0204, result => "void", wparam => "UINT", lparam => ["", ""] },
457 id => 0x0205, result => "void", wparam => "UINT", lparam => ["", ""] },
459 id => 0x0368, result => "", wparam => "", lparam => "" },
460 WM_RENDERALLFORMATS => {
461 id => 0x0306, result => "void", wparam => "void", lparam => "void" },
463 id => 0x0305, result => "HANDLE", wparam => "UINT", lparam => "void" },
466 id => 0x0020, result => "BOOL", wparam => "HWND", lparam => ["UINT", "UINT"] },
468 id => 0x0007, result => "void", wparam => "HWND", lparam => "void" },
470 id => 0x0030, result => "void", wparam => "HFONT", lparam => "BOOL" },
472 id => 0x0032, result => "", wparam => "", lparam => "" },
474 id => 0x0080, result => "HICON", wparam => "DWORD", lparam => "HICON" },
475 WM_SETMESSAGESTRING => {
476 id => 0x0362, result => "", wparam => "", lparam => "" },
478 id => 0x000b, result => "void", wparam => "BOOL", lparam => "void" },
480 id => 0x000c, result => "void", wparam => "void", lparam => "LPCTSTR" },
482 id => 0x0009, result => "", wparam => "", lparam => "" },
484 id => 0x0018, result => "void", wparam => "BOOL", lparam => "UINT" },
486 id => 0x0005, result => "void", wparam => "UINT", lparam => ["", ""] },
488 id => 0x0369, result => "", wparam => "", lparam => "" },
489 WM_SIZECLIPBOARD => {
490 id => 0x030b, result => "void", wparam => "HWND", lparam => "const LPRECT" },
492 id => 0x0361, result => "", wparam => "", lparam => "" },
494 id => 0x0004, result => "", wparam => "", lparam => "" },
496 id => 0x0214, result => "", wparam => "", lparam => "" },
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 => ["", ""] },
504 id => 0x007d, result => "void", wparam => "DWORD", lparam => "LPSTYLESTRUCT" },
505 WM_STYLECHANGING => {
506 id => 0x007c, result => "void", wparam => "DWORD", lparam => "LPSTYLESTRUCT" },
508 id => 0x0088, result => "", wparam => "", lparam => "" },
510 id => 0x0089, result => "", wparam => "", lparam => "" },
512 id => 0x0106, result => "void", wparam => "TCHAR", lparam => ["", ""] },
513 WM_SYSCOLORCHANGE => {
514 id => 0x0015, result => "void", wparam => "void", lparam => "void" },
516 id => 0x0112, result => "void", wparam => "UINT", lparam => "int" },
518 id => 0x0107, result => "void", wparam => "TCHAR", lparam => ["", ""] },
520 id => 0x0104, result => "void", wparam => "UINT", lparam => ["", ""] },
522 id => 0x0105, result => "void", wparam => "UINT", lparam => ["", ""] },
524 id => 0x0017, result => "", wparam => "", lparam => "" },
526 id => 0x0118, result => "", wparam => "", lparam => "" },
529 id => 0x0052, result => "", wparam => "", lparam => "" },
531 id => 0x003a, result => "", wparam => "", lparam => "" },
533 id => 0x001e, result => "void", wparam => "void", lparam => "void" },
535 id => 0x0113, result => "void", wparam => "UINT", lparam => "void" },
538 id => 0x0304, result => "void", wparam => "void", lparam => "void" },
540 id => 0x0400, result => "", wparam => "", lparam => "" },
542 id => 0x0054, result => "", wparam => "", lparam => "" },
545 id => 0x002e, result => "int", wparam => ["UINT", "int"], lparam => "HWND" },
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" },
556 id => 0x001a, result => "void", wparam => "void", lparam => "LPCTSTR" }
559 ########################################################################
567 } elsif(/^(?:HBRUSH|HDC|HFONT|HMENU|HRGN|HWND)$/ || /\*$/ ||
576 ########################################################################
577 # get_message_result_type
579 sub get_message_result_type($) {
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($) {
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($) {
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 ########################################################################
624 sub _parse_file($$$) {
626 my $found_preprocessor = shift;
627 my $found_comment = shift;
630 open(IN, "< $file") || die "Error: Can't open $file: $!\n";
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 {
648 $output->progress("$file: line $line of $max_line");
651 $parser->set_found_line_callback($found_line);
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($) {
673 my $parser = new c_parser;
680 my @argument_columns;
681 if(!$parser->parse_c_tuple(\$_, \$line, \$column, \@arguments, \@argument_lines, \@argument_columns)) {
688 ########################################################################
692 sub _parse_windowsx_h($$$) {
695 my $found_preprocessor = sub {
696 my $begin_line = shift;
697 my $begin_column = shift;
700 if(!s/^\#\s*define\s*// || !/^FORWARD_WM_/) {
705 if(s/^FORWARD_(\w+)\([^\)]*\)\s*(.*?)\s*$/$2/s) {
709 if($name eq "WM_SYSTEMERROR") {
714 if(s/^\(\s*(\w+)\s*\)(?:\(\s*\w+\s*\))*\(\s*\w+\s*\)//) {
720 (undef, $_, my $wparam, my $lparam) = _get_tuple_arguments($_);
725 } elsif(/^\(\w+\)\s*\?\s*(\w+)\s*:\s*(\w+)$/) {
731 local $_ = $last_comment;
732 s%^/\*\s*(.*?)\s*\*/$%$1%;
735 if(s/^(\w+)\s+\w+\s*\(\s*(.*?)\s*\)$/$2/) {
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+)$/) {
746 $type =~ s/^\s*(.*?)\s*$/$1/;
748 $arguments{$name} = $type;
753 # $output->write("$1: $_\n");
758 my $find_inner_cast = sub {
760 if(/^(?:\(\s*((?:const\s+|volatile\s+)?\w+(?:\s*\*)?)\s*\))*\(.*?\)$/) {
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/) {
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{$_};
796 } elsif(/^\(\((?:const\s+|volatile\s+)?\w+\s*(?:\*\s*)?\)\s*(?:\(\s*\w+\s*\)|\w+)\s*\)\s*\->\s*\w+$/) {
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*\)$//) {
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};
827 $wparam2 = "(" . join(",", @$wparam2) . ")";
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");
854 my $found_comment = sub {
855 my $begin_line = shift;
856 my $begin_column = shift;
859 $last_comment = $comment;
864 _parse_file("$wine_dir/include/windowsx.h", $found_preprocessor, $found_comment);
868 ########################################################################
871 sub _parse_winuser_h($$$) {
874 my $found_preprocessor = sub {
875 my $begin_line = shift;
876 my $begin_column = shift;
879 if(/^\#\s*define\s+(WM_\w+)\s+(0x[0-9a-fA-F]+)\s*$/) {
883 if(exists($$message{$name})) {
884 my $id2 = sprintf("0x%04x", $$message{$name}{id});
886 $output->write("message $name: wrong value ($id2) should be $id\n");
889 $output->write("message $name: exists but is not supported\n");
890 $not_found{$name} = $id;
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";