winapi_module_user.pm 31 KB

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