Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1161 lines
24 KiB

  1. ;==========================================================================
  2. ;
  3. ; Message validation layer include file
  4. ;
  5. ;- Where applicable, i've specified a class id. as a param. to the MESSAGE
  6. ; macro. For others (WM_ messages), i've specified the ID "COMMON".
  7. ;
  8. ;- For messages meaningful only to controls having a particular style, i've
  9. ; added an option to the MESSAGE macro:
  10. ;
  11. ; <MLCONLY> for messages applicable to ES_MULTILINE edit controls
  12. ; <OWNERDRAWVARONLY> " " " " LBS_OWNERDRAWVARIABLE listboxes
  13. ; <MULTISELONLY> " " " " LBS_MULTIPLESEL listboxes
  14. ; <MULTICOLONLY> " " " " LBS_MULTICOLUMN listboxes
  15. ;
  16. ;
  17. ; Generic message IDs
  18. ;
  19. WM_NULL equ 0000h
  20. WM_CREATE equ 0001h
  21. WM_DESTROY equ 0002h
  22. WM_MOVE equ 0003h
  23. WM_SIZEWAIT equ 0004h ;Internal
  24. WM_SIZE equ 0005h
  25. WM_ACTIVATE equ 0006h
  26. WM_SETFOCUS equ 0007h
  27. WM_KILLFOCUS equ 0008h
  28. WM_SETVISIBLE equ 0009h ;Internal
  29. WM_ENABLE equ 000Ah
  30. WM_SETREDRAW equ 000Bh
  31. WM_SETTEXT equ 000Ch
  32. WM_GETTEXT equ 000Dh
  33. WM_GETTEXTLENGTH equ 000Eh
  34. WM_PAINT equ 000Fh
  35. WM_CLOSE equ 0010h
  36. WM_QUERYENDSESSION equ 0011h
  37. WM_QUIT equ 0012h
  38. WM_QUERYOPEN equ 0013h
  39. WM_ERASEBKGND equ 0014h
  40. WM_SYSCOLORCHANGE equ 0015h
  41. WM_ENDSESSION equ 0016h
  42. WM_SYSTEMERROR equ 0017h ;Internal
  43. WM_SHOWWINDOW equ 0018h
  44. WM_CTLCOLOR equ 0019h
  45. WM_WININICHANGE equ 001Ah
  46. WM_DEVMODECHANGE equ 001Bh
  47. WM_ACTIVATEAPP equ 001Ch
  48. WM_FONTCHANGE equ 001Dh
  49. WM_TIMECHANGE equ 001Eh
  50. WM_CANCELMODE equ 001Fh
  51. WM_SETCURSOR equ 0020h
  52. WM_MOUSEACTIVATE equ 0021h
  53. WM_CHILDACTIVATE equ 0022h
  54. WM_QUEUESYNC equ 0023h
  55. WM_GETMINMAXINFO equ 0024h
  56. WM_PAINTICON equ 0026h
  57. WM_ICONERASEBKGND equ 0027h
  58. WM_NEXTDLGCTL equ 0028h
  59. WM_ALTTABACTIVE equ 0029h ;Internal
  60. WM_SPOOLERSTATUS equ 002Ah
  61. WM_DRAWITEM equ 002Bh
  62. WM_MEASUREITEM equ 002Ch
  63. WM_DELETEITEM equ 002Dh
  64. WM_VKEYTOITEM equ 002Eh
  65. WM_CHARTOITEM equ 002Fh
  66. WM_SETFONT equ 0030h
  67. WM_GETFONT equ 0031h
  68. WM_SETHOTKEY equ 0032h
  69. WM_GETHOTKEY equ 0033h
  70. WM_FILESYSCHANGE equ 0034h ;Internal
  71. WM_ISACTIVEICON equ 0035h ;Internal
  72. ;WM_UNUSED0036 equ 0036h ;Internal
  73. WM_QUERYDRAGICON equ 0037h
  74. WM_COMPAREITEM equ 0039h
  75. WM_TESTING equ 0040h ;Internal
  76. WM_COMPACTING equ 0041h
  77. ;WM_UNUSED equ 0042h
  78. ;WM_UNUSED equ 0043h
  79. WM_COMMNOTIFY equ 0044h
  80. ;WM_UNUSED equ 0045h
  81. WM_WINDOWPOSCHANGING equ 0046h
  82. WM_WINDOWPOSCHANGED equ 0047h
  83. WM_POWER equ 0048h
  84. WM_NCCREATE equ 0081h
  85. WM_NCDESTROY equ 0082h
  86. WM_NCCALCSIZE equ 0083h
  87. WM_NCHITTEST equ 0084h
  88. WM_NCPAINT equ 0085h
  89. WM_NCACTIVATE equ 0086h
  90. WM_GETDLGCODE equ 0087h
  91. WM_SYNCPAINT equ 0088h ;Internal
  92. WM_SYNCTASK equ 0089h ;Internal
  93. WM_NCMOUSEMOVE equ 00A0h
  94. WM_NCLBUTTONDOWN equ 00A1h
  95. WM_NCLBUTTONUP equ 00A2h
  96. WM_NCLBUTTONDBLCLK equ 00A3h
  97. WM_NCRBUTTONDOWN equ 00A4h
  98. WM_NCRBUTTONUP equ 00A5h
  99. WM_NCRBUTTONDBLCLK equ 00A6h
  100. WM_NCMBUTTONDOWN equ 00A7h
  101. WM_NCMBUTTONUP equ 00A8h
  102. WM_NCMBUTTONDBLCLK equ 00A9h
  103. WM_KEYFIRST equ 0100h
  104. WM_KEYDOWN equ 0100h
  105. WM_KEYUP equ 0101h
  106. WM_CHAR equ 0102h
  107. WM_DEADCHAR equ 0103h
  108. WM_SYSKEYDOWN equ 0104h
  109. WM_SYSKEYUP equ 0105h
  110. WM_SYSCHAR equ 0106h
  111. WM_SYSDEADCHAR equ 0107h
  112. WM_YOMICHAR equ 0108h ;Internal
  113. WM_KEYLAST equ 0108h
  114. WM_CONVERTREQUEST equ 010Ah ;Internal
  115. WM_CONVERTRESULT equ 010Bh ;Internal
  116. WM_INITDIALOG equ 0110h
  117. WM_COMMAND equ 0111h
  118. WM_SYSCOMMAND equ 0112h
  119. WM_TIMER equ 0113h
  120. WM_HSCROLL equ 0114h
  121. WM_VSCROLL equ 0115h
  122. WM_INITMENU equ 0116h
  123. WM_INITMENUPOPUP equ 0117h
  124. WM_SYSTIMER equ 0118h ;Internal
  125. WM_MENUSELECT equ 011Fh
  126. WM_MENUCHAR equ 0120h
  127. WM_ENTERIDLE equ 0121h
  128. WM_LBTRACKPOINT equ 0131h ;Internal
  129. WM_MOUSEFIRST equ 0200h
  130. WM_MOUSEMOVE equ 0200h
  131. WM_LBUTTONDOWN equ 0201h
  132. WM_LBUTTONUP equ 0202h
  133. WM_LBUTTONDBLCLK equ 0203h
  134. WM_RBUTTONDOWN equ 0204h
  135. WM_RBUTTONUP equ 0205h
  136. WM_RBUTTONDBLCLK equ 0206h
  137. WM_MBUTTONDOWN equ 0207h
  138. WM_MBUTTONUP equ 0208h
  139. WM_MBUTTONDBLCLK equ 0209h
  140. WM_MOUSELAST equ 0209h
  141. WM_PARENTNOTIFY equ 0210h
  142. WM_ENTERMENULOOP equ 0211h ;Internal
  143. WM_EXITMENULOOP equ 0212h ;Internal
  144. WM_NEXTMENU equ 0213h ;Internal
  145. WM_MDICREATE equ 0220h
  146. WM_MDIDESTROY equ 0221h
  147. WM_MDIACTIVATE equ 0222h
  148. WM_MDIRESTORE equ 0223h
  149. WM_MDINEXT equ 0224h
  150. WM_MDIMAXIMIZE equ 0225h
  151. WM_MDITILE equ 0226h
  152. WM_MDICASCADE equ 0227h
  153. WM_MDIICONARRANGE equ 0228h
  154. WM_MDIGETACTIVE equ 0229h
  155. WM_DROPOBJECT equ 022Ah ;Internal
  156. WM_QUERYDROPOBJECT equ 022Bh ;Internal
  157. WM_BEGINDRAG equ 022Ch ;Internal
  158. WM_DRAGLOOP equ 022Dh ;Internal
  159. WM_DRAGSELECT equ 022Eh ;Internal
  160. WM_DRAGMOVE equ 022Fh ;Internal
  161. WM_MDISETMENU equ 0230h
  162. WM_ENTERSIZEMOVE equ 0231h ;Internal
  163. WM_EXITSIZEMOVE equ 0232h ;Internal
  164. WM_DROPFILES equ 0233h
  165. WM_KANJIFIRST equ 0280h ;Internal
  166. WM_KANJILAST equ 029Fh ;Internal
  167. WM_CUT equ 0300h
  168. WM_COPY equ 0301h
  169. WM_PASTE equ 0302h
  170. WM_CLEAR equ 0303h
  171. WM_UNDO equ 0304h
  172. WM_RENDERFORMAT equ 0305h
  173. WM_RENDERALLFORMATS equ 0306h
  174. WM_DESTROYCLIPBOARD equ 0307h
  175. WM_DRAWCLIPBOARD equ 0308h
  176. WM_PAINTCLIPBOARD equ 0309h
  177. WM_VSCROLLCLIPBOARD equ 030Ah
  178. WM_SIZECLIPBOARD equ 030Bh
  179. WM_ASKCBFORMATNAME equ 030Ch
  180. WM_CHANGECBCHAIN equ 030Dh
  181. WM_HSCROLLCLIPBOARD equ 030Eh
  182. WM_QUERYNEWPALETTE equ 030Fh
  183. WM_PALETTEGONNACHANGE equ 0310h ;Internal
  184. WM_PALETTEISCHANGING equ 0310h
  185. WM_CHANGEPALETTE equ 0311h ;Internal
  186. WM_PALETTECHANGED equ 0311h
  187. WM_PENWINFIRST equ 0380h
  188. WM_PENWINLAST equ 038Fh
  189. WM_INTERNAL_COALESCE_FIRST equ 0390h ;Internal
  190. WM_COALESCE_FIRST equ 0390h
  191. WM_COALESCE_LAST equ 039Fh
  192. WM_MM_RESERVED_FIRST equ 03A0h ;Internal
  193. WM_MM_RESERVED_LAST equ 03DFh ;Internal
  194. WM_INTERNAL_COALESCE_LAST equ (WM_MM_RESERVED_FIRST+16) ;Internal
  195. WM_INTERNAL_DDE_FIRST equ 03E0h ;Internal
  196. WM_INTERNAL_DDE_LAST equ 03EFh ;Internal
  197. WM_CBT_RESERVED_FIRST equ 03F0h ;Internal
  198. WM_CBT_RESERVED_LAST equ 03FFh ;Internal
  199. WM_USER equ 0400h
  200. ; Edit control messages
  201. EM_GETSEL equ (WM_USER+0)
  202. EM_SETSEL equ (WM_USER+1)
  203. EM_GETRECT equ (WM_USER+2)
  204. EM_SETRECT equ (WM_USER+3)
  205. EM_SETRECTNP equ (WM_USER+4)
  206. EM_SCROLL equ (WM_USER+5)
  207. EM_LINESCROLL equ (WM_USER+6)
  208. EM_GETMODIFY equ (WM_USER+8)
  209. EM_SETMODIFY equ (WM_USER+9)
  210. EM_GETLINECOUNT equ (WM_USER+10)
  211. EM_LINEINDEX equ (WM_USER+11)
  212. EM_SETHANDLE equ (WM_USER+12)
  213. EM_GETHANDLE equ (WM_USER+13)
  214. EM_GETTHUMB equ (WM_USER+14)
  215. EM_LINELENGTH equ (WM_USER+17)
  216. EM_REPLACESEL equ (WM_USER+18)
  217. EM_SETFONT equ (WM_USER+19)
  218. EM_GETLINE equ (WM_USER+20)
  219. EM_LIMITTEXT equ (WM_USER+21)
  220. EM_CANUNDO equ (WM_USER+22)
  221. EM_UNDO equ (WM_USER+23)
  222. EM_FMTLINES equ (WM_USER+24)
  223. EM_LINEFROMCHAR equ (WM_USER+25)
  224. EM_SETWORDBREAK equ (WM_USER+26)
  225. EM_SETTABSTOPS equ (WM_USER+27)
  226. EM_SETPASSWORDCHAR equ (WM_USER+28)
  227. EM_EMPTYUNDOBUFFER equ (WM_USER+29)
  228. EM_GETFIRSTVISIBLELINE equ (WM_USER+30)
  229. EM_SETREADONLY equ (WM_USER+31)
  230. EM_SETWORDBREAKPROC equ (WM_USER+32)
  231. EM_GETWORDBREAKPROC equ (WM_USER+33)
  232. EM_GETPASSWORDCHAR equ (WM_USER+34)
  233. EM_MSGMAX equ (WM_USER+35)
  234. ; Button control messages
  235. BM_GETCHECK equ (WM_USER+0)
  236. BM_SETCHECK equ (WM_USER+1)
  237. BM_GETSTATE equ (WM_USER+2)
  238. BM_SETSTATE equ (WM_USER+3)
  239. BM_SETSTYLE equ (WM_USER+4)
  240. ; Static control messages
  241. STM_SETICON equ (WM_USER+0)
  242. STM_GETICON equ (WM_USER+1)
  243. STM_MSGMAX equ (WM_USER+2)
  244. ; Dialog box messages
  245. DM_GETDEFID equ (WM_USER+0)
  246. DM_SETDEFID equ (WM_USER+1)
  247. ; Listbox messages
  248. LB_ADDSTRING equ (WM_USER+1)
  249. LB_INSERTSTRING equ (WM_USER+2)
  250. LB_DELETESTRING equ (WM_USER+3)
  251. LB_RESETCONTENT equ (WM_USER+5)
  252. LB_SETSEL equ (WM_USER+6)
  253. LB_SETCURSEL equ (WM_USER+7)
  254. LB_GETSEL equ (WM_USER+8)
  255. LB_GETCURSEL equ (WM_USER+9)
  256. LB_GETTEXT equ (WM_USER+10)
  257. LB_GETTEXTLEN equ (WM_USER+11)
  258. LB_GETCOUNT equ (WM_USER+12)
  259. LB_SELECTSTRING equ (WM_USER+13)
  260. LB_DIR equ (WM_USER+14)
  261. LB_GETTOPINDEX equ (WM_USER+15)
  262. LB_FINDSTRING equ (WM_USER+16)
  263. LB_GETSELCOUNT equ (WM_USER+17)
  264. LB_GETSELITEMS equ (WM_USER+18)
  265. LB_SETTABSTOPS equ (WM_USER+19)
  266. LB_GETHORIZONTALEXTENT equ (WM_USER+20)
  267. LB_SETHORIZONTALEXTENT equ (WM_USER+21)
  268. LB_SETCOLUMNWIDTH equ (WM_USER+22)
  269. LB_ADDFILE equ (WM_USER+23) ;Internal
  270. LB_SETTOPINDEX equ (WM_USER+24)
  271. LB_GETITEMRECT equ (WM_USER+25)
  272. LB_GETITEMDATA equ (WM_USER+26)
  273. LB_SETITEMDATA equ (WM_USER+27)
  274. LB_SELITEMRANGE equ (WM_USER+28)
  275. LB_SETANCHORINDEX equ (WM_USER+29) ;Internal
  276. LB_GETANCHORINDEX equ (WM_USER+30) ;Internal
  277. LB_SETCARETINDEX equ (WM_USER+31)
  278. LB_GETCARETINDEX equ (WM_USER+32)
  279. LB_SETITEMHEIGHT equ (WM_USER+33)
  280. LB_GETITEMHEIGHT equ (WM_USER+34)
  281. LB_FINDSTRINGEXACT equ (WM_USER+35)
  282. LBCB_CARETON equ (WM_USER+36) ;Internal
  283. LBCB_CARETOFF equ (WM_USER+37) ;Internal
  284. LB_MSGMAX equ (WM_USER+38)
  285. ; Combo box messages
  286. CB_GETEDITSEL equ (WM_USER+0)
  287. CB_LIMITTEXT equ (WM_USER+1)
  288. CB_SETEDITSEL equ (WM_USER+2)
  289. CB_ADDSTRING equ (WM_USER+3)
  290. CB_DELETESTRING equ (WM_USER+4)
  291. CB_DIR equ (WM_USER+5)
  292. CB_GETCOUNT equ (WM_USER+6)
  293. CB_GETCURSEL equ (WM_USER+7)
  294. CB_GETLBTEXT equ (WM_USER+8)
  295. CB_GETLBTEXTLEN equ (WM_USER+9)
  296. CB_INSERTSTRING equ (WM_USER+10)
  297. CB_RESETCONTENT equ (WM_USER+11)
  298. CB_FINDSTRING equ (WM_USER+12)
  299. CB_SELECTSTRING equ (WM_USER+13)
  300. CB_SETCURSEL equ (WM_USER+14)
  301. CB_SHOWDROPDOWN equ (WM_USER+15)
  302. CB_GETITEMDATA equ (WM_USER+16)
  303. CB_SETITEMDATA equ (WM_USER+17)
  304. CB_GETDROPPEDCONTROLRECT equ (WM_USER+18)
  305. CB_SETITEMHEIGHT equ (WM_USER+19)
  306. CB_GETITEMHEIGHT equ (WM_USER+20)
  307. CB_SETEXTENDEDUI equ (WM_USER+21)
  308. CB_GETEXTENDEDUI equ (WM_USER+22)
  309. CB_GETDROPPEDSTATE equ (WM_USER+23)
  310. CB_FINDSTRINGEXACT equ (WM_USER+24)
  311. CB_MSGMAX equ (WM_USER+25)
  312. ; DDE messages
  313. WM_DDE_FIRST equ 03E0h
  314. WM_DDE_INITIATE equ (WM_DDE_FIRST)
  315. WM_DDE_TERMINATE equ (WM_DDE_FIRST+1)
  316. WM_DDE_ADVISE equ (WM_DDE_FIRST+2)
  317. WM_DDE_UNADVISE equ (WM_DDE_FIRST+3)
  318. WM_DDE_ACK equ (WM_DDE_FIRST+4)
  319. WM_DDE_DATA equ (WM_DDE_FIRST+5)
  320. WM_DDE_REQUEST equ (WM_DDE_FIRST+6)
  321. WM_DDE_POKE equ (WM_DDE_FIRST+7)
  322. WM_DDE_EXECUTE equ (WM_DDE_FIRST+8)
  323. WM_DDE_LAST equ (WM_DDE_FIRST+8)
  324. ;==================================================
  325. VLmopen = 0
  326. VLmpoff = 0
  327. VLmname equ <>
  328. VLmcont equ <>
  329. DGROUP group _DATA
  330. sBegin DATA
  331. assume ds:_DATA
  332. ;extrn atomSysClass:word
  333. sEnd DATA
  334. ExternFP IsMenu
  335. IFNDEF WOW
  336. ExternFP IsGDIObject
  337. ENDIF
  338. ExternFP IsWindow
  339. MESSAGE_START macro seg
  340. _SwitchSeg <seg>,%VLseg
  341. IFNDEF WOW
  342. ExternNP VHWND&seg
  343. ExternNP VHWND0&seg
  344. ExternNP VHMENU&seg
  345. ExternNP VHMENU0&seg
  346. ExternNP GHANDLE&seg
  347. ExternNP GHANDLE0&seg
  348. ENDIF
  349. ExternNP LP&seg
  350. ExternNP LP0&seg
  351. ExternNP CLP&seg
  352. ExternNP CLP0&seg
  353. ExternNP LPFN&seg
  354. ExternNP LPFN0&seg
  355. ExternNP CLPSZ&seg
  356. ExternNP CLPSZ0&seg
  357. ExternNP Inval_Param_&seg
  358. hwnd equ <[bp].0eh>
  359. msg equ <[bp].0ch>
  360. wParam equ <[bp].0ah>
  361. lParam equ <dword ptr [bp]+06h>
  362. ;cProc ValidateMessage,<FAR, PUBLIC>
  363. ;ParmW hwnd
  364. ;ParmW msg
  365. ;ParmW wParam
  366. ;ParmD lParam
  367. ;cBegin
  368. public ValidateMessage
  369. ValidateMessage proc far
  370. push bp
  371. mov bp,sp
  372. push offset VM_ERROR ; push error handler address
  373. IFNDEF WOW
  374. mov bx,hwnd ; validate the window handle
  375. lcall VHWND
  376. ENDIF
  377. mov ax,msg
  378. cmp ax,WM_USER
  379. jb VM_COMMON
  380. jmp SHORT VM_VALID ;
  381. IFNDEF WOW
  382. mov bx,_DATA
  383. mov es,bx
  384. assume es:_DATA
  385. mov bx,hwnd ; ax = hwnd->pcls->atomClassName
  386. mov bx,es:[bx].wndPcls
  387. mov ax,es:[bx].uclsAtomClassName
  388. mov cx,ICLS_CTL_MAX ; look up the class name
  389. push di ; in the atomSysClass array
  390. mov di,offset DGROUP:atomSysClass+(ICLS_CTL_MAX-1)*2
  391. std
  392. repnz scasw
  393. pop di
  394. cld
  395. jnz VM_VALID ; Not special window class: just return.
  396. mov bx,cx ; cx has ICLS index
  397. add bx,bx
  398. mov ax,msg
  399. jmp word ptr cs:vmjump[bx]
  400. ENDIF
  401. VM_VALID:
  402. mov ax,1 ; return TRUE
  403. VM_EXIT:
  404. pop dx ; strip off error handler address
  405. assume es:NOTHING
  406. pop bp
  407. VM_ERROR:
  408. retf 2+2+2+4 ; error handler jmps here, with clean stack
  409. ValidateMessage endp
  410. ;
  411. ; NOTE: The order of the following jump table is dependent
  412. ; on the order of the ICLS_* values defined in user.h
  413. ;
  414. IFNDEF WOW
  415. vmjump:
  416. dw VM_BUTTON
  417. errnz <ICLS_BUTTON-0>
  418. dw VM_EDIT
  419. errnz <ICLS_EDIT-1>
  420. dw VM_STATIC
  421. errnz <ICLS_STATIC-2>
  422. dw VM_LISTBOX
  423. errnz <ICLS_LISTBOX-3>
  424. dw VM_VALID ; No scrollbar messages
  425. errnz <ICLS_SCROLLBAR-4>
  426. dw VM_COMBOBOX
  427. errnz <ICLS_COMBOBOX-5>
  428. ENDIF
  429. endm ; MESSAGE_START
  430. MESSAGE_END macro
  431. if VLmopen
  432. ENDMESSAGE
  433. endif
  434. sEnd %VLseg
  435. endm
  436. ;
  437. ; MESSAGE - begins a structure declaration
  438. ;
  439. MESSAGE macro name,opts
  440. if VLmopen
  441. ENDMESSAGE
  442. endif
  443. VLmopen=1
  444. VLmpoff = 4
  445. VLmjmp = 0
  446. _MOpts <opts>
  447. concat VLmcont,<VLm>,name
  448. concat VLmname,name
  449. VLcbstruct = 0
  450. endm
  451. _MOpts macro opts
  452. VLnogen = 0
  453. VLnogenparm = 0
  454. irp opt,<opts>
  455. ifidni <opt>,<NOGEN>
  456. VLnogen = 1
  457. endif
  458. ifidni <opt>,<DEBUGONLY>
  459. ifndef DEBUG
  460. VLnogen = 1
  461. endif
  462. endif
  463. ifidni <opt>,<POSTED>
  464. endif
  465. ifidni <opt>,<INTERNAL>
  466. endif
  467. endm
  468. VLgen = 0
  469. endm
  470. ;
  471. ; ENDMESSAGE - Terminates a message declaration
  472. ;
  473. ENDMESSAGE macro
  474. VLmopen = 0
  475. ife VLmjmp
  476. ;_print <Nothing to validate for >,%VLmname
  477. else
  478. jmp VM_VALID
  479. endif
  480. irp label,<VLmcont>
  481. label:
  482. endm
  483. endm
  484. ;
  485. ; MESSAGE_CLASS - Announce
  486. ;
  487. MESSAGE_CLASS macro cls
  488. VM_&cls:
  489. endm
  490. MESSAGE_CLASS_END macro
  491. if VLmopen
  492. ENDMESSAGE
  493. endif
  494. jmp VM_VALID
  495. endm
  496. _FlsMJmp2 macro name
  497. public PV_&name
  498. PV_&name:
  499. endm
  500. _FlsMJmp macro
  501. ife VLmjmp
  502. _FlsMJmp2 %VLmname
  503. cmp ax,VLmname
  504. jnz VLmcont
  505. VLmjmp = 1
  506. endif
  507. endm
  508. ;
  509. ; Increment mpOff: 4 -> 0 -> 2
  510. ;
  511. _IncMpOff macro size
  512. ife VLmpoff-99
  513. _print <Too many message parameters>
  514. errnz 1
  515. else
  516. ife size-2
  517. ife VLmpoff-4
  518. VLmpoff = 0
  519. else
  520. ife VLmpoff-0
  521. VLmpoff = 2
  522. else
  523. VLmpoff = 99
  524. endif
  525. endif
  526. else
  527. ife VLmpoff-4
  528. _print <First message parameter must be 16 bits>
  529. errnz 1
  530. else
  531. ife VLmpoff-0
  532. VLmpoff = 99
  533. else
  534. _print <Too many message parameters>
  535. errnz 1
  536. endif
  537. endif
  538. endif
  539. endif
  540. endm
  541. ;
  542. ;
  543. ;
  544. _GenMP macro name,size,opts
  545. VLnogenparm = 0
  546. irp opt,<opts>
  547. ifidni opt,<NOGEN>
  548. VLnogenparm = 1
  549. endif
  550. ifidni opt,<DEBUGONLY>
  551. ifndef DEBUG
  552. VLnogenparm = 1
  553. endif
  554. endif
  555. endm
  556. VLgen = 1
  557. if VLnogenparm or VLnogen
  558. VLgen = 0
  559. endif
  560. concat _P_&name,<[bp]+2+4+>,%VLmpoff
  561. _IncMpOff size
  562. endm
  563. ;
  564. ; Message parameter macros
  565. ;
  566. MP_2 macro name,opts
  567. _GenMP <name>,2,<opts>
  568. endm
  569. MP_4 macro name,opts
  570. _GenMP <name>,4,<opts>
  571. endm
  572. MP_WMBZ macro name,opts
  573. _GenMP <name>,2,<opts>
  574. if VLgen
  575. ifdef DEBUG
  576. _FlsMJmp
  577. mov ax,_P_&name
  578. or ax,ax
  579. jz @F
  580. mov bx,ERR_BAD_VALUE or ERR_WARNING
  581. lcall Inval_Param_
  582. @@:
  583. endif
  584. endif
  585. endm
  586. MP_LMBZ macro name,opts
  587. _GenMP <name>,4,<opts>
  588. if VLgen
  589. ifdef DEBUG
  590. _FlsMJmp
  591. mov bx,_P_&name
  592. mov cx,_P_&name+2
  593. or bx,cx
  594. jz @F
  595. mov ax,_P_&name
  596. mov bx,ERR_BAD_DVALUE or ERR_WARNING
  597. lcall Inval_Param_
  598. @@:
  599. endif ; DEBUG
  600. endif
  601. endm
  602. ; Simple types
  603. MP_int equ <MP_2>
  604. MP_BOOL equ <MP_2>
  605. MP_LONG equ <MP_4>
  606. MP_DWORD equ <MP_4>
  607. MP_WORD equ <MP_2>
  608. MP_POINT equ <MP_4>
  609. MP_RVALUE macro val, min, max, opts
  610. MP_2 <flags>,<opts>
  611. endm
  612. MP_VALUE macro val, max, opts
  613. MP_2 <flags>,<opts>
  614. endm
  615. MP_FLAGS macro flags, valid, opts
  616. MP_2 <flags>,<opts>
  617. endm
  618. ; Handles
  619. ;
  620. ; Generate a GDI object validation macro.
  621. ;
  622. ; If nullok is 1, allow NULL.
  623. ; min & max are the allowed OBJ_* range.
  624. ; except, if specified, is an OBJ_* value within the range to reject.
  625. ;
  626. _GenMPHGDI macro name,nullok,min,max,except
  627. name &macro hObj,opts
  628. local badobj
  629. local objok
  630. _GenMP <hObj>,2,<opts>
  631. if VLgen
  632. _FlsMJmp
  633. IFNDEF WOW
  634. if nullok
  635. mov cx,_P_&&hObj
  636. jcxz objok
  637. push cx
  638. else
  639. push _P_&&hObj
  640. endif
  641. call IsGDIObject
  642. ifnb <except>
  643. cmp al,except
  644. jz badobj
  645. endif
  646. ife min-max
  647. cmp al,min
  648. je objok
  649. else
  650. cmp al,min
  651. jb badobj
  652. cmp al,max
  653. jbe objok
  654. endif
  655. badobj:
  656. mov ax,_P_&&hObj
  657. mov bx,ERR_BAD_HANDLE
  658. lcall Inval_Param_
  659. objok:
  660. ENDIF
  661. endif
  662. &endm
  663. endm
  664. OBJ_PEN equ 1
  665. OBJ_BRUSH equ 2
  666. OBJ_FONT equ 3
  667. OBJ_PALETTE equ 4
  668. OBJ_BITMAP equ 5
  669. OBJ_RGN equ 6
  670. OBJ_DC equ 7
  671. OBJ_IC equ 8
  672. OBJ_DISABLED_DC equ 9
  673. OBJ_METADC equ 10
  674. OBJ_METAFILE equ 11
  675. _GenMPHGDI <MP_HDC>,0,OBJ_DC,OBJ_METAFILE
  676. _GenMPHGDI <MP_HDC0>,1,OBJ_DC,OBJ_METAFILE
  677. _GenMPHGDI <MP_HPEN>,0,OBJ_PEN,OBJ_PEN
  678. _GenMPHGDI <MP_HPEN0>,1,OBJ_PEN,OBJ_PEN
  679. _GenMPHGDI <MP_HBRUSH>,0,OBJ_BRUSH,OBJ_BRUSH
  680. _GenMPHGDI <MP_HBRUSH0>,1,OBJ_BRUSH,OBJ_BRUSH
  681. _GenMPHGDI <MP_HFONT>,0,OBJ_FONT,OBJ_FONT
  682. _GenMPHGDI <MP_HFONT0>,1,OBJ_FONT,OBJ_FONT
  683. _GenMPHGDI <MP_HPALETTE>,0,OBJ_PALETTE,OBJ_PALETTE
  684. _GenMPHGDI <MP_HPALETTE0>,1,OBJ_PALETTE,OBJ_PALETTE
  685. _GenMPHGDI <MP_HBITMAP>,0,OBJ_BITMAP,OBJ_BITMAP
  686. _GenMPHGDI <MP_HBITMAP0>,1,OBJ_BITMAP,OBJ_BITMAP
  687. _GenMPHGDI <MP_HRGN>,0,OBJ_RGN,OBJ_RGN
  688. _GenMPHGDI <MP_HRGN0>,1,OBJ_RGN,OBJ_RGN
  689. MP_HRGN01 equ <MP_2> ; hrgn, NULL, or (HRGN)1
  690. MP_HMENU macro hMenu,opts
  691. _GenMP <hMenu>,2,<opts>
  692. if VLgen
  693. _FlsMJmp
  694. IFNDEF WOW
  695. mov bx,_P_&hMenu
  696. lcall VHMENU
  697. ENDIF
  698. _gensub VHMENU
  699. @@:
  700. endif
  701. endm
  702. MP_HMENU0 macro hMenu,opts
  703. _GenMP <hMenu>,2,<opts>
  704. if VLgen
  705. _FlsMJmp
  706. IFNDEF WOW
  707. mov bx,_P_&hMenu
  708. lcall VHMENU0
  709. ENDIF
  710. _gensub VHMENU
  711. endif
  712. endm
  713. MP_HWND macro hwnd,opts
  714. _GenMP <hwnd>,2,<opts>
  715. if VLgen
  716. _FlsMJmp
  717. IFNDEF WOW
  718. mov bx,_P_&hwnd
  719. lcall VHWND
  720. ENDIF
  721. _gensub VHWND
  722. endif
  723. endm
  724. MP_HWND0 macro hwnd,opts
  725. _GenMP <hwnd>,2,<opts>
  726. if VLgen
  727. _FlsMJmp
  728. IFNDEF WOW
  729. mov bx,_P_&hwnd
  730. lcall VHWND0
  731. ENDIF
  732. _gensub VHWND
  733. endif
  734. endm
  735. ; Warn if the window handle is 0 or a bad window handle
  736. MP_HWNDW macro hwnd,opts
  737. Local ZeroHandle
  738. _GenMP <hwnd>,2,<opts>
  739. ifdef DEBUG
  740. if VLgen
  741. _FlsMJmp
  742. mov cx,_P_&hwnd
  743. mov ax, cx ;; Error reporting expects window handle in AX
  744. jcxz ZeroHandle
  745. jmp @F
  746. IFNDEF WOW
  747. push cx ;; Save window handle
  748. push cx
  749. call IsWindow
  750. or ax,ax
  751. pop ax ;; Resore the window handle to AX
  752. jnz @F
  753. ENDIF
  754. ZeroHandle:
  755. ;; AX must have the bad Window handle
  756. mov bx,ERR_BAD_HWND or ERR_WARNING
  757. lcall Inval_Param_
  758. @@:
  759. endif
  760. endif
  761. endm
  762. ; Warning only.
  763. MP_HWNDW0 macro hwnd,opts
  764. _GenMP <hwnd>,2,<opts>
  765. ifdef DEBUG
  766. if VLgen
  767. _FlsMJmp
  768. IFNDEF WOW
  769. mov cx,_P_&hwnd
  770. jcxz @F
  771. push cx
  772. push cx
  773. call IsWindow
  774. or ax,ax
  775. pop ax
  776. jnz @F
  777. mov bx,ERR_BAD_HWND or ERR_WARNING
  778. lcall Inval_Param_
  779. @@:
  780. ENDIF
  781. endif
  782. endif
  783. endm
  784. MP_HWND01 macro hwnd,opts ; hwnd, 0, or 1
  785. _GenMP <hwnd>,2,<opts>
  786. if VLgen
  787. _FlsMJmp
  788. IFNDEF WOW
  789. mov bx,_P_&hwnd
  790. cmp bx,1
  791. jbe @F
  792. lcall VHWND
  793. ENDIF
  794. _gensub VHWND
  795. @@:
  796. endif
  797. endm
  798. MP_HWNDCLIP equ <MP_HWND>
  799. MP_LHANDLE macro name,opts
  800. _GenMP <name>,2,<opts>
  801. if VLgen
  802. _FlsMJmp
  803. mov ax,_P_&name
  804. or ax,ax
  805. jnz @F
  806. mov bx,ERR_BAD_LOCAL_HANDLE
  807. lcall Inval_Param_
  808. @@:
  809. endif
  810. endm
  811. MP_LHANDLE0 equ <MP_2>
  812. MP_GHANDLE macro h,opts
  813. _GenMP <h>,2,<opts>
  814. if VLgen
  815. _FlsMJmp
  816. IFNDEF WOW
  817. mov ax,_P_&h
  818. lcall GHANDLE
  819. ENDIF
  820. endif
  821. endm
  822. MP_GHANDLE0 macro h,opts
  823. _GenMP <h>,2,<opts>
  824. if VLgen
  825. _FlsMJmp
  826. IFNDEF WOW
  827. mov ax,_P_&h
  828. lcall GHANDLE0
  829. ENDIF
  830. endif
  831. endm
  832. MP_GHANDLEDDE equ <MP_GHANDLE>
  833. MP_GHANDLEDDE0 equ <MP_GHANDLE0>
  834. MP_GHANDLEDDEW macro h,opts
  835. local GHexit
  836. _GenMP <h>,2,<opts>
  837. ifdef DEBUG
  838. if VLgen
  839. _FlsMJmp
  840. mov ax,_P_&h
  841. test al,0100b ; Reject GDT selectors
  842. jz @F
  843. cmp ax,0ffffh ; special case: -1 -> DS
  844. jz GHexit
  845. lar dx,ax ; is it a valid selector?
  846. jz GHexit
  847. @@:
  848. mov bx,ERR_BAD_GLOBAL_HANDLE or ERR_WARNING
  849. lcall Inval_Param_
  850. GHexit:
  851. endif
  852. endif
  853. endm
  854. MP_HICON equ <MP_GHANDLE>
  855. MP_HICON0 equ <MP_GHANDLE0>
  856. MP_HTASK equ <MP_GHANDLE>
  857. MP_HTASK0 equ <MP_GHANDLE0>
  858. ; Pointers
  859. MP_LP macro lptr,opts
  860. _GenMP <lptr>,4,<opts>
  861. if VLgen
  862. _FlsMJmp
  863. mov ax,_P_&lptr
  864. mov cx,_P_&lptr+2
  865. mov bx,1
  866. lcall LP
  867. _gensub LP
  868. endif
  869. endm
  870. MP_CLP macro lp,opts
  871. _GenMP <lp>,4,<opts>
  872. if VLgen
  873. _FlsMJmp
  874. mov ax,_P_&lp
  875. mov cx,_P_&lp+2
  876. mov bx,1
  877. lcall CLP
  878. _gensub LP
  879. endif
  880. endm
  881. MP_LP0 macro lp,opts
  882. _GenMP <lp>,4,<opts>
  883. if VLgen
  884. _FlsMJmp
  885. mov ax,_P_&lp
  886. mov cx,_P_&lp+2
  887. mov bx,1
  888. lcall LP0
  889. _gensub LP
  890. endif
  891. endm
  892. MP_CLP0 macro lp,opts
  893. _GenMP <lp>,4,<opts>
  894. if VLgen
  895. _FlsMJmp
  896. mov ax,_P_&lp
  897. mov cx,_P_&lp+2
  898. mov bx,1
  899. lcall CLP0
  900. _gensub LP
  901. endif
  902. endm
  903. MP_LPBUFFERCNT equ <MP_LP>
  904. MP_CLPSTR macro lpsz,opts
  905. _GenMP <lpsz>,4,<opts>
  906. if VLgen
  907. _FlsMJmp
  908. mov ax,_P_&lpsz
  909. mov cx,_P_&lpsz+2
  910. mov bx,-1
  911. lcall CLPSZ
  912. _gensub LPSZ
  913. endif
  914. endm
  915. MP_CLPSTR0 macro lpsz,opts
  916. _GenMP <lpsz>,4,<opts>
  917. if VLgen
  918. _FlsMJmp
  919. mov ax,_P_&lpsz
  920. mov cx,_P_&lpsz+2
  921. mov bx,-1
  922. lcall CLPSZ0
  923. _gensub LPSZ
  924. endif
  925. endm
  926. MP_LPSTRCB equ <MP_4> ; may be arbitrary 32-bit value
  927. MP_CLPSTRCB equ <MP_4>
  928. MP_CLPSTRLB equ <MP_4> ; may be arbitrary 32-bit value
  929. MP_CLPMSG0 equ <MP_CLP0>
  930. MP_LPRECT equ <MP_LP>
  931. MP_CLPRECT equ <MP_LP>
  932. MP_LPBUFFERX macro count, lpBuffer, opts
  933. MP_int <count>,<opts>
  934. MP_LP <lpBuffer>,<opts>
  935. endm
  936. MP_LPTSBUFFER0 macro cTabs, lpTabs, opts
  937. MP_int <cTabs>,<opts>
  938. MP_LP0 <lpTabs>,<opts>
  939. endm
  940. MP_LPWBUFFERX macro wCount, lpBuf, opts ;** lpBuf is int. buffer
  941. MP_int <count>,<opts>
  942. MP_LP <lpTabs>,<opts>
  943. endm
  944. MP_LPMEASUREITEMSTRUCT equ <MP_LP>
  945. MP_LPCREATESTRUCT equ <MP_LP>
  946. MP_CLPCOMPAREITEMSTRUCT equ <MP_CLP>
  947. MP_CLPDELETEITEMSTRUCT equ <MP_CLP>
  948. MP_CLPDRAWITEMSTRUCT equ <MP_CLP>
  949. MP_CLPMDICREATESTRUCT equ <MP_CLP>
  950. MP_CLP5POINTBUFFER equ <MP_CLP> ; array of 5 points
  951. ; Function pointers
  952. MP_LPFNWORDBREAK0 macro pfn,opts
  953. _GenMP <pfn>,4,<opts>
  954. if VLgen
  955. _FlsMJmp
  956. mov ax,_P_&pfn
  957. mov cx,_P_&pfn+2
  958. lcall LPFN0
  959. _gensub LPFN
  960. endif
  961. endm
  962. MP_LPFNTIMER0 macro pfn,opts
  963. _GenMP <pfn>,4,<opts>
  964. if VLgen
  965. _FlsMJmp
  966. mov ax,_P_&pfn
  967. mov cx,_P_&pfn+2
  968. lcall LPFN0
  969. _gensub LPFN
  970. endif
  971. endm
  972. ; More types
  973. MP_ATOM equ <MP_2>
  974. MP_ATOM0 equ <MP_2>
  975. MP_BIVALUE macro val,v1,v2,opts
  976. MP_2 <val>,<opts>
  977. endm
  978. MP_CBINDEX equ <MP_2>
  979. MP_CBINDEXFFFF equ <MP_2>
  980. MP_CBITEMHEIGHTFFFF equ <MP_2>
  981. MP_CHARINDEXFFFF equ <MP_2>
  982. MP_CHARVALUE equ <MP_2>
  983. MP_CID equ <MP_2>
  984. MP_CONST macro val, constant, opts ;** set to SMP_JOBSTATUS
  985. MP_2 <val>,<opts>
  986. endm
  987. MP_CTRLID equ <MP_2>
  988. MP_EDITPOS equ <MP_2>
  989. MP_EMCHARPOS equ <MP_2>
  990. MP_EMLINE equ <MP_2>
  991. MP_EMLINEFFFF equ <MP_2>
  992. MP_EMLINEFFFF equ <MP_2>
  993. MP_EMCLINE equ <MP_2>
  994. MP_LBINDEX equ <MP_2>
  995. MP_LBINDEXFFFF equ <MP_2>
  996. MP_LBLPBUFFERINDEX macro wIndex, lpBuf, opts
  997. MP_2 <wIndex>,<opts>
  998. MP_4 <lpBuf>,<opts>
  999. endm
  1000. MP_SHOWVALUE equ <MP_WORD>
  1001. MP_SYSCOMMAND equ <MP_WORD>
  1002. MP_VKEY equ <MP_WORD>
  1003. MP_WMMENUSELECT macro idOrHandle, flags, opts
  1004. MP_2 idOrHMenu ; id or menu handle
  1005. MP_2 flags ; may be -1
  1006. MP_2 hMenu ; may be NULL
  1007. endm
  1008. MP_WMNEXTDLGCTL macro hwndOrFPrev, fHandle, opts ;** if lParam is 0 wParam is a flag
  1009. MP_2 <hwndOrFPrev>,<opts>
  1010. MP_BOOL <fHandle>,<opts>
  1011. MP_WMBZ lParamH,<opts>
  1012. endm