Leaked source code of windows server 2003
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.

3053 lines
80 KiB

  1. ;===========================================================================
  2. ;
  3. ; For WOW only
  4. ;
  5. ;===========================================================================
  6. ;
  7. ; Validation constants
  8. ;
  9. PS_MAX equ 6
  10. HS_MAX equ 5
  11. BS_MAX equ 5
  12. FW_MAX equ 1000
  13. OUT_MAX equ 7
  14. CLIP_MAX equ 2
  15. QUALITY_MAX equ 2
  16. DIB_MAX equ 1
  17. PFILL_MIN equ 1
  18. PFILL_MAX equ 2
  19. EFF_MAX equ 1
  20. OBJ_MIN equ 1
  21. OBJ_MAX equ 2
  22. STOCK_MAX equ 19 ; should match sdk\inc\wingdi.h\STOCK_LAST
  23. RGN_MIN equ 1
  24. RGN_MAX equ 5
  25. BK_MIN equ 1
  26. BK_MAX equ 3 ;SHOULD let TRANSPARENT1 ROP code go through.
  27. R2_MIN equ 1
  28. R2_MAX equ 16
  29. STR_MIN equ 1
  30. STR_MAX equ 3
  31. PFILL_MIN equ 1
  32. PFILL_MAX equ 2
  33. MM_MIN equ 1
  34. MM_MAX equ 8
  35. DIB_MAX equ 1
  36. PR_MAX equ 4
  37. RM_MAX equ 2
  38. DIB_RGB_COLORS equ 0
  39. CBM_INIT equ 4
  40. BI_RGB equ 0
  41. TA_VALID equ 0001fh
  42. GLYPH_VALID equ 00003h
  43. MAPFLG_VALID_L equ 00001h
  44. MAPFLG_VALID_H equ 00000h
  45. CBM_VALID_L equ 00004h
  46. CBM_VALID_H equ 00000h
  47. ETO_VALID equ 00007h
  48. PC_VALID equ 00007h
  49. CCHDEVICENAME equ 32
  50. ;special error codes
  51. SP_ERROR equ -1
  52. ;============================================================================
  53. ;
  54. ; Special ATM hackery (See ATM HACK comments in dcman1.asm)
  55. ;
  56. ;ExternFP <LoadLibrary> TEMPLY !!!!!!!!!!! ChandanC
  57. ;ExternFP <FreeLibrary> TEMPLY !!!!!!!!!!! ChandanC
  58. ;ExternFP <GetProcAddress> TEMPLY !!!!!!!!!!! ChandanC
  59. ;
  60. ; Macro to set up stubs required for ATM's GDI patching code
  61. ;
  62. ATM_LPFN macro gdifunc, kernfunc
  63. IFNDEF WOW
  64. db 09ah ; call far instruction
  65. public gdifunc&kernfunc
  66. gdifunc&kernfunc:
  67. dd kernfunc
  68. ENDIF
  69. endm
  70. ;
  71. ; Argument types
  72. ;
  73. IFNDEF WOW
  74. ExternFP <IsGDIObject>
  75. ExternFP <IsValidMetaFile>
  76. ENDIF
  77. P_LPSIZE equ <P_LPPOINT>
  78. P_LPSIZE0 equ <P_LPPOINT0>
  79. ;
  80. ; Generate a GDI object validation macro.
  81. ;
  82. ; If nullok is 1, allow NULL.
  83. ; min & max are the allowed OBJ_* range.
  84. ; except, if specified, is an OBJ_* value within the range to reject.
  85. ;
  86. _GenHGDI macro name,func
  87. P_&name &macro hObj,opts
  88. _GenParm <hObj>,2,<opts>
  89. if VLgen
  90. IFNDEF WOW
  91. mov bx,_P_&&hObj
  92. lcall V&name
  93. _gensub name
  94. _gensub VGOT
  95. ENDIF
  96. endif
  97. &endm
  98. P_&name&0 &macro hObj,opts
  99. _GenParm <hObj>,2,<opts>
  100. if VLgen
  101. IFNDEF WOW
  102. mov bx,_P_&&hObj
  103. lcall V&name&0
  104. _gensub name
  105. _gensub VGOT
  106. ENDIF
  107. endif
  108. &endm
  109. endm
  110. _GenHGDI <HGDIOBJ>
  111. _GenHGDI <HPEN>
  112. _GenHGDI <HBRUSH>
  113. _GenHGDI <HFONT>
  114. _GenHGDI <HPALETTE>
  115. _GenHGDI <HBITMAP>
  116. _GenHGDI <HRGN>
  117. ; HDC variants: HDC - Any kind of DC except a metafile DC
  118. _GenHGDI <HDC>
  119. ; Anything including a metafile DC
  120. _GenHGDI <HDCMETA>
  121. P_HDCNOTMEM equ <P_HDCMETA>
  122. ; output-only DC - metafiles ok but no ICs allowed
  123. _GenHGDI <HDCNOIC>
  124. ; output-only DC - neither metafiles nor ICs allowed
  125. _GenHGDI <HDCNOICNOMETA>
  126. ; GetObject(): Pen, brush, font, palette, or bitmap.
  127. ;
  128. _GenHGDI <HGDIOBJGET>
  129. ; UnrealizeObject(): Brush or palette
  130. ;
  131. _GenHGDI <HGDIOBJUNR>
  132. ; SelectObject(): pen, brush, font, bitmap, region (no palette)
  133. ;
  134. _GenHGDI <HGDIOBJSEL>
  135. ; Metafile handle
  136. ;
  137. P_HMETAFILE macro hmf,opts
  138. _GenParm <hmf>,2,<opts>
  139. if VLgen
  140. IFNDEF WOW
  141. mov ax,_P_&hmf
  142. lcall VHMETAFILE
  143. _gensub VHMETAFILE
  144. ENDIF
  145. endif
  146. endm
  147. _GenHGDIX macro name,errtyp,lseg,min,max,except
  148. local badobj
  149. local objok
  150. local trap
  151. IFNDEF WOW
  152. public V&name&0&lseg
  153. V&name&0&lseg:
  154. or bx,bx
  155. jz objok
  156. public V&name&lseg
  157. V&name&lseg:
  158. lcall VGetObjType
  159. ifnb <except>
  160. cmp ax,except
  161. jz badobj
  162. endif
  163. ife min-max
  164. cmp ax,min
  165. jne badobj
  166. errnz $-objok
  167. else
  168. cmp ax,min
  169. jb badobj
  170. cmp ax,max
  171. ja badobj
  172. endif
  173. objok:
  174. ret
  175. badobj:
  176. mov ax,cx
  177. mov bx,ERR_BAD_&errtyp
  178. ljmp Inval_Param_
  179. ENDIF
  180. endm ; _GenHGDIX
  181. ;
  182. ; Macro that gets expanded in each LAYER_EXPAND invocation. Includes common
  183. ; subroutines for parameter validation.
  184. ;
  185. EXTRA_EXPAND macro lseg
  186. ifdef genHGDIOBJ&lseg
  187. _GenHGDIX <HGDIOBJ>,GDI_OBJECT,lseg,OBJ_PEN,OBJ_METAFILE ; DeleteObject: any kind of object
  188. endif
  189. ifdef genHPEN&lseg
  190. _GenHGDIX <HPEN>,lseg,HPEN,OBJ_PEN,OBJ_PEN
  191. endif
  192. ifdef genHBRUSH&lseg
  193. _GenHGDIX <HBRUSH>,HBRUSH,lseg,OBJ_BRUSH,OBJ_BRUSH
  194. endif
  195. ifdef genHFONT&lseg
  196. _GenHGDIX <HFONT>,HFONT,lseg,OBJ_FONT,OBJ_FONT
  197. endif
  198. ifdef genHPALETTE&lseg
  199. _GenHGDIX <HPALETTE>,HPALETTE,lseg,OBJ_PALETTE,OBJ_PALETTE
  200. endif
  201. ifdef genHBITMAP&lseg
  202. _GenHGDIX <HBITMAP>,HBITMAP,lseg,OBJ_BITMAP,OBJ_BITMAP
  203. endif
  204. ifdef genHRGN&lseg
  205. _GenHGDIX <HRGN>,HRGN,lseg,OBJ_RGN,OBJ_RGN
  206. endif
  207. ; GetObject(): Pen, brush, font, palette, or bitmap.
  208. ;
  209. ifdef genHGDIOBJGET&lseg
  210. _GenHGDIX <HGDIOBJGET>,GDI_OBJECT,lseg,OBJ_PEN,OBJ_BITMAP
  211. endif
  212. ; UnrealizeObject(): Brush or palette
  213. ;
  214. ifdef genHGDIOBJUNR&lseg
  215. _GenHGDIX <HGDIOBJUNR>,GDI_OBJECT,lseg,OBJ_BRUSH,OBJ_PALETTE,OBJ_FONT
  216. endif
  217. ; SelectObject(): pen, brush, font, bitmap, region (no palette)
  218. ;
  219. ifdef genHGDIOBJSEL&lseg
  220. _GenHGDIX <HGDIOBJSEL>,GDI_OBJECT,lseg,OBJ_PEN,OBJ_RGN,OBJ_PALETTE
  221. endif
  222. ; HDC variants: HDC - Any kind of DC except a metafile DC
  223. ifdef genHDC&lseg
  224. _GenHGDIX <HDC>,HDC,lseg,OBJ_DC,OBJ_METADC
  225. endif
  226. ; Anything including a metafile DC
  227. ifdef genHDCMETA&lseg
  228. _GenHGDIX <HDCMETA>,HDC,lseg,OBJ_DC,OBJ_METAFILE
  229. endif
  230. ; output-only DC - metafiles ok but no ICs allowed
  231. ifdef genHDCNOIC&lseg
  232. _GenHGDIX <HDCNOIC>,HDC,lseg,OBJ_DC,OBJ_METAFILE,OBJ_IC
  233. endif
  234. ; output-only DC - neither metafiles nor ICs allowed
  235. ifdef genHDCNOICNOMETA&lseg
  236. _GenHGDIX <HDCNOICNOMETA>,HDC,lseg,OBJ_DC,OBJ_DC
  237. endif
  238. IFNDEF WOW
  239. ifdef genVGOT&lseg
  240. public VGetObjType&lseg
  241. VGetObjType&lseg:
  242. mov cx,bx
  243. jcxz VGOTbad&lseg
  244. beg_fault_trap VGOTtrap&lseg
  245. mov ax,_DATA
  246. mov es,ax
  247. mov bx,es:[bx]
  248. mov ax,es:[bx].ilObjType
  249. end_fault_trap
  250. and ah,high(not OBJ_FLAGS)
  251. errnz low(Stock)
  252. ret
  253. VGOTtrap&lseg:
  254. fault_fix_stack
  255. VGOTbad&lseg:
  256. xor ax,ax
  257. ret
  258. endif ; genVGOT&lseg
  259. ifdef genVHMETAFILE&lseg
  260. public VHMETAFILE&lseg
  261. VHMETAFILE&lseg:
  262. push ax
  263. push ax
  264. call IsValidMetaFile
  265. or ax,ax
  266. pop ax
  267. jz @F
  268. ret
  269. @@:
  270. mov bx,ERR_BAD_HMETAFILE
  271. jmp short Inval_Param_&lseg
  272. endif ; genVHMETAFILE&lseg
  273. ENDIF
  274. endm ; EXTRA_EXPAND
  275. P_ROP equ <P_DWORD>
  276. P_COLORREF equ <P_DWORD>
  277. _GenLP <P_CLPLOGPALETTE>,<CLP>,1
  278. _GenLP <P_CLPBITMAP>,<CLP>,1
  279. _GenLP <P_LPHANDLETABLE0>,<LP0>,2
  280. _GenLP <P_CLPBITMAPINFOHEADER>,<CLP>,1
  281. P_CLPSTRHRSRC equ <P_CLPSTRATOM>
  282. _GenLP <P_CLPDOCINFO>,<CLP>,1
  283. P_CLPFACENAME equ <P_CLPSTR>
  284. P_CLPFACENAME0 equ <P_CLPSTR0>
  285. P_LPFNABORT0 equ <P_LPFN0>
  286. P_LPFNMENUM equ <P_LPFN>
  287. P_LPFNOENUM equ <P_LPFN>
  288. P_LPFNFENUM equ <P_LPFN>
  289. P_LPFNLENUM equ <P_LPFN>
  290. P_intN0 equ <P_WORDMBNZ>
  291. P_DEVCAP equ <P_int>
  292. P_PITCHFAMILY equ <P_BYTE>
  293. P_LPPOINTBUFFER macro p, c, opts
  294. _DefParm <p>,4,<opts>
  295. _DefParm <c>,2,<opts>
  296. if VLgen
  297. _FlsFrame
  298. mov ax,_P_&p
  299. mov cx,_P_&p+2
  300. mov bx,_P_&c
  301. shl bx,2
  302. errnz VLcbsPOINT-4
  303. lcall LP
  304. _gensub LP
  305. endif
  306. endm
  307. P_CLPPOINTBUFFER macro lptr, c, opts
  308. _DefParm <lptr>,4,<opts>
  309. _DefParm <c>,2,<opts>
  310. if VLgen
  311. _FlsFrame
  312. mov ax,_P_&lptr
  313. mov cx,_P_&lptr+2
  314. mov bx,_P_&c
  315. shl bx,2
  316. errnz VLcbsPOINT-4
  317. lcall CLP
  318. _gensub LP
  319. endif
  320. endm
  321. STRUCT <PALETTEENTRY>
  322. F_BYTE peRed
  323. F_BYTE peGreen
  324. F_BYTE peBlue
  325. F_BFLAGS peFlags, PC_VALID
  326. ENDSTRUCT
  327. P_LPPALENTRYBUFFER macro c, p, opts
  328. _DefParm <c>,2,<opts>
  329. _DefParm <p>,4,<opts>
  330. if VLgen
  331. _FlsFrame
  332. mov ax,_P_&p
  333. mov cx,_P_&p+2
  334. mov bx,_P_&c
  335. shl bx,2
  336. errnz VLcbsPALETTEENTRY-4
  337. lcall LP
  338. _gensub LP
  339. endif
  340. endm
  341. P_CLPPALENTRYBUFFER macro c, lp, opts
  342. _DefParm <c>,2,<opts>
  343. _DefParm <lp>,4,<opts>
  344. if VLgen
  345. _FlsFrame
  346. mov ax,_P_&lp
  347. mov cx,_P_&lp+2
  348. mov bx,_P_&c
  349. shl bx,2
  350. errnz VLcbsPALETTEENTRY-4
  351. lcall CLP
  352. _gensub LP
  353. endif
  354. endm
  355. ;
  356. ; lppt - pointer to array of points: size = sum(lpcpt).
  357. ; lpcpt - pointer to array of counts of points
  358. ; ccpt - number of point counts in *lpcpt.
  359. ;
  360. P_POLYPOLYPOINTS macro lppt, lpcpt, ccpt, opts
  361. P_LPPOINT <lppt>,<opts>
  362. P_LPINT <lpcpt>,<opts>
  363. P_int <ccpt>,<opts>
  364. endm
  365. ifdef WOW
  366. P_POLYPOLYLARGEPOINTS macro lppt, lpcpt, ccpt, opts
  367. P_LPLARGEPOINT <lppt>,<opts>
  368. P_LPDWORD <lpcpt>,<opts>
  369. P_DWORD <ccpt>,<opts>
  370. endm
  371. endif
  372. P_XY1XY2 macro x1,y1,x2,y2, opts
  373. P_int <x1>,<opts>
  374. P_int <y1>,<opts>
  375. P_int <x2>,<opts>
  376. P_int <y2>,<opts>
  377. endm
  378. P_LPBUFFERDW macro cb, lp, opts
  379. P_DWORD <cb>,<opts>
  380. P_LPBYTE <lp>,<opts>
  381. endm
  382. P_LPBUFFERDW0 macro cb, lp, opts
  383. P_DWORD <cb>,<opts>
  384. P_LPBYTE0 <lp>,<opts>
  385. endm
  386. P_CLPBUFFERDW macro cb, lp, opts
  387. P_DWORD <cb>,<opts>
  388. P_CLPBYTE <lp>,<opts>
  389. endm
  390. P_LPBUFFERX macro cb, pb, opts
  391. P_int <cb>,<opts>
  392. P_LPBYTE <pb>,<opts>
  393. endm
  394. ValidateHugeLP macro cch, lp, r, null
  395. local exit
  396. ifnb <null>
  397. mov ax,lp
  398. or ax,lp+2
  399. jz exit
  400. endif
  401. push lp+2
  402. push lp
  403. push cch+2
  404. push cch
  405. call &r
  406. or ax,ax
  407. jz exit
  408. mov cx, lp+2
  409. mov ax, lp
  410. mov bx,ERR_BAD_PTR
  411. lcall Inval_Param_
  412. exit:
  413. endm
  414. ;----------------------------------------------------------------------------;
  415. ; This macro is used to validate the buffer length for the two APIs
  416. ; GetCharWidth and GetABCWidths. The 'size' parameter is not a part of the
  417. ; API. It is the size of each entry in the buffer. The number of entries are
  418. ; dictated by the character range passed in.
  419. P_LPRWBUFFER macro chFirst, chLast, lpBuffer, size, opts
  420. local exit
  421. _GenParm <chFirst>,2,<opts>
  422. _GenParm <chLast>,2,<opts>
  423. _GenParm <lpBuffer>,4,<opts>
  424. if VLgen
  425. _FlsFrame
  426. ;; first validate that the character range is not inverted.
  427. mov ax,_P_&chLast ;;last character in range
  428. cmp ax,_P_&chFirst ;;should not be < than first character
  429. jae @F ;;range is proper
  430. ;; character range is not valid.
  431. mov bx,ERR_BAD_VALUE ;;invalid parameter error.
  432. lcall Inval_Param_
  433. jmp exit
  434. @@:
  435. ;; the size of the buffer should atleast be (chLast-chFirst+1)*size
  436. sub ax,_P_&chFirst
  437. inc ax ;;no of entries
  438. mov bx,size ;;size of each entry
  439. mul bx
  440. mov bx,ax ;;total size (ignore DX)
  441. mov ax,_P_&lpBuffer
  442. mov cx,_P_&lpBuffer+2
  443. lcall LP
  444. _gensub LP
  445. exit:
  446. endif
  447. endm
  448. ;----------------------------------------------------------------------------;
  449. P_CLPRECTBITSINFOBUFFER macro cyDst, xSrc, ySrc, nStartScan,nNumScans, lpBits, lpBitsInfo, wUsage, opts
  450. P_VALIDATEBITSINFOBUFFER DIB_DIBTODEV, cyDst, xSrc, ySrc, nStartScan, nNumScans, lpBits, lpBitsInfo, wUsage, DIB_PTR_CLP, DIB_PTR_CLP, opts
  451. endm
  452. ;----------------------------------------------------------------------------;
  453. P_CLPBITSINFOBUFFER macro cscan, lpBits, lpBitsInfo, wUsage, opts
  454. P_VALIDATEBITSINFOBUFFER DIB_PART_DIB, 0, 0, 0, 0, cscans, lpBits, lpBitsInfo, wUsage, DIB_PTR_CLP, DIB_PTR_CLP, opts
  455. endm
  456. ;----------------------------------------------------------------------------;
  457. P_LPBITSINFOBUFFER macro cScans, lpBits, lpBitsInfo, wUsage, opts
  458. P_VALIDATEBITSINFOBUFFER DIB_PART_DIB, 0, 0, 0, 0, cscans, lpBits, lpBitsInfo, wUsage, DIB_PTR_LP, DIB_PTR_LP, opts
  459. endm
  460. ;----------------------------------------------------------------------------;
  461. ;NOTE: It is assumed that this macro is only called from GetDIBits. The flag
  462. ;DIB_PTR_GETDIBITS is a special one which tells the ValidateDIBHeader routine
  463. ;to ignore the biClrUsed field.
  464. P_LPBITSINFOBUFFER0 macro cScans, lpBits, lpBitsInfo, wUsage, opts
  465. P_VALIDATEBITSINFOBUFFER DIB_PART_DIB, 0, 0, 0, 0, cscans, lpBits, lpBitsInfo, wUsage, DIB_PTR_LP0, DIB_PTR_GETDIBITS, opts
  466. endm
  467. ;----------------------------------------------------------------------------;
  468. P_CFULLLPBITSINFOBUFFER macro lpBits, lpBitsInfo, wUsage, opts
  469. P_VALIDATEBITSINFOBUFFER DIB_FULL_DIB, 0, 0, 0, 0, 0, lpBits, lpBitsInfo, wUsage, DIB_PTR_CLP, DIB_PTR_CLP, opts
  470. endm
  471. ;----------------------------------------------------------------------------;
  472. P_GHPACKEDDIB macro hDIB, wUsage, opts
  473. local exit
  474. local errexit
  475. ;; hDIB is a global handle to a apacked DIB.
  476. _GenParm <hDIB>,2,<opts>
  477. _GenParm <wUsage>,2,<opts>
  478. if VLgen
  479. ;; first validate the handle itself.
  480. IFNDEF WOW
  481. mov ax,_P_&hDIB
  482. lcall GHANDLE
  483. _gensub GHANDLE
  484. ENDIF
  485. ;; validate wUsage
  486. mov ax,_P_&wUsage
  487. cmp ax,DIB_MAX
  488. jbe @F ;; unsigned comparison to catch < 0.
  489. mov bx,ERR_BAD_VALUE
  490. lcall Inval_Param_
  491. jmp exit
  492. @@:
  493. push si
  494. push di ;;save
  495. ;; validate the header.
  496. mov dx,_P_&wUsage
  497. xor ax,ax
  498. mov cx,_P_&hDIB ;;CX:AX has a pointer to the DIB
  499. mov di, DIB_VALIDATE_COLOR + DIB_PTR_CLP
  500. call ValidateDIBHeader
  501. or ax,ax
  502. jz @f ;;valid header
  503. pop di
  504. pop si ;;restore
  505. mov bx,ERR_BAD_PTR
  506. lcall Inval_Param_
  507. jmp exit
  508. @@:
  509. ;; the header has been validated. DI:SI returns the pointer past the end of
  510. ;; the DIB header and the color table. For a packed DIB this is the start of
  511. ;; the bits.
  512. mov es,_P_&hDIB
  513. xor bx,bx ;;es:bx-> header, di:si -> bits
  514. mov cx, DIB_FULL_DIB+DIB_PTR_CLP
  515. call ValidateDIBSize
  516. pop di
  517. pop si
  518. or ax,ax
  519. jz exit ;;valid size
  520. mov bx,ERR_BAD_PTR
  521. lcall Inval_Param_
  522. exit:
  523. endif
  524. endm
  525. ;----------------------------------------------------------------------------;
  526. P_CLPBITMAPINFOHEADER macro lpBi, opts
  527. local exit
  528. ;; lpBi - pointer to bitmap info header which does not have a color table
  529. _GenParm <lpBi>,4,<opts>
  530. if VLgen
  531. push si
  532. push di
  533. mov ax,word ptr _P_&lpBi
  534. mov cx,word ptr _P_&lpBi+2
  535. mov di, DIB_NO_COLOR + DIB_PTR_CLP
  536. call ValidateDIBHeader
  537. pop di
  538. pop si
  539. or ax,ax
  540. jz exit
  541. mov bx,ERR_BAD_PTR
  542. lcall Inval_Param_
  543. exit:
  544. endif
  545. endm
  546. ;----------------------------------------------------------------------------;
  547. P_CLPDIBITMAP0 macro dwUsage, lpInitBits, lpInitInfo, wUsage, opts
  548. local validate_dib
  549. local no_init
  550. local exit
  551. local flags_ok
  552. _DefParm <dwUsage>,4,<opts>
  553. _DefParm <lpInitBits>,4,<opts>
  554. _DefParm <lpInitInfo>,4,<opts>
  555. _DefParm <wUsage>,2,<opts>
  556. if VLgen
  557. _FlsFrame
  558. ifdef DEBUG
  559. mov ax,_P_&dwUsage
  560. mov cx,_P_&dwUsage+2
  561. test ax,not(CBM_VALID_L)
  562. jnz @F
  563. test cx,not(CBM_VALID_H)
  564. jz flags_ok
  565. @@:
  566. mov bx,ERR_BAD_DFLAGS
  567. lcall Inval_Param_
  568. flags_ok:
  569. endif ;DEBUG
  570. ;; the rest of the validation depends on the value of dwUsage.
  571. cmp word ptr _P_&dwUsage+2,0
  572. jne no_init
  573. mov ax, word ptr _P_&dwUsage
  574. cmp ax,CBM_INIT
  575. je validate_dib
  576. no_init:
  577. mov ax,_P_&lpInitBits
  578. mov cx,_P_&lpInitBits+2
  579. xor bx,bx
  580. lcall CLP0
  581. _gensub LP
  582. mov ax,_P_&lpInitInfo
  583. mov cx,_P_&lpInitInfo+2
  584. xor bx,bx
  585. lcall CLP0
  586. mov ax,_P_&wUsage
  587. cmp ax,DIB_MAX
  588. jbe @F ;; unsigned comparison to catch < 0.
  589. mov bx,ERR_BAD_VALUE
  590. lcall Inval_Param_
  591. @@:
  592. jmp exit
  593. validate_dib:
  594. ;; validate the bitmap info header first. Validate the color table size too.
  595. push si
  596. push di
  597. mov ax,word ptr _P_&lpInitInfo
  598. mov cx,word ptr _P_&lpInitInfo+2
  599. mov dx,_P_&wUsage
  600. mov di, DIB_VALIDATE_COLOR + DIB_PTR_CLP
  601. call ValidateDIBHeader
  602. or ax,ax
  603. jz @f
  604. pop di
  605. pop si
  606. mov bx,ERR_BAD_PTR
  607. lcall Inval_Param_
  608. jmp exit
  609. @@:
  610. ;; now validate the size of the bitsbuffer. Use complete height
  611. mov si, word ptr _P_&lpInitBits
  612. mov di, word ptr _P_&lpInitBits+2
  613. les bx,_P_&lpInitInfo
  614. mov cx, DIB_FULL_DIB+DIB_PTR_CLP
  615. call ValidateDIBSize
  616. pop di
  617. pop si
  618. or ax,ax
  619. jz exit
  620. mov bx,ERR_BAD_PTR
  621. lcall Inval_Param_
  622. exit:
  623. endif
  624. endm
  625. ;----------------------------------------------------------------------------;
  626. P_CLPBITBUFFER0 macro cx, cy, cPlanes, cBitsPixel, lpBits, opts
  627. P_int <cx>,<opts>
  628. P_int <cy>,<opts>
  629. P_int <cPlanes>,<opts>
  630. P_int <cBitsPixel>,<opts>
  631. P_CLPBYTE0 <lpBits>,<opts>
  632. endm
  633. P_CLPETOBUF macro lpsz, cch, lpdx, opts
  634. P_CLPBUFFER0 <lpsz>,<cch>,<opts>
  635. P_CLPINT0 <lpdx>,<opts>
  636. endm
  637. P_TEXTEXTEX macro lpsz, cch, nMaxExt, lpnFit, lpDx, opts
  638. P_CLPBUFFER <lpsz>,<cch>,<opts>
  639. P_int <nMaxExt>,<opts>
  640. P_LPINT0 <lpnFit>,<opts>
  641. P_LPINT0 <lpDX>,<opts>
  642. endm
  643. ;
  644. ; GDI structures
  645. ;
  646. _DefSimpleF F_LBCOLOR,4
  647. _DefSimpleF F_CLPBITS,4
  648. _DefSimpleF F_DWSIZE,4
  649. _DefSimpleF F_COMPRESS,4
  650. _DefSimpleF F_DIBSIZE0,4
  651. _DefSimpleF F_HMF,2
  652. _DefSimpleF F_VALUE,2
  653. _DefSimpleF F_WMBZ,2
  654. _DefSimpleF F_WSIZE,2
  655. _DefSimpleF F_CONST,2
  656. _DefSimpleF F_BITCOUNT,2
  657. _DefSimpleF F_RVALUE,2
  658. _DefSimpleF F_short,2
  659. _DefSimpleF F_VERSION,2
  660. _DefSimpleF F_PITCHFAMILY,1
  661. _DefSimpleF F_BVALUE,1
  662. _DefSimpleF F_BFLAGS,1
  663. STRUCT <RGBQUAD>
  664. F_BYTE rgbBlue
  665. F_BYTE rgbGreen
  666. F_BYTE rgbRed
  667. F_BYTE rgbReserved
  668. ENDSTRUCT
  669. STRUCT <RGBTRIPLE>
  670. F_BYTE rgbtBlue
  671. F_BYTE rgbtGreen
  672. F_BYTE rgbtRed
  673. ENDSTRUCT
  674. STRUCT <LOGBRUSH>
  675. F_VALUE lbStyle, BS_MAX
  676. F_LBCOLOR lbColor
  677. F_VALUE lbHatch, HS_MAX
  678. ENDSTRUCT
  679. _GenLP <P_CLPLOGBRUSH>,<CLP>,%VLcbsLOGBRUSH
  680. _GenLP <P_CLPLOGBRUSH0>,<CLP0>,%VLcbsLOGBRUSH
  681. _GenLP <P_LPLOGBRUSH>,<LP>,%VLcbsLOGBRUSH
  682. _GenLP <P_LPLOGBRUSH0>,<LP0>,%VLcbsLOGBRUSH
  683. STRUCT <LOGFONT>
  684. F_int lfHeight
  685. F_int lfWidth
  686. F_int lfEscapement
  687. F_int lfOrientation
  688. F_VALUE lfWeight, FW_MAX
  689. F_BYTE lfItalic
  690. F_BYTE lfUnderline
  691. F_BYTE lfStrikeOut
  692. F_BYTE lfCharSet
  693. F_BVALUE lfOutPrecision, OUT_MAX
  694. F_BVALUE lfClipPrecision, CLIP_MAX
  695. F_BVALUE lfQuality, QUALITY_MAX
  696. F_PITCHFAMILY lfPitchAndFamily
  697. F_BYTE lfFaceName ;var-length field
  698. ENDSTRUCT
  699. _GenLP <P_CLPLOGFONT>,<CLP>,%VLcbsLOGFONT
  700. _GenLP <P_CLPLOGFONT0>,<CLP0>,%VLcbsLOGFONT
  701. _GenLP <P_LPLOGFONT>,<LP>,%VLcbsLOGFONT
  702. _GenLP <P_LPLOGFONT0>,<LP0>,%VLcbsLOGFONT
  703. STRUCT <LOGPEN>
  704. F_VALUE lopnStyle, PS_MAX
  705. F_POINT lopnWidth
  706. F_DWORD lopnColor
  707. ENDSTRUCT
  708. _GenLP <P_CLPLOGPEN>,<CLP>,%VLcbsLOGPEN
  709. _GenLP <P_CLPLOGPEN0>,<CLP0>,%VLcbsLOGPEN
  710. _GenLP <P_LPLOGPEN>,<LP>,%VLcbsLOGPEN
  711. _GenLP <P_LPLOGPEN0>,<LP0>,%VLcbsLOGPEN
  712. STRUCT <METAFILEPICT>
  713. F_RVALUE nMapMode, MM_MIN, MM_MAX
  714. F_int xExt
  715. F_int yExt
  716. F_HMF hMF
  717. ENDSTRUCT
  718. _GenLP <P_CLPMETAFILEPICT>,<CLP>,%VLcbsMETAFILEPICT
  719. _GenLP <P_CLPMETAFILEPICT0>,<CLP0>,%VLcbsMETAFILEPICT
  720. _GenLP <P_LPMETAFILEPICT>,<LP>,%VLcbsMETAFILEPICT
  721. _GenLP <P_LPMETAFILEPICT0>,<LP0>,%VLcbsMETAFILEPICT
  722. STRUCT <TEXTMETRIC> ;currently used only for output
  723. F_int tmHeight
  724. F_int tmAscent
  725. F_int tmDescent
  726. F_int tmInternalLeading
  727. F_int tmExternalLeading
  728. F_int tmAveCharWidth
  729. F_int tmMaxCharWidth
  730. F_int tmWeight
  731. F_BYTE tmItalic
  732. F_BYTE tmUnderlined
  733. F_BYTE tmStruckOut
  734. F_BYTE tmFirstChar
  735. F_BYTE tmLastChar
  736. F_BYTE tmDefaultChar
  737. F_BYTE tmBreakChar
  738. F_BYTE tmPitchAndFamily
  739. F_BYTE tmCharSet
  740. F_int tmOverhang
  741. F_int tmDigitizedAspectX
  742. F_int tmDigitizedAspectY
  743. ENDSTRUCT
  744. _GenLP <P_CLPTEXTMETRIC>,<CLP>,%VLcbsTEXTMETRIC
  745. _GenLP <P_CLPTEXTMETRIC0>,<CLP0>,%VLcbsTEXTMETRIC
  746. _GenLP <P_LPTEXTMETRIC>,<LP>,%VLcbsTEXTMETRIC
  747. _GenLP <P_LPTEXTMETRIC0>,<LP0>,%VLcbsTEXTMETRIC
  748. ; OutlineTextMetrics return buffer
  749. ;
  750. P_LPETM0 macro cch, lpch, opts
  751. _DefParm <cch>,2,<opts>
  752. _DefParm <lpch>,4,<opts>
  753. if VLgen
  754. _FlsFrame
  755. mov ax,_P_&lpch
  756. mov cx,_P_&lpch+2
  757. mov bx,_P_&cch
  758. lcall LP0
  759. _gensub LP
  760. endif
  761. endm
  762. ; GetGlyphOutline return buffer.
  763. ;
  764. P_LPGGO0 macro cch, lpch, opts
  765. _DefParm <cch>,4,<opts>
  766. _DefParm <lpch>,4,<opts>
  767. if VLgen
  768. _FlsFrame
  769. ;; The buffer should be atleast of the given size.
  770. ValidateHugeLP _P_&cch, _P_&lpch, IsBadHugeWritePtr, NULL
  771. endif
  772. endm
  773. ; GetFontData return buffer
  774. ;
  775. P_LPFDATA0 macro lpch, cch, opts
  776. _DefParm <lpch>,4,<opts>
  777. _DefParm <cch>,4,<opts>
  778. if VLgen
  779. _FlsFrame
  780. ValidateHugeLP _P_&cch, _P_&lpch, IsBadHugeWritePtr, NULL
  781. endif
  782. endm
  783. ;---------------------------------------------------------------------------;
  784. ; hugw pointer validation routine.
  785. STRUCT <GLYPHMETRICS> ;only used for output
  786. F_WORD gmBlackBoxX
  787. F_WORD gmBlackBoxY
  788. F_POINT gmptGlyphOrigin
  789. F_short gmCellIncX
  790. F_short gmCellIncY
  791. ENDSTRUCT
  792. _GenLP <P_CLPGLYPHMETRICS>,<CLP>,%VLcbsGLYPHMETRICS
  793. _GenLP <P_CLPGLYPHMETRICS0>,<CLP0>,%VLcbsGLYPHMETRICS
  794. _GenLP <P_LPGLYPHMETRICS>,<LP>,%VLcbsGLYPHMETRICS
  795. _GenLP <P_LPGLYPHMETRICS0>,<LP0>,%VLcbsGLYPHMETRICS
  796. STRUCT METARECORD
  797. F_DWORD rdSize
  798. F_WORD rdFunction
  799. F_WORD rdParm ;var. length field
  800. ENDSTRUCT
  801. _GenLP <P_CLPMETARECORD>,<CLP>,%VLcbsMETARECORD
  802. _GenLP <P_CLPMETARECORD>,<CLP0>,%VLcbsMETARECORD
  803. _GenLP <P_LPMETARECORD>,<LP>,%VLcbsMETARECORD
  804. _GenLP <P_LPMETARECORD>,<LP0>,%VLcbsMETARECORD
  805. ;-------------------------------
  806. ; special-case macro definitions
  807. STRUCT <BITMAP>
  808. F_intMBZ bmType
  809. F_int bmWidth
  810. F_int bmHeight
  811. F_int bmWidthBytes
  812. F_BYTE bmPlanes
  813. F_BYTE bmBitsPixel
  814. F_CLPBITS bmBits
  815. ENDSTRUCT
  816. P_CLPBITMAP macro lp, opts
  817. _GenParm <lp>,4,<opts>
  818. if VLgen
  819. mov ax,_P_&lp
  820. mov cx,_P_&lp+2
  821. mov bx,VLcbsBITMAP
  822. lcall CLP
  823. _gensub LP
  824. les bx,_P_&lp ; Accept bmBits == NULL
  825. mov ax,es:[bx]._F_bmBits
  826. mov cx,es:[bx]._F_bmBits+2
  827. or ax,cx
  828. jz @F
  829. xor ax,ax
  830. mov al,es:[bx]._F_bmPlanes ;bmPlanes
  831. mul word ptr es:[bx]._F_bmHeight
  832. mul word ptr es:[bx]._F_bmWidthBytes
  833. xchg ax,dx
  834. mov ax,es:[bx]._F_bmBits
  835. mov bx,dx ;bx = size
  836. lcall CLP
  837. _gensub LP
  838. @@:
  839. endif
  840. endm
  841. STRUCT <BITMAPCOREHEADER>
  842. F_DWSIZE bcSize
  843. F_WORD bcWidth
  844. F_WORD bcHeight
  845. F_CONST bcPlanes, 1
  846. F_BITCOUNT bcBitCount
  847. ENDSTRUCT
  848. STRUCT <BITMAPINFOHEADER>
  849. F_DWSIZE biSize
  850. F_WORD biWidthLo
  851. F_WMBZ biWidthHi
  852. F_WORD biHeightLo
  853. F_WMBZ biHeightHi
  854. F_CONST biPlanes, 1
  855. F_BITCOUNT biBitCount
  856. F_COMPRESS biCompression
  857. F_DIBSIZE0 biSizeImage
  858. F_DWORD biXPelsPerMeter
  859. F_DWORD biYPelsPerMeter
  860. F_DWORD biClrUsed
  861. F_DWORD biClrImportant
  862. ENDSTRUCT
  863. ;----------------------------------------------------------------------------;
  864. P_VALIDATEBITSINFOBUFFER macro fn, yE, xS, yS, nStart, n, lpBits, lpBi, wUse, rBits, rBi, opts
  865. local exit
  866. local total_clip
  867. ;; NOTE: The first 4 parameters are defined only when fn & DIB_RECT_DIB is
  868. ;; TRUE (they are 0 otherwise).
  869. ;; The 5th parameter is undefined if fn & DIB_FULL_DIB is TRUE.
  870. ;; yE - yExtent in DIB (only when fn & DIB_RECT_DIB is TRUE)
  871. ;; xS - xStart in DIB (only when fn & DIB_RECT_DIB is TRUE)
  872. ;; yS - yStart in DIB (only when fn & DIB_RECT_DIB is TRUE)
  873. ;; nStart - start DIB scan (only when fn & DIB_RECT_DIB is TRUE)
  874. ;;
  875. ;; n - numScans parameter. If fn & DIB_FULL_DIB is TRUE, n is not defined.
  876. ;; lpBits - pointer to the bits
  877. ;; lpBi - pointer to bitmap info
  878. ;; wUse - the wUsage parameter
  879. ;; rBits - routine to validate length of lpBits buffer
  880. ;; rBi - routine to validate length of lpBi buffer.
  881. ;; opts - optional parameters
  882. if fn and DIB_RECT_DIB
  883. _DefParm <yE>,2,<opts>
  884. _DefParm <xS>,2,<opts>
  885. _DefParm <yS>,2,<opts>
  886. _DefParm <nStart>,2,<opts>
  887. endif
  888. if fn and DIB_PART_DIB
  889. _DefParm <n>,2,<opts>
  890. endif
  891. _DefParm <lpBits>,4,<opts>
  892. _DefParm <lpBi>,4,<opts>
  893. _DefParm <wUsage>,2,<opts>
  894. if VLgen
  895. _FlsFrame
  896. ;; validate wUsage
  897. mov ax,_P_&wUsage
  898. cmp ax,DIB_MAX
  899. jbe @F ;; unsigned comparison to catch < 0.
  900. mov bx,ERR_BAD_VALUE
  901. lcall Inval_Param_
  902. @@:
  903. push si
  904. push di
  905. ;; validate the bitmap info header first. Validate the color table size too.
  906. mov ax,word ptr _P_&lpBi
  907. mov cx,word ptr _P_&lpBi+2
  908. mov dx,_P_&wUsage
  909. mov di, DIB_VALIDATE_COLOR
  910. or di, rBi
  911. call ValidateDIBHeader
  912. or ax,ax
  913. jz @f
  914. pop di
  915. pop si
  916. mov bx,ERR_BAD_PTR
  917. lcall Inval_Param_
  918. jmp exit
  919. @@:
  920. ;; now validate the size of the bitsbuffer.
  921. mov si, word ptr _P_&lpBits
  922. mov di, word ptr _P_&lpBits+2
  923. les bx,_P_&lpBi
  924. if fn and DIB_PART_DIB
  925. mov dx,_P_&n
  926. endif
  927. if fn and DIB_RECT_DIB
  928. ;; for a call which specifies a rectangular area in the DIB (SetDIBitsToDevice),
  929. ;; compute the size of the DIB that will actually be validated.
  930. ;;
  931. ;; The cases are:
  932. ;;
  933. ;; (1) If (yS > (nStart + n) : The DIB RECT will be totally clipped. Do not
  934. ;; validate the DIB size in this case.
  935. ;; (2) If (yS + yE) < nStart : The DIB rect will totally be clipped. Do not
  936. ;; validate the DIB size in this case.
  937. ;; (3) Else, compute the min of (yS+yE-nStart) and (n) and use it to validate
  938. ;; the size of the DIB buffer.
  939. mov dx, _P_&yS
  940. mov cx, _P_&nStart
  941. add cx, _P_&n
  942. cmp dx, cx
  943. ja total_clip ;; case (1)
  944. add dx, _P_&yE
  945. cmp dx, _P_&nStart
  946. jb total_clip ;; case (2)
  947. sub dx, _P_&nStart
  948. cmp dx, _P_&n ;; compute min in case (3)
  949. jb @f ;; (yS+yE-nStart) is < n
  950. mov dx, _P_&n ;; validate only n scans
  951. jmp short @f
  952. total_clip:
  953. pop di
  954. pop si ;; will not validate DIB size
  955. jmp short exit
  956. @@:
  957. endif
  958. mov cx, fn
  959. or cx, rBits
  960. call ValidateDIBSize
  961. pop di
  962. pop si
  963. or ax,ax
  964. jz exit
  965. mov bx,ERR_BAD_PTR
  966. lcall Inval_Param_
  967. exit:
  968. endif
  969. endm
  970. ;----------------------------------------------------------------------------;
  971. STRUCT <LOGPALETTE> ;fixed-size portion of struct.
  972. F_VERSION palVersion
  973. F_WORD wEntries
  974. ENDSTRUCT
  975. P_CLPLOGPALETTE macro lp, opts
  976. _GenParm <lp>,4,<opts>
  977. if VLgen
  978. mov ax,_P_&lp
  979. mov cx,_P_&lp+2
  980. mov bx,VLcbsLOGPALETTE
  981. lcall CLP
  982. _gensub LP
  983. les bx,_P_&lp
  984. mov cx,es
  985. mov ax,VLcbsPALETTEENTRY
  986. mul word ptr es:[bx]._F_wEntries ; ax = size of all palette entries
  987. add ax,VLcbsLOGPALETTE ; ax = total size of struct
  988. xchg ax,bx
  989. lcall CLP
  990. _gensub LP
  991. endif
  992. endm
  993. STRUCT DEVMODE ;fixed-size fields
  994. F_RGCH dmDeviceName, CCHDEVICENAME
  995. F_VERSION dmSpecVersion
  996. F_WORD dmDriverVersion ;value assigned by driver developer
  997. F_WSIZE dmSize ;size of DEVMODE struct.
  998. F_WORD dmDriverExtra ;size of dmDriverData field.
  999. F_DWORD dmFields
  1000. F_RVALUE dmOrientation, DMORIENT_PORTRAIT, DMORIENT_LANDSCAPE
  1001. F_RVALUE dmPaperSize, DMPAPER_FIRST, DMPAPER_LAST
  1002. F_short dmPaperLength
  1003. F_short dmPaperWidth
  1004. F_short dmScale
  1005. F_short dmCopies
  1006. F_RVALUE dmDefaultSource, DMBIN_FIRST, DMBIN_LAST
  1007. F_RVALUE dmPrintQuality, DMPRINT_FIRST, DMPRINT_LAST ;** range -4 to -1
  1008. F_RVALUE dmColor, DMCOLOR_FIRST, DMCOLOR_LAST ;** range 1-2
  1009. F_RVALUE dmDuplex, DMDUP_FIRST, DMDUP_LAST ;** range 1-3
  1010. ENDSTRUCT
  1011. P_CLPDEVMODE0 macro lp, opts
  1012. local dmexit
  1013. local dmbad
  1014. local dmbad1
  1015. _GenParm <lp>,4,<opts>
  1016. if VLgen
  1017. mov ax,_P_&lp
  1018. mov cx,_P_&lp+2
  1019. mov bx,ax
  1020. or bx,cx
  1021. jz dmexit ;allow NULL pointer
  1022. mov bx,VLcbsDEVMODE
  1023. lcall CLP ;verify fixed-size fields
  1024. _gensub LP
  1025. les bx,_P_&lp
  1026. mov ax,es:[bx]._F_dmDriverExtra
  1027. or ax,ax
  1028. jz dmexit ;if 0 extra bytes, we're done
  1029. add ax,VLcbsDEVMODE
  1030. xchg ax,bx ;bx=size of DEVMODE+extra bytes
  1031. mov cx,es
  1032. ;; MICROGRAFIX draw uses CreateDC to load one of thier format conversion DLLs.
  1033. ;; The pass in a DevMode structure which is either a private structure, or
  1034. ;; has a bogus value in the _F_dmDriverExtra field. We need to loosen the
  1035. ;; validation and turn an invalid DevMode detection into a warning.
  1036. beg_fault_trap dmbad
  1037. mov es,cx
  1038. or bx,bx ; cb == 0?
  1039. jz dmexit ; yes: just check selector
  1040. dec bx
  1041. add bx,ax
  1042. jc dmbad1 ; check 16 bit overflow
  1043. mov bl,es:[bx] ; check read permission, limit
  1044. end_fault_trap
  1045. jmp short dmexit ; structure is valid
  1046. dmbad:
  1047. fault_fix_stack
  1048. dmbad1:
  1049. mov bx,ERR_BAD_PTR or ERR_WARNING
  1050. lcall Inval_Param_
  1051. dmexit:
  1052. endif
  1053. endm
  1054. ;----------------------------------------------------------------------------;
  1055. ; P A R A M E T E R V A L I D A T I O N R O U T I N E S ;
  1056. ;----------------------------------------------------------------------------;
  1057. ; DIB validation flag constants. Do not change these constants without
  1058. ; changing them in GDI.API.
  1059. DIB_RGB_COLORS equ 0
  1060. DIB_VALIDATE_COLOR equ 1
  1061. DIB_VALIDATE_RW equ 2
  1062. DIB_PTR0 equ 4
  1063. DIB_FULL_DIB equ 8
  1064. DIB_FULL_COLOR equ 16
  1065. DIB_RECT_DIB equ 32
  1066. DIB_PART_DIB equ 64
  1067. ; derived DIB flag constants
  1068. DIB_PTR_CLP equ 0
  1069. DIB_NO_COLOR equ 0
  1070. DIB_PTR_LP equ DIB_VALIDATE_RW
  1071. DIB_PTR_CLP0 equ DIB_PTR0
  1072. DIB_PTR_LP0 equ DIB_VALIDATE_RW+DIB_PTR0
  1073. ERR_BAD_PTR equ 07007h
  1074. DIB_DIBTODEV equ DIB_PART_DIB+DIB_RECT_DIB
  1075. DIB_PTR_GETDIBITS equ DIB_VALIDATE_RW+DIB_FULL_COLOR
  1076. NO_COLOR_TABLE equ 9
  1077. BITMAP struc
  1078. bmType DW ?
  1079. bmWidth DW ?
  1080. bmHeight DW ?
  1081. bmWidthBytes DW ?
  1082. bmPlanes DB ?
  1083. bmBitsPixel DB ?
  1084. bmBits DD ?
  1085. BITMAP ends
  1086. RGBTRIPLE struc
  1087. rgbBlue db ?
  1088. rgbGreen db ?
  1089. rgbRed db ?
  1090. RGBTRIPLE ends
  1091. RGBQUAD struc
  1092. rgbqBlue db ?
  1093. rgbqGreen db ?
  1094. rgbqRed db ?
  1095. rgbqReserved db ?
  1096. RGBQUAD ends
  1097. ; structures for defining DIBs
  1098. BITMAPCOREHEADER struc
  1099. bcSize dd ?
  1100. bcWidth dw ?
  1101. bcHeight dw ?
  1102. bcPlanes dw ?
  1103. bcBitCount dw ?
  1104. BITMAPCOREHEADER ends
  1105. BITMAPINFOHEADER struc
  1106. biSize dd ?
  1107. biWidth dd ?
  1108. biHeight dd ?
  1109. biPlanes dw ?
  1110. biBitCount dw ?
  1111. biCompression dd ?
  1112. biSizeImage dd ?
  1113. biXPelsPerMeter dd ?
  1114. biYPelsPerMeter dd ?
  1115. biClrUsed dd ?
  1116. biClrImportant dd ?
  1117. BITMAPINFOHEADER ends
  1118. BITMAPINFO struc
  1119. bmiHeader db (SIZE BITMAPINFOHEADER) DUP (?)
  1120. bmiColors db ? ; array of RGBQUADs
  1121. BITMAPINFO ends
  1122. BITMAPCOREINFO struc
  1123. bmciHeader db (SIZE BITMAPCOREHEADER) DUP (?)
  1124. bmciColors db ? ; array of RGBTRIPLEs
  1125. BITMAPCOREINFO ends
  1126. BITMAPFILEHEADER struc
  1127. bfType dw ?
  1128. bfSize dd ?
  1129. bfReserved1 dw ?
  1130. bfReserved2 dw ?
  1131. bfOffBits dd ?
  1132. BITMAPFILEHEADER ends
  1133. externFP IsBadReadPtr ;(KERNEL)
  1134. externFP IsBadWritePtr ;(KERNEL)
  1135. externFP IsBadHugeReadPtr ;(KERNEL)
  1136. externFP IsBadHugeWritePtr ;(KERNEL)
  1137. ;createseg _TEXT,TEXT,BYTE,PUBLIC,CODE
  1138. createseg _TEXT,TEXT,WORD,PUBLIC,CODE
  1139. sBegin TEXT
  1140. ;----------------------------------------------------------------------------;
  1141. ; ValidateDIBHeader: ;
  1142. ; ;
  1143. ; This routine validates the DIB header: ;
  1144. ; ;
  1145. ; Entry: ;
  1146. ; CX:AX -- pointer to DIB header (either core or info header) ;
  1147. ; DX: -- wUsage parameter ;
  1148. ; DI: -- Flags: ;
  1149. ; BIT0 - (DIB_VALIDATE_COLOR) set if no color table validatio ;
  1150. ; to be done. ;
  1151. ; BIT1 - (DIB_VALIDATE_RW) set if R-W validation to be done. ;
  1152. ; BIT2 _ (DIB_PTR0) set if NULL pointer OK ;
  1153. ; BIT3 _ (DIB_FULL_DIB) set if complete DIB (not used here);
  1154. ; BIT4 - (DIB_FULL_COLOR) ignore biClrUsed if set. ;
  1155. ; Returns: ;
  1156. ; AX = 0 if valid header. ;
  1157. ; DI:SI: will point just past the end of the buffer. ;
  1158. ; ;
  1159. ; Uses: ;
  1160. ; Free to use AX,BX,CX,DX,SI,DI and ES. ;
  1161. ; ;
  1162. ;----------------------------------------------------------------------------;
  1163. public ValidateDIBHeader
  1164. ValidateDIBHeader proc near
  1165. ; the header must atleast be the size of COREHEADER.
  1166. mov bx,SIZE BitmapCoreHeader
  1167. push cx
  1168. push ax ;save the pointer to header
  1169. call DIB_Validate_Pointer ;is it a valid pointer ?
  1170. or ax,ax
  1171. pop ax
  1172. pop cx ;restore pointer
  1173. jz VDH_cont ;base size ok
  1174. jmp VDH_bad_header ;invalid size
  1175. VDH_cont:
  1176. ; now it is safe to load the pointer to the header and validate the actual
  1177. ; size.
  1178. mov es,cx
  1179. mov bx,ax ;es:bx -> dib header
  1180. mov si,word ptr es:[bx].biSize ;load and keep the size
  1181. mov cx, SIZE RGBTriple ;assume COREHEADER.
  1182. cmp si,SIZE BitmapCoreHeader ;COREHEADER ?
  1183. jz VDH_core ;it is a core header
  1184. mov cx, SIZE RGBQuad ;assume INFOHEADER
  1185. cmp si, SIZE BitmapInfoHeader ;is it an info header ?
  1186. jnz VDH_bad_header ;header is not right.
  1187. ; we have a new header. Make sure that some of the fields that the code
  1188. ; expects to be 0 are 0.
  1189. cmp word ptr es:[bx].biWidth+2,0
  1190. jne VDH_bad_header ;invalid
  1191. mov ax,word ptr es:[bx].biHeight+2
  1192. test ax,ax ;is it a negative number ?
  1193. js VDH_get_bit_count ;yes, must be a top-down dib.
  1194. jnz VDH_bad_header ;it it is not signed, it should be 0.
  1195. VDH_get_bit_count:
  1196. cmp es:[bx].biPlanes,1
  1197. jne VDH_bad_header ;no.
  1198. mov ax,es:[bx].biBitCount ;load the bits per pel
  1199. jmp short VDH_check_color ;validate color
  1200. VDH_core:
  1201. cmp es:[bx].bcPlanes,1
  1202. jne VDH_bad_header ;no.
  1203. mov ax,es:[bx].bcBitCount ;load the bits per pel
  1204. VDH_check_color:
  1205. ; if the bits per pel is >= NO_COLOR_TABLE, we do not have a color table in
  1206. ; the DIB.
  1207. cmp ax,NO_COLOR_TABLE
  1208. jae VDH_no_color_table
  1209. ; if color table validation is not needed, we can return if the header is
  1210. ; a core header (we have validated size) or validate the size of the
  1211. ; basic header and return.
  1212. test di, DIB_VALIDATE_COLOR ;color validation needed ?
  1213. jnz VDH_validate_color ;yes.
  1214. VDH_no_color_table:
  1215. ; color table validation is not needed. We are done if this is a core header.
  1216. cmp si, SIZE BitmapCoreHeader ;core header ?
  1217. jz VDH_return_OK ;is, validation done. valid.
  1218. mov ax,bx ;get offset
  1219. mov bx,si ;get base header size
  1220. jmp short VDH_validate_size ;validate the total size
  1221. VDH_bad_header:
  1222. mov ax,1 ;return from here with error
  1223. jmp short VDH_return ;error return
  1224. VDH_validate_color:
  1225. cmp dx,DIB_RGB_COLORS ;is the usage RGB values
  1226. jz VDH_color_entry_size_in_cx ;cx has size of each entry
  1227. mov cx,2 ;size per entry for palettes
  1228. VDH_color_entry_size_in_cx:
  1229. mov dx,ax ;get the bit count in dx
  1230. ; if DIB_FULL_COLOR bit is set, we will ignore the value if biClrUsed.
  1231. test di,DIB_FULL_COLOR ;validate complete color table ?
  1232. jnz VDH_get_num_colors ;yes.
  1233. ; check out the biClrUsed value.
  1234. cmp si, SIZE BitmapInfoHeader ;is this an info header ?
  1235. jnz VDH_get_num_colors ;no.
  1236. mov ax,word ptr es:[bx].biClrUsed ;is this specified ?
  1237. or ax,ax
  1238. jnz VDH_num_colors_got ;yes. ax has num colors
  1239. VDH_get_num_colors:
  1240. xchg dx,cx
  1241. mov ax,1
  1242. shl ax,cl ;number of color entries in ax
  1243. xchg dx,cx
  1244. VDH_num_colors_got:
  1245. mul cx ;cx had size of each entry
  1246. add ax,si ;add size of header
  1247. xchg ax,bx ;size in bx, offset in ax
  1248. VDH_validate_size:
  1249. mov cx,es ;cx:ax has ptr, bx has size
  1250. ; store the pointer past the header in DI:SI
  1251. mov di,cx
  1252. mov si,ax
  1253. add si,bx ;past the end. Assume no wrap
  1254. call DIB_Validate_Pointer ;validate pointer
  1255. jmp short VDH_return ;ax has status
  1256. VDH_return_OK:
  1257. xor ax,ax ;valid return
  1258. VDH_return:
  1259. ret
  1260. ValidateDIBHeader endp
  1261. ;----------------------------------------------------------------------------;
  1262. ; ValidateDIBSize: ;
  1263. ; ;
  1264. ; Validates the size of the DIB bits. ;
  1265. ; ;
  1266. ; Entry: ;
  1267. ; DI:SI -- pointer to DIB bits (either core or info header) ;
  1268. ; ES:BX -- pointer to DIB header (already validated) ;
  1269. ; DX: -- num scans. ;
  1270. ; CX: -- Flags: ;
  1271. ; BIT1 - (DIB_VALIDATE_RW) set if R-W validation to be done. ;
  1272. ; BIT2 _ (DIB_PTR0) set if NULL pointer OK ;
  1273. ; BIT3 - (DIB_FULL_DIB) set if full DIB bit size to be ;
  1274. ; validated. ;
  1275. ; Returns: ;
  1276. ; AX = 0 if valid header. ;
  1277. ; ;
  1278. ; Uses: ;
  1279. ; Free to use AX,BX,CX,DX,SI,DI and ES. ;
  1280. ; ;
  1281. ; Assumes: ;
  1282. ; Caller has done a PUSH SI/PUSH DI on the frame. ;
  1283. ;----------------------------------------------------------------------------;
  1284. public ValidateDIBSize
  1285. ValidateDIBSize proc near
  1286. push cx ;save
  1287. cmp word ptr es:[bx].biSize, SIZE BitmapInfoHeader
  1288. jz VDB_info ;info header
  1289. mov cx,es:[bx].bcBitCount ;get the bit count
  1290. mov ax,es:[bx].bcWidth ;and width in pels
  1291. jmp short VDB_get_scan_size ;calculate scan size
  1292. VDB_info:
  1293. cmp word ptr es:[bx].biCompression+2,0
  1294. jnz VDB_check_size_image
  1295. cmp word ptr es:[bx].biCompression, BI_RGB
  1296. jz VDB_not_rle ;not an RLE DIB
  1297. VDB_check_size_image:
  1298. mov ax,word ptr es:[bx].biSizeImage
  1299. mov cx,ax
  1300. or cx,word ptr es:[bx].biSizeImage+2
  1301. jz VDB_unknown_size ;unknown size
  1302. pop cx ;restore saved cx
  1303. mov dx,word ptr es:[bx].biSizeImage+2
  1304. jmp short VDB_validate_size ;size is in dx:ax
  1305. VDB_unknown_size:
  1306. mov ax,1 ;validate for 1byte
  1307. cwd
  1308. pop cx ;restore flags
  1309. jmp short VDB_validate_size
  1310. VDB_not_rle:
  1311. ; calculate the size of the scan. Assume that the width is a word
  1312. mov cx,es:[bx].biBitCount
  1313. mov ax,word ptr es:[bx].biWidth
  1314. VDB_get_scan_size:
  1315. push dx ;save
  1316. mul cx ;dx:ax = num of bits
  1317. add ax,31
  1318. adc dx,0
  1319. and ax, NOT 31 ;round up to multiple of 32
  1320. ror dx,3 ;get ls 3 bits into upper byte
  1321. and dh,0e0h ;keep the ms 3 bits
  1322. shr ax,3 ;ignore ls 3 bits
  1323. or ah,dh ;ax = num bytes per scan
  1324. pop dx
  1325. VDB_scan_width_in_ax:
  1326. pop cx ;restore flags
  1327. xchg cx,dx ;get flags into dx, scan in cx
  1328. push di ;save
  1329. mov di,word ptr es:[bx].bcHeight ;assume core header
  1330. cmp word ptr es:[bx].biSize, SIZE BitmapCoreHeader
  1331. jz VDB_total_scans_in_di ;di has total height of DIB
  1332. mov di,word ptr es:[bx].biHeight ;get low word of height
  1333. VDB_total_scans_in_di:
  1334. mov bx,di ;get total height in BX
  1335. pop di ;restore
  1336. test dx,DIB_FULL_DIB ;is full DIB to be validated ?
  1337. jnz VDB_num_scans_in_bx ;yes, bx has num scans.
  1338. ; when we are validating partial DIBs, we want to make sure that the
  1339. ; numScan parameter passed in (now in cx) is not greater than the total
  1340. ; height. If it is, we will simply validate for the full DIB.
  1341. cmp cx,bx ;is numScan > total scans ?
  1342. ja VDB_num_scans_in_bx ;yes, invalid numScans. Use total scans
  1343. mov bx,cx ;use numScans
  1344. VDB_num_scans_in_bx:
  1345. push dx ;save flags
  1346. mul bx ;dx:ax has size
  1347. pop cx ;get the flags in cx
  1348. VDB_validate_size:
  1349. ; dx:ax has size of the buffer. di:si is the ptr, cx has flags.
  1350. call DIB_Validate_Huge_Pointer
  1351. ret
  1352. ValidateDIBSize endp
  1353. ;----------------------------------------------------------------------------;
  1354. ; DIB_Validate_Pointer: ;
  1355. ; ;
  1356. ; Validates the size and access of a pointer. ;
  1357. ; ;
  1358. ; Entry: ;
  1359. ; CX:AX -- pointer to be validate ;
  1360. ; BX: -- size of buffer ;
  1361. ; DI: -- flags: ;
  1362. ; BIT1 - (DIB_VALIDATE_RW) set if R-W validation to be done. ;
  1363. ; BIT2 _ (DIB_PTR0) set if NULL pointer OK ;
  1364. ; ;
  1365. ; Uses: None ;
  1366. ; returns AX = 0 if valid. ;
  1367. ; ;
  1368. ;----------------------------------------------------------------------------;
  1369. public DIB_Validate_Pointer
  1370. DIB_Validate_Pointer proc near
  1371. test di,DIB_PTR0 ;NULL pointer allowed ?
  1372. jz DBP_not_null ;no.
  1373. push ax ;save
  1374. or ax,cx ;is the pointer NULL ?
  1375. pop ax ;restore
  1376. jz DBP_return_ok ;pointer is NULL and is valid
  1377. DBP_not_null:
  1378. push cx
  1379. push ax
  1380. push bx
  1381. test di, DIB_VALIDATE_RW ;read/write validation ?
  1382. jnz DBP_rw_validation ;yes.
  1383. ; do read only validation:
  1384. call IsBadReadPtr
  1385. jmp short DBP_return
  1386. DBP_rw_validation:
  1387. call IsBadWritePtr
  1388. jmp short DBP_return
  1389. DBP_return_ok:
  1390. xor ax,ax ;valid pointer
  1391. DBP_return:
  1392. ret
  1393. DIB_Validate_Pointer endp
  1394. ;----------------------------------------------------------------------------;
  1395. ; DIB_Validate_Huge_Pointer: ;
  1396. ; ;
  1397. ; Validates the size and access of a pointer. ;
  1398. ; ;
  1399. ; Entry: ;
  1400. ; DI:SI -- pointer to be validate ;
  1401. ; DX:AX -- size of buffer ;
  1402. ; CX: -- flags: ;
  1403. ; BIT1 - (DIB_VALIDATE_RW) set if R-W validation to be done. ;
  1404. ; BIT2 _ (DIB_PTR0) set if NULL pointer OK ;
  1405. ; ;
  1406. ; Uses: None ;
  1407. ; returns AX = 0 if valid. ;
  1408. ; ;
  1409. ;----------------------------------------------------------------------------;
  1410. public DIB_Validate_Huge_Pointer
  1411. DIB_Validate_Huge_Pointer proc near
  1412. test cx,DIB_PTR0 ;NULL pointer allowed ?
  1413. jz DBPH_not_null ;no.
  1414. push si ;save
  1415. or si,di ;is the pointer NULL ?
  1416. pop si ;restore
  1417. jz DBPH_return_ok ;pointer is NULL and is valid
  1418. DBPH_not_null:
  1419. push di
  1420. push si ;ds:si is pointer to bits
  1421. push dx
  1422. push ax ;dx:ax is the dword size
  1423. test cx, DIB_VALIDATE_RW ;read/write validation ?
  1424. jnz DBPH_rw_validation ;yes.
  1425. ; do read only validation:
  1426. call IsBadHugeReadPtr
  1427. jmp short DBPH_return
  1428. DBPH_rw_validation:
  1429. call IsBadHugeWritePtr
  1430. jmp short DBPH_return
  1431. DBPH_return_ok:
  1432. xor ax,ax ;valid pointer
  1433. DBPH_return:
  1434. ret
  1435. DIB_Validate_Huge_Pointer endp
  1436. sEnd TEXT
  1437. ;=======================================================================
  1438. ;
  1439. ; API Descriptions
  1440. ;
  1441. ; in PALETTE.ASM
  1442. API void, AnimatePalette, TEXT, <ASM>
  1443. P_HPALETTE hPal ; validated by VALID? (3.0 and 3.1)
  1444. P_WORD wStartIndex
  1445. P_CLPPALENTRYBUFFER nEntries,lpPalColors ; **
  1446. ; in PALETTE.ASM
  1447. API HPALETTE, CreatePalette, TEXT, <ASM>
  1448. P_CLPLOGPALETTE lpLogPal ;**
  1449. ; in PALETTE.ASM
  1450. API WORD, GetPaletteEntries, TEXT, <ASM>
  1451. P_HPALETTE hPalette ;validated by VALID? (3.0 and 3.1)
  1452. P_WORD wStartIndex
  1453. P_LPPALENTRYBUFFER wEntries, lpPalColors ; buffer filled in DEBUG Win 3.1
  1454. ; in PALETTE.ASM
  1455. API WORD, GetNearestPaletteIndex, TEXT, <ASM>
  1456. P_HPALETTE hPalette ;validated by VALID? (3.0 and 3.1)
  1457. P_DWORD color
  1458. ; in PALETTE.ASM
  1459. API WORD, GetSystemPaletteEntries, TEXT, <ASM>
  1460. P_HDC hdc ;validated by VALID? (3.0 and 3.1)
  1461. P_WORD wStartIndex
  1462. P_LPPALENTRYBUFFER wEntries,lpPalColors ;buffer filled in DEBUG Win 3.1
  1463. ; in PALETTE.ASM
  1464. API WORD, GetSystemPaletteUse, TEXT, <ASM>
  1465. P_HDC hdc ;validated by VALID? (3.0 and 3.1)
  1466. ; in PALETTE.ASM
  1467. API BOOL, ResizePalette, TEXT, <ASM>
  1468. P_HPALETTE hPalette ;validated by VALID? (3.0 and 3.1)
  1469. P_WORD nNumEntries
  1470. ; in PALETTE.ASM
  1471. API WORD, SetPaletteEntries, TEXT, <ASM>
  1472. P_HPALETTE hPalette ;validated by VALID? (3.0 and 3.1)
  1473. P_WORD wStartIndex
  1474. P_CLPPALENTRYBUFFER wEntries, lpPalColors
  1475. ; in PALETTE.ASM
  1476. API WORD, SetSystemPaletteUse, TEXT, <ASM>
  1477. P_HDC hdc ;validated by VALID? (3.0 and 3.1)
  1478. P_WORD wUsage
  1479. ; in PALETTE.ASM
  1480. API int, UpdateColors, TEXT, <ASM>
  1481. P_HDCMETA hdc ;validated by VALID? (3.0 and 3.1)
  1482. ; in PRNTCTL.C (new for Win 3.1)
  1483. API int, AbortDoc, TEXT
  1484. P_HDCMETA hdc ; validated by Valid()
  1485. APIERR
  1486. mov ax, SP_ERROR ;General escape error
  1487. APIEND
  1488. ; in PRNTCTL.C (New for Win 3.1)
  1489. API int, EndPage, TEXT
  1490. P_HDCMETA hdc ; Checked by Valid(). Encapsulates ENDPAGE escape
  1491. APIERR
  1492. mov ax, SP_ERROR ;General escape error
  1493. APIEND
  1494. ; in PRNTCTL.C (New for Win 3.1)
  1495. API int, EndDoc, TEXT
  1496. P_HDCMETA hdc ; Checked by Valid(). Encapsulates NEWFRAME escape
  1497. APIERR
  1498. mov ax, SP_ERROR ;General escape error
  1499. APIEND
  1500. STRUCT <DOCINFO>
  1501. F_int cbSize
  1502. F_CLPSTR lpszDocName
  1503. F_CLPSTR0 lpszOutput
  1504. ENDSTRUCT
  1505. _GenLP <P_CLPDOCINFO>,<CLP>,%VLcbsDOCINFO
  1506. ; in PRNTCTL.C (new for 3.1)
  1507. API int, StartDoc, TEXT
  1508. P_HDCMETA hdc ;checked by Valid()
  1509. P_CLPDOCINFO lpDocInfo
  1510. APIERR
  1511. mov ax, SP_ERROR ;General escape error
  1512. APIEND
  1513. ; in PRNTCTL.C (new for 3.1)
  1514. API int, StartPage, TEXT
  1515. P_HDCMETA hdc ;checked by Valid(). Null error return
  1516. ; in PRNTCTL.C (new for 3.1)
  1517. API int, SetAbortProc, TEXT
  1518. P_HDCMETA hdc
  1519. P_LPFNABORT0 lpProc ;**
  1520. APIERR
  1521. mov ax, SP_ERROR ;General escape error
  1522. APIEND
  1523. ; in DCMAN1.ASM
  1524. API HDC, CreateCompatibleDC, TEXT, <ASM>
  1525. P_HDC0 hdc ; 0 => use screen DC
  1526. ; in DCMAN1.ASM
  1527. API HDC, CreateIC ,TEXT, <ASM,FUNNYFRAME,NODATA> ;nogen
  1528. P_CLPSTR lpDriverName
  1529. P_CLPSTR0 lpDeviceName
  1530. P_CLPSTR0 lpOutput
  1531. P_DWORD lpInitData ; Driver-dependent data or NULL
  1532. APIEND
  1533. ; in DCMAN1.ASM
  1534. API HDC, CreateDC, TEXT, <ASM,FUNNYFRAME,NODATA> ;nogen
  1535. ;
  1536. ; START of special ATM hackery.
  1537. ;
  1538. jmp short SkipATMHackery
  1539. ;
  1540. ; Addresses of certain kernel functions patched by ATM loader.
  1541. ;
  1542. ;ATM_LPFN CreateDC_lpfn, LoadLibrary
  1543. ;ATM_LPFN CreateDC_lpfn, GetProcAddress
  1544. ;ATM_LPFN CreateDC_lpfn, FreeLibrary
  1545. ;
  1546. ; InternalCreateDC() hook that gets patched by ATM
  1547. ;
  1548. ;public ATMInternalCreateDC
  1549. ;ATMInternalCreateDC:
  1550. ;
  1551. ; Old Windows prolog code that will be properly
  1552. ; recognized by the ATM installation code...
  1553. ;
  1554. ; mov ax,_DATA
  1555. ; inc bp
  1556. ; push bp
  1557. ; mov bp,sp
  1558. ; push ds ; push ds and pop it off.
  1559. ; pop ds ; (we need to pop DS rather than
  1560. ; ; something fast like pop AX because
  1561. ; ; ATM doesn't preserve DS itself)
  1562. ; pop bp ; Take down the frame completely.
  1563. ; dec bp
  1564. ;ExternNP InternalCreateDC ; (in dcman1.asm)
  1565. ; jmp InternalCreateDC ; now go to the real code
  1566. SkipATMHackery:
  1567. ;
  1568. ; END of special ATM hackery
  1569. ;
  1570. P_CLPSTR lpDriverName
  1571. P_CLPSTR0 lpDeviceName ; can be NULL if lpDriverName is "DISPLAY"
  1572. P_CLPSTR0 lpOutput ; can be NULL if lpDriverName is "DISPLAY"
  1573. P_CLPDEVMODE0 lpInitData ; ** points to DEVMODE struct.
  1574. ; in DCMAN2.ASM
  1575. API BOOL, DeleteDC, TEXT, <ASM,ATMFRAMEDS>
  1576. P_HDC hdc ; Validated by VALIDDEBUG? (3.1), VALID? (3.0)
  1577. APIEND
  1578. ATM_LPFN DeleteDC_lpfn, FreeLibrary
  1579. ; in DCMAN2.ASM
  1580. API BOOL, RestoreDC, TEXT, <ASM>
  1581. P_HDCMETA hdc
  1582. P_int level ;number of DC on context stack or -1
  1583. ; in DCMAN2.ASM
  1584. API int, SaveDC, TEXT, <ASM>
  1585. P_HDCMETA hdc ; validated by VALID? (3.0 and 3.1)
  1586. ; in RESETDC.C
  1587. API BOOL, RESETDC, TEXT
  1588. P_HDC hdc
  1589. P_CLPDEVMODE0 lpInitData ; ** points to DEVMODE struct.
  1590. ; in OBJDEL.ASM
  1591. API BOOL, DeleteObject, TEXT, <ASM>
  1592. P_HGDIOBJ hObject ; ** Validated by VALID? (3.0 and 3.1)
  1593. ; object shouldn't be selected into a DC
  1594. ; Pens, brushes, fonts, bitmaps &
  1595. ; palettes and regions.
  1596. ; in OBJMAN.ASM
  1597. API HPEN, CreatePen, TEXT, <ASM>
  1598. P_VALUE style, PS_MAX ; ** range 0-6
  1599. P_int cx
  1600. P_COLORREF color ; ** DWORD
  1601. ; in OBJMAN.ASM
  1602. API HPEN, CreatePenIndirect, TEXT, <ASM>
  1603. P_CLPLOGPEN lpLogPen ; **
  1604. ; in OBJMAN.ASM
  1605. API HBRUSH, CreateSolidBrush, TEXT, <ASM, NOGEN>
  1606. P_COLORREF color
  1607. ; in OBJMAN.ASM
  1608. API HBRUSH, CreateHatchBrush, TEXT, <ASM>
  1609. P_VALUE nIndex, HS_MAX ; ** range 0-5
  1610. P_COLORREF color ;
  1611. ; in OBJMAN.ASM
  1612. API HBRUSH, CreatePatternBrush, TEXT, <ASM>
  1613. P_HBITMAP hBitmap ;
  1614. ; in OBJMAN.ASM
  1615. API HBRUSH, CreateBrushIndirect, TEXT, <ASM>
  1616. P_CLPLOGBRUSH lpLogBrush ; **
  1617. ; in OBJMAN.ASM
  1618. API HBITMAP, CreateBitmap, TEXT, <ASM> ;<FUNNYFRAME> in 3.0
  1619. P_CLPBITBUFFER0 cx, cy, bPlanes, bBitC, lpBits ; ** buffer size
  1620. ;determined by bitmap attributes
  1621. ;cx and cy are int. values
  1622. ;bPlanes and bBitC are BYTE values
  1623. ; in OBJMAN.ASM
  1624. API HBITMAP, CreateBitmapIndirect, TEXT, <ASM> ;<FUNNYFRAME> in 3.0
  1625. P_CLPBITMAP lpBitmap ; **
  1626. ; in OBJMAN.ASM
  1627. API HBITMAP, CreateCompatibleBitmap, TEXT, <ASM, FUNNYFRAME,NODATA> ;nogen
  1628. P_HDC hdc ; validated by VALID? (3.0 and 3.1) in CompatibleBitmap
  1629. P_int cx
  1630. P_int cy
  1631. ; in OBJMAN.ASM
  1632. API HBITMAP, CreateDiscardableBitmap, TEXT, <ASM,FUNNYFRAME,NODATA> ;nogen
  1633. P_HDC hdc ; validated by VALID? (3.0 and 3.1) in CompatibleBitmap
  1634. P_int cx
  1635. P_int cy
  1636. ; in OBJMAN.ASM
  1637. API HFONT, CreateFont, TEXT, <ASM>
  1638. P_int cy
  1639. P_int cx
  1640. P_int nEscapement
  1641. P_int nOrientation
  1642. P_VALUE nWeight, FW_MAX ;** range 0-1000
  1643. P_BYTE cItalic
  1644. P_BYTE cUnderline
  1645. P_BYTE cStrikeOut
  1646. P_BYTE cCharSet
  1647. P_BVALUE cOutPrecis, OUT_MAX ;** range 0-3
  1648. P_BVALUE cClipPrecis, CLIP_MAX ;** range 0-2
  1649. P_BVALUE cQuality, QUALITY_MAX ;** range 0-2
  1650. P_PITCHFAMILY cPitchAndFamily ;** BYTE. Flags in upper and lower nibbles
  1651. P_CLPFACENAME0 lpFaceName ;** null-terminated string length
  1652. ;not > LF_FACESIZE
  1653. ; in OBJMAN.ASM
  1654. API HFONT, CreateFontIndirect, TEXT, <ASM>
  1655. P_CLPLOGFONT lpLogFont ;**
  1656. ; in OBJMAN.ASM
  1657. API HBRUSH, CreateDIBPatternBrush, TEXT, <ASM>
  1658. P_GHPACKEDDIB hPackedDIB, wUsage
  1659. ; in OBJMAN.ASM
  1660. API DWORD, SetBitmapDimension, TEXT, <ASM>
  1661. P_HBITMAP hBitmap ; validated by VALID? (3.0 and 3.1)
  1662. P_int x
  1663. P_int y
  1664. ; in FONTASC.ASM
  1665. ifdef DBCS
  1666. API int, GetFontAssocStatus, TEXT, <ASM>
  1667. P_HDCMETA hdc ; validated by VALID?
  1668. endif ;DBCS
  1669. ; in WIN32.C
  1670. API BOOL, SetBitmapDimensionEx, TEXT
  1671. P_HBITMAP hBitmap
  1672. P_int x
  1673. P_int y
  1674. P_LPSIZE0 lpSize
  1675. ; in OBJMAN.ASM
  1676. API DWORD, GetBitmapDimension, TEXT, <ASM>
  1677. P_HBITMAP hBitmap ;validated by VALID? (3.0 and 3.1)
  1678. ; in WIN32.C
  1679. API BOOL, GetBitmapDimensionEx, TEXT
  1680. P_HBITMAP hBitmap
  1681. P_LPSIZE lpDimension
  1682. ; in OBJMAN.ASM
  1683. API int, SetTextJustification, TEXT, <ASM>
  1684. P_HDCMETA hdc ;validated by VALID? (3.0 and 3.1)
  1685. P_int nBreakExtra
  1686. P_int nBreakCount
  1687. ; in OBJMAN.ASM
  1688. API int, SetTextCharacterExtra, TEXT, <ASM>
  1689. P_HDCMETA hdc ;validated by VALID? (3.0 and 3.1)
  1690. P_int nCharExtra
  1691. ; in METAREC.C
  1692. API GHANDLE, CopyMetaFile, TEXT
  1693. P_GHANDLE hMeta ;checked by IsValidMetaFile()
  1694. P_CLPSTR0 lpFileName ;0 => use memory metafile
  1695. ; in METAREC.C
  1696. API HDC, CreateMetaFile, TEXT
  1697. P_CLPSTR0 lpFileName ;0 => return memory metafile DC
  1698. ; in METAREC.C
  1699. API GHANDLE, CloseMetaFile, TEXT
  1700. P_HDCMETA hdc
  1701. ; in METAPLAY.ASM
  1702. API BOOL, DeleteMetaFile, TEXT, <ASM,FUNNYFRAME> ; is NODATA
  1703. P_HMETAFILE hMF
  1704. ; in METAPLAY.ASM
  1705. API BOOL, PlayMetaFile, TEXT, <ASM, ATMFRAMEDS>
  1706. P_HDCMETA hdc ;validated by Valid() (3.1 only)
  1707. P_HMETAFILE hMF
  1708. ; in METAPLAY.ASM
  1709. API GHANDLE, GetMetaFile, TEXT, <ASM>
  1710. P_CLPSTR lpFileName
  1711. ; in META.C
  1712. API void, PlayMetaFileRecord, TEXT
  1713. P_HDCMETA hdc ;validated by Valid() (3.1 only)
  1714. P_LPHANDLETABLE0 lpHT
  1715. P_CLPMETARECORD lpMR
  1716. P_WORD nhandles
  1717. ; in META.C
  1718. API BOOL, EnumMetaFile, TEXT
  1719. P_HDCMETA0 hdc ; NULL DC is OK. Checked by Valid() (3.0 and 3.1)
  1720. P_HMETAFILE hMF
  1721. P_LPFNMENUM lpfnEnum ; **
  1722. P_DWORD lpClientData ; CLPVOID0 ?, but often just contains data
  1723. ; in METAREC.C
  1724. API GHANDLE, GetMetaFileBits, TEXT
  1725. P_HMETAFILE hMF
  1726. ; in METAREC.C
  1727. API HANDLE, SetMetaFileBits, TEXT
  1728. P_HMETAFILE hMem ; just returns hMem
  1729. ; in METAREC.C
  1730. API HANDLE, SetMetaFileBitsBetter, TEXT
  1731. P_HMETAFILE hMem ; just returns hMem, new for 3.1
  1732. ; in XLATE.ASM
  1733. API BOOL, DPtoLP, TEXT, <ASM, FUNNYFRAME,NODATA> ;nogen
  1734. P_HDC hdc ;validated by VALID? (3.0 and 3.1) by DPXlate
  1735. P_LPPOINTBUFFER lpPoints, nCount ;**
  1736. ; in XLATE.ASM
  1737. API BOOL, LPtoDP, TEXT, <ASM, FUNNYFRAME,NODATA> ;nogen
  1738. P_HDC hdc ;validated by VALID? (3.0 and 3.1) in DPXlate
  1739. P_LPPOINTBUFFER lpPoints, nCount
  1740. ; in ARC.ASM
  1741. API HRGN, CreateEllipticRgnIndirect, TEXT, <ASM>
  1742. P_CLPRECT lpRect
  1743. ; in ARC.ASM
  1744. API HRGN, CreateEllipticRgn, TEXT, <ASM, NOGEN>
  1745. P_XY1XY2 x1,y1,x2,y2 ;X2-X1 and Y2-Y1 under 32,767 units
  1746. ; in ARC.ASM
  1747. API HRGN, CreatePolygonRgn, TEXT, <ASM>
  1748. P_CLPPOINTBUFFER lpPoints, nCount ;**
  1749. P_RVALUE nPolyFillMode, PFILL_MIN, PFILL_MAX ;** range 1-2
  1750. ; in ARC.ASM
  1751. API HRGN, CreatePolyPolygonRgn, TEXT, <ASM>
  1752. P_POLYPOLYPOINTS lpPoints, lpPolyCounts, nCount ;**lpPolyCounts is a buffer
  1753. ;of nCount Integers. lpPoints
  1754. ;is a buffer of POINTS. Size of
  1755. ;lpPoints det. by sum of all
  1756. ;integers in lpPolyCounts
  1757. P_RVALUE nPolyFillMode, PFILL_MIN, PFILL_MAX ;** range 1-2
  1758. ; in ARC.ASM
  1759. API HRGN, CreateRoundRectRgn, TEXT, <ASM, NOGEN>
  1760. P_XY1XY2 x1,y1,x2,y2 ;X2-X1 and Y2-Y1 under 32,767 units
  1761. P_int x3
  1762. P_int y3
  1763. ; in ARC.ASM
  1764. API BOOL, Ellipse, TEXT, <ASM>
  1765. P_HDCNOIC hdc ;validated by VALID? (3.0 and 3.1)
  1766. P_XY1XY2 x1,y1,x2,y2
  1767. ; in ARC.ASM
  1768. API BOOL, Arc, TEXT, <ASM>
  1769. P_HDCNOIC hdc ; validated by VALID? (3.0 and 3.1)
  1770. P_XY1XY2 x1,y1,x2,y2
  1771. P_int x3
  1772. P_int y3
  1773. P_int x4
  1774. P_int y4
  1775. ; in ARC.ASM
  1776. API BOOL, Pie, TEXT, <ASM>
  1777. P_HDCNOIC hdc ;validated by VALID? (3.0 and 3.1)
  1778. P_XY1XY2 x1,y1,x2,y2
  1779. P_int x3
  1780. P_int y3
  1781. P_int x4
  1782. P_int y4
  1783. ; in ARC.ASM
  1784. API BOOL, Chord, TEXT, <ASM>
  1785. P_HDCNOIC hdc ; validated by VALID? (3.0 and 3.1)
  1786. P_XY1XY2 x1,y1,x2,y2 ; ** X2-X1 and Y2-Y1 under 32,767 units
  1787. P_int x3
  1788. P_int y3
  1789. P_int x4
  1790. P_int y4
  1791. ; in ARC.ASM
  1792. API BOOL, RoundRect, TEXT, <ASM>
  1793. P_HDCNOIC hdc ;validated by VALID? (3.0 and 3.1)
  1794. P_XY1XY2 x1,y1,x2,y2
  1795. P_int x3
  1796. P_int y3
  1797. ; in RECT.C
  1798. API BOOL, Rectangle, TEXT, <RECT>
  1799. P_HDCNOIC hdc ;validated by Valid() (3.0 and 3.1) in RectangleBody
  1800. P_XY1XY2 x1,y1,x2,y2
  1801. ; in FLOOD.ASM
  1802. API BOOL, FloodFill, TEXT, <ASM> ; calls ExtFloodFill
  1803. P_HDCNOIC hdc
  1804. P_int x
  1805. P_int y
  1806. P_COLORREF color
  1807. ; in FLOOD.ASM
  1808. API BOOL, ExtFloodFill, TEXT, <ASM>
  1809. P_HDCNOIC hdc ;validated by VALID? (3.0 and 3.1)
  1810. P_int x
  1811. P_int y
  1812. P_COLORREF color
  1813. P_UVALUE fillType, EFF_MAX ;** range 0-1
  1814. P_LPESCPARMS macro code, cb, lp, opts
  1815. _DefParm <code>,2,<opts>
  1816. _DefParm <cb>,2,<opts>
  1817. _DefParm <lp>,4,<opts>
  1818. if VLgen
  1819. _FlsFrame
  1820. mov ax,_P_&lp
  1821. mov cx,_P_&lp+2
  1822. mov bx,_P_&cb
  1823. lcall CLP0
  1824. _gensub LP
  1825. endif
  1826. endm
  1827. ; in ESC.ASM
  1828. API int, Escape, TEXT, <ASM, ATMFRAMEDS>
  1829. P_HDCNOTMEM hdc ; ** not mem. DC. VALID? (3.0 and 3.1)
  1830. P_LPESCPARMS code, cbInData, lpInData
  1831. P_LPVOID0 lpOutData
  1832. APIERR
  1833. mov ax,SP_ERROR ;General escape error
  1834. APIEND
  1835. ; in ENUMOBJE.ASM
  1836. API int, EnumObjects, TEXT, <ASM>
  1837. P_HDC hdc ; validated by VALID? (3.0 and 3.1)
  1838. P_RVALUE nObjectType, OBJ_MIN, OBJ_MAX ; ** range 1-2
  1839. P_LPFNOENUM lpCallBack ; **
  1840. P_DWORD lpClientData ; CLPVOID0 ?, but often just contains data
  1841. ; in ENUMFONT.ASM
  1842. API int, EnumFonts, TEXT, <ASM,ATMFRAMEDS>
  1843. P_HDC hdc ; validated by VALID? (3.0 and 3.1) in RectStuff
  1844. P_CLPFACENAME0 lpFaceName
  1845. P_LPFNFENUM lpFontFunc ; **
  1846. P_DWORD lpData ; CLPVOID0 ?, but often just contains data
  1847. ; in ENUMFONT.ASM (new for Win 3.1)
  1848. API int EnumFontFamilies, TEXT, <ASM>
  1849. P_HDC hdc ; validated by VALID?
  1850. P_CLPFACENAME0 lpFaceName
  1851. P_LPFNFENUM lpFontFunc ;
  1852. P_DWORD lpData ; CLPVOID0 ?, but often just contains data
  1853. ; in GETSTUFF.ASM
  1854. API DWORD, GetCurrentPosition, TEXT, <ASM,FUNNYFRAME,NODATA,DEBUGONLY> ;nogen
  1855. P_HDC hdc ;validated by VALID? (3.0 and 3.1) in GSV
  1856. ; in WIN32.C
  1857. API BOOL GetCurrentPositionEx, TEXT, <FUNNYFRAME, NODATA, DEBUGONLY> ;nogen
  1858. P_HDC hdc
  1859. P_LPPOINT lpPoint
  1860. ; in GETSTUFF.ASM
  1861. API DWORD, GetDCOrg, TEXT, <ASM,FUNNYFRAME,NODATA,DEBUGONLY> ;nogen
  1862. P_HDC hdc ;validated by VALID? (3.0 and 3.1) in GSV
  1863. ; in GETSTUFF.ASM
  1864. API DWORD, GetBrushOrg, TEXT, <ASM,FUNNYFRAME,NODATA,DEBUGONLY> ; nogen
  1865. P_HDC hdc ; validated by VALID? (3.0 and 3.1) in GSV
  1866. ; in WIN32.C
  1867. API BOOL, GetBrushOrgEx, TEXT, <FUNNYFRAME, NODATA, DEBUGONLY> ; nogen
  1868. P_HDC hdc
  1869. P_LPPOINT lpPoint
  1870. ; in GETSTUFF.ASM
  1871. API DWORD, GetBkColor, TEXT, <ASM, FUNNYFRAME,NODATA,DEBUGONLY> ; nogen
  1872. P_HDC hdc ;validated by VALID? (3.0 and 3.1) by GSV
  1873. ; in GETSTUFF.ASM
  1874. API int, GetBkMode, TEXT, <ASM,FUNNYFRAME,NODATA,DEBUGONLY> ;nogen
  1875. P_HDC hdc ;validated by VALID? (3.0 and 3.1) by GSV
  1876. ; in GETSTUFF.ASM
  1877. API DWORD, GetTextColor, TEXT, <ASM,FUNNYFRAME,NODATA,DEBUGONLY>;nogen
  1878. P_HDC hdc ;validated by VALID? (3.0 and 3.1) by GSV
  1879. ; in GETSTUFF.ASM
  1880. API WORD, GetTextAlign, TEXT, <ASM, FUNNYFRAME,DEBUGONLY> ;nogen
  1881. P_HDC hdc ;validated by VALID? (3.0 and 3.1) by GSV
  1882. ; in GETSTUFF.ASM
  1883. API int, GetROP2, TEXT, <ASM, FUNNYFRAME, NODATA, DEBUGONLY>
  1884. P_HDC hdc ;validated by VALID? (3.0 and 3.1) by GSV
  1885. ; in GETSTUFF.ASM
  1886. API int, GetStretchBltMode, TEXT, <ASM, FUNNYFRAME,NODATA,DEBUGONLY> ;nogen
  1887. P_HDC hdc ;validated by VALID? (3.0 and 3.1) by GSV
  1888. ; in GETSTUFF.ASM
  1889. API int, GetPolyFillMode, TEXT, <ASM, FUNNYFRAME,NODATA,DEBUGONLY> ;nogen
  1890. P_HDC hdc ;validated by VALID? (3.0 and 3.1) by GSV
  1891. ; in GETSTUFF.ASM
  1892. API int, GetMapMode, TEXT, <ASM, FUNNYFRAME,NODATA,DEBUGONLY> ;nogen
  1893. P_HDC hdc ;validated by VALID? (3.0 and 3.1) by GSV
  1894. ; in GETSTUFF.ASM
  1895. API DWORD, GetWindowOrg, TEXT, <ASM, FUNNYFRAME,NODATA,DEBUGONLY> ;nogen
  1896. P_HDC hdc ;validated by VALID? (3.0 and 3.1) by GSV
  1897. ;in WIN32.C
  1898. API BOOL, GetWindowOrgEx, TEXT, <FUNNYFRAME,NODATA,DEBUGONLY> ;nogen
  1899. P_HDC hdc
  1900. P_LPPOINT lpPoint
  1901. ; in GETSTUFF.ASM
  1902. API DWORD, GetWindowExt, TEXT, <ASM, FUNNYFRAME,NODATA,DEBUGONLY> ;nogen
  1903. P_HDC hdc ;validated by VALID? (3.0 and 3.1) by GSV
  1904. ; in WIN32.C
  1905. API BOOL, GetWindowExtEx, TEXT, <FUNNYFRAME,NODATA,DEBUGONLY> ;nogen
  1906. P_HDC hdc
  1907. P_LPSIZE lpSize
  1908. ; in GETSTUFF.ASM
  1909. API DWORD, GetViewportOrg, TEXT, <ASM, FUNNYFRAME,NODATA,DEBUGONLY> ;nogen
  1910. P_HDC hdc ;validated by VALID? (3.0 and 3.1) by GSV
  1911. ; in WIN32.C
  1912. API BOOL, GetViewportOrgEx, TEXT, <FUNNYFRAME,NODATA,DEBUGONLY> ;nogen
  1913. P_HDC hdc
  1914. P_LPPOINT lpPoint
  1915. ; in WIN32.C
  1916. API BOOL, GetViewportExtEx, TEXT, <FUNNYFRAME,NODATA,DEBUGONLY> ;nogen
  1917. P_HDC hdc
  1918. P_LPSIZE lpSize
  1919. ; in GETSTUFF.ASM
  1920. API DWORD, GetViewportExt, TEXT, <ASM, FUNNYFRAME,NODATA,DEBUGONLY> ;nogen
  1921. P_HDC hdc ;validated by VALID? (3.0 and 3.1) by GSV
  1922. ; in CHARWID.ASM
  1923. API BOOL, GetCharWidth, TEXT, <ASM, ATMFRAMEDS>
  1924. P_HDC hdc ;validated by VALID? (3.0 and 3.1)
  1925. P_LPRWBUFFER chFirst, chLast, lpBuffer, 2 ;** size dictated by
  1926. ;char. range. Each entry in
  1927. ;buffer is 2 bytes. Buffer
  1928. ;filled in DEBUG Win 3.1 only
  1929. ;lpBuffer is an int. buffer
  1930. ; in SETPIXEL.ASM
  1931. API DWORD, GetPixel, TEXT, <ASM>
  1932. P_HDC hdc ;validated by VALID? (3.0 and 3.1)
  1933. P_int x
  1934. P_int y
  1935. ; in SETPIXEL.ASM
  1936. API DWORD, SetPixel, TEXT, <ASM>
  1937. P_HDCMETA hdc ; validated by VALID? (3.0 and 3.1)
  1938. P_int x
  1939. P_int y
  1940. P_COLORREF color
  1941. APIERR
  1942. mov ax, -1
  1943. cwd
  1944. APIEND
  1945. ; in STOCK.ASM
  1946. API HANDLE, GetStockObject, TEXT, <ASM>
  1947. P_VALUE nIndex, STOCK_MAX ; ** range 0-STOCK_MAX
  1948. ; in GDIINQ1.ASM
  1949. API LONG, GetBitmapBits, TEXT, <ASM, FUNNYFRAME,NODATA>
  1950. P_HBITMAP hBitmap ;validated by VALID? (3.0 and 3.1)
  1951. P_LPBUFFERDW dwCount, lpBits ;** buffer size a DWORD
  1952. ;buffer filled in DEBUG Win 3.1
  1953. ; in GDIINQ1.ASM
  1954. API int, GetDeviceCaps, TEXT, <ASM>
  1955. P_HDCMETA hdc ;validated by VALID? (3.0 and 3.1)
  1956. P_DEVCAP nIndex ;** valid int. indices even-numbered
  1957. ;ranges 0-44, 88-90, 104-108.
  1958. ; in GDIINQ1.ASM
  1959. API LONG, SetBitmapBits, TEXT, <ASM, FUNNYFRAME,NODATA> ;nogen
  1960. P_HBITMAP hBitmap ; validated by VALID? (3.0 and 3.1) in BitmapBits
  1961. P_CLPBUFFERDW dwCount, lpBits ;** buffer size a DWORD
  1962. ;buffer filled in DEBUG Win 3.1
  1963. ; in GDIINQ2.ASM
  1964. API int, GetObject, TEXT, <ASM>
  1965. P_HGDIOBJGET hObject ;** Validated by VALID? (3.0 and 3.1)
  1966. ; pens, brushes, fonts, bitmaps &
  1967. ; palettes.
  1968. P_LPBUFFERX nCount, lpObject ;** nCount occurs before lpBits
  1969. ;buffer filled in DEBUG Win 3.1
  1970. ; in FASPECT.ASM
  1971. API DWORD, GetAspectRatioFilter, TEXT, <ASM>
  1972. P_HDC hdc ;validated by VALID? (3.0 and 3.1)
  1973. ; in WIN32.C
  1974. API BOOL, GetAspectRatioFilterEx, TEXT
  1975. P_HDC hdc
  1976. P_LPSIZE lpSize
  1977. ; in FASPECT.ASM
  1978. API DWORD, SetMapperFlags, TEXT, <ASM>
  1979. P_HDCMETA hdc ; validated by VALID? (3.0 and 3.1) in WordSet
  1980. P_DFLAGS dwFlag, MAPFLG_VALID_L, MAPFLG_VALID_H ; ** only bit #1 is recognized
  1981. ; in XFORMMAN.ASM
  1982. API DWORD, GetNearestColor, TEXT, <ASM>
  1983. P_HDC hdc ; validated by VALID? (3.0 and 3.1)
  1984. P_COLORREF color
  1985. ; in XFORMMAN.ASM
  1986. API DWORD, OffsetViewportOrg, TEXT, <ASM, FUNNYFRAME,NODATA> ;nogen
  1987. P_HDCMETA hdc ;validated by VALID? (3.0 and 3.1) in OffsetOrg
  1988. P_int x
  1989. P_int y
  1990. ; in WIN32.C
  1991. API BOOL, OffsetViewportOrgEx, TEXT, <FUNNYFRAME,NODATA> ;nogen
  1992. P_HDCMETA hdc
  1993. P_int x
  1994. P_int y
  1995. P_LPPOINT0 lpPoint
  1996. ; in XFORMMAN.ASM
  1997. API DWORD, OffsetWindowOrg, TEXT, <ASM, FUNNYFRAME,NODATA> ;nogen
  1998. P_HDCMETA hdc ;validated by VALID? (3.0 and 3.1) in OffsetOrg
  1999. P_int x
  2000. P_int y
  2001. ; in WIN32.C
  2002. API BOOL, OffsetWindowOrgEx, TEXT, <FUNNYFRAME,NODATA> ;nogen
  2003. P_HDCMETA hdc
  2004. P_int x
  2005. P_int y
  2006. P_LPPOINT0 lpPoint
  2007. ; in XFORMMAN.ASM
  2008. API int, SetMapMode, TEXT, <ASM>
  2009. P_HDCMETA hdc ;validated by VALID? (3.0 and 3.1)
  2010. P_RVALUE nMapMode, MM_MIN, MM_MAX ;** range 1-8
  2011. ; in XFORMMAN.ASM
  2012. API DWORD, SetWindowExt, TEXT, <ASM,FUNNYFRAME,NODATA> ;nogen
  2013. P_HDCMETA hdc ;validated by VALID? (3.0 and 3.1) in SetWinViewExt
  2014. P_int x
  2015. P_int y
  2016. ; in WIN32.C
  2017. API BOOL SetWindowExtEx, TEXT, <FUNNYFRAME,NODATA> ;nogen
  2018. P_HDCMETA hdc
  2019. P_int x
  2020. P_int y
  2021. P_LPSIZE0 lpSize
  2022. ; in XFORMMAN.ASM
  2023. API DWORD, SetViewportExt, TEXT, <ASM,FUNNYFRAME,NODATA> ;nogen
  2024. P_HDCMETA hdc ;validated by VALID? (3.0 and 3.1) in SetWinViewExt
  2025. P_int x
  2026. P_int y
  2027. ; in WIN32.C
  2028. API BOOL, SetViewportExtEx, TEXT, <FUNNYFRAME,NODATA> ;nogen
  2029. P_HDCMETA hdc
  2030. P_int x
  2031. P_int y
  2032. P_LPSIZE0 lpSize
  2033. ; in XFORMMAN.ASM
  2034. API DWORD, ScaleViewportExt, TEXT, <ASM,FUNNYFRAME,NODATA> ;nogen
  2035. P_HDCMETA hdc ;validated by VALID? (3.0 and 3.1) in ScaleExt
  2036. P_int xNum
  2037. P_intN0 XDenom ;calls MulDiv
  2038. P_int yNum
  2039. P_intN0 YDenom ;calls MulDiv
  2040. ; in WIN32.C
  2041. API BOOL, ScaleViewportExtEx, TEXT, <FUNNYFRAME,NODATA> ;nogen
  2042. P_HDCMETA hdc ;validated by VALID? (3.0 and 3.1) in ScaleExt
  2043. P_int xNum
  2044. P_intN0 XDenom ;calls MulDiv
  2045. P_int yNum
  2046. P_intN0 YDenom ;calls MulDiv
  2047. P_LPSIZE0 lpSize
  2048. ; in XFORMMAN.ASM
  2049. API DWORD, ScaleWindowExt, TEXT, <ASM,FUNNYFRAME,NODATA> ;nogen
  2050. P_HDCMETA hdc ;validated by VALID? (3.0 and 3.1) in ScaleExt
  2051. P_int xNum
  2052. P_intN0 XDenom ;calls MulDiv
  2053. P_int yNum
  2054. P_intN0 YDenom ;calls MulDiv
  2055. ; in WIN32.C
  2056. API BOOL, ScaleWindowExtEx, TEXT, <FUNNYFRAME,NODATA> ;nogen
  2057. P_HDCMETA hdc ;validated by VALID? (3.0 and 3.1) in ScaleExt
  2058. P_int xNum
  2059. P_intN0 XDenom ;calls MulDiv
  2060. P_int yNum
  2061. P_intN0 YDenom ;calls MulDiv
  2062. P_LPSIZE0 lpSize
  2063. ; in CLIPMAN.ASM
  2064. API int, GetRgnBox, TEXT, <ASM>
  2065. P_HRGN hrgn ;validated by VALID? (3.0 and 3.1)
  2066. P_LPRECT lpRect ;buffer filled in DEBUG Win 3.1
  2067. ; in GETTEXTE.ASM
  2068. API DWORD, GetTextExtent, TEXT, <ASM, ATMFRAMEDS>
  2069. P_HDC hdc ;validated by VALID? (3.0 and 3.1)
  2070. P_CLPBUFFER lpString, nCount
  2071. ; win WIN32.C
  2072. API BOOL, GetTextExtentPoint, TEXT
  2073. P_HDC hdc
  2074. P_CLPBUFFER lpString, nCount
  2075. P_LPSIZE lpSize
  2076. ; in TEXTATTS.ASM
  2077. API int, GetTextCharacterExtra, TEXT, <ASM>
  2078. P_HDC hdc ;validated by VALID? (3.0 and 3.1)
  2079. ; in GETTEXTF.ASM
  2080. API int, GetTextFace, TEXT, <ASM>
  2081. P_HDC hdc ;validated by VALID? (3.0 and 3.1)
  2082. P_LPBUFFERX lpFaceName, nBytes ;nBytes occurs before lpFaceName
  2083. ;buffer filled in DEBUG Win 3.1
  2084. APIERR
  2085. E_SETEMPTY lpFaceName, nBytes
  2086. APIEND
  2087. ; in GETTEXTM.ASM
  2088. API BOOL, GetTextMetrics, TEXT, <ASM>
  2089. P_HDC hdc ;validated by VALID? (3.0 and 3.1)
  2090. P_LPTEXTMETRIC lptm ;**buffer filled in DEBUG Win 3.1
  2091. ; in ENVIRON.ASM
  2092. API int, GetEnvironment, TEXT, <ASM>
  2093. P_CLPSTR lpPortName ; ** converted to atom after
  2094. ; stripping off colons
  2095. P_LPBUFFER0 lpEnviron, nBytes ; NULL => return env. block size
  2096. ; buffer filled in DEBUG Win 3.1
  2097. APIERR
  2098. E_SETEMPTY lpEnviron, nBytes
  2099. APIEND
  2100. ; in ENVIRON.ASM
  2101. API int, SetEnvironment, TEXT, <ASM>
  2102. P_CLPSTR lpPortName ; converted to atom after stripping off ":"s
  2103. P_CLPBUFFER lpEnviron, wCount ; buffer filled in DEBUG Win 3.1
  2104. ; in ADDFONTR.ASM
  2105. API int, AddFontResource, TEXT, <ASM>
  2106. P_CLPSTRHRSRC lpFileName ; ** null-terminated filename or handle to
  2107. ; loaded resource handle in LOWORD
  2108. ; in DELFONT.ASM
  2109. API BOOL, RemoveFontResource, TEXT, <ASM>
  2110. P_CLPSTRHRSRC lpFileName ; ** null-terminated filename or handle to
  2111. ; loaded resource handle in LOWORD
  2112. ; in FONTENG2.ASM (new for Win 3.1)
  2113. API BOOL, CreateScalableFontResource, TEXT, <ASM>
  2114. F_VALUE fEmbed, 1
  2115. P_CLPSTR lpResFileName
  2116. P_CLPSTR lpFntFileName
  2117. P_CLPSTR0 lpCurrentPath
  2118. STRUCT <MAT2>
  2119. F_WORD fract1
  2120. F_int value1
  2121. F_WORD fract2
  2122. F_int value2
  2123. F_WORD fract2
  2124. F_int value4
  2125. F_WORD fract4
  2126. F_int value4
  2127. ENDSTRUCT
  2128. _GenLP <P_LPMAT2>,<LP>,%VLcbsMAT2
  2129. ; in FONTENG2.ASM (new for Win 3.1)
  2130. API DWORD, GetGlyphOutline, TEXT, <ASM>
  2131. P_HDC hdc ; validated by VALID?
  2132. P_WORD cch
  2133. P_FLAGS wFlags, GLYPH_VALID ; ** 0,1,2
  2134. P_LPGLYPHMETRICS lpMetrics
  2135. P_LPGGO0 cbBuffer, lpPoints
  2136. P_LPMAT2 lpXForm
  2137. APIERR
  2138. mov ax,-1
  2139. cwd
  2140. APIEND
  2141. ; in FONTENG2.ASM (new for Win 3.1)
  2142. API DWORD, GetFontData, TEXT, <ASM>
  2143. P_HDC hdc ; validated by VALID?
  2144. P_DWORD dwTable
  2145. P_DWORD dwOffset
  2146. P_LPFDATA0 lpBuffer, cbBuffer
  2147. APIERR
  2148. mov ax,-1
  2149. cwd
  2150. APIEND
  2151. ; in FONTENG2.ASM (new for Win 3.1)
  2152. API BOOL, GetCharABCWidths, TEXT, <ASM>
  2153. P_HDC hdc ; validated by VALID?
  2154. P_LPRWBUFFER chFirst, chLast, lpBuffer, 6 ;size dictated by
  2155. ;char. range. Buffer filled
  2156. ;in DEBUG Win 3.1 only
  2157. ;Each entry in lpBuffer is
  2158. ;of 6 bytes.
  2159. ; in FONTENG2.ASM (new for Win 3.1)
  2160. API BOOL GetOutlineTextMetrics, TEXT, <ASM>
  2161. P_HDC hdc ;validated by VALID?
  2162. P_LPETM0 cb, lpBuffer ;** NULL ptr. is valid
  2163. ;Buffer filled in DEBUG Win 3.1
  2164. STRUCT <KERNINGPAIR>
  2165. F_WORD wFirst
  2166. F_WORD wSecond
  2167. F_int iKernAmount
  2168. ENDSTRUCT
  2169. P_LPKERNINGPAIRS0 macro ckp, lpkp
  2170. _DefParm <ckp>,2,<opts>
  2171. _DefParm <lpkp>,4,<opts>
  2172. if VLgen
  2173. _FlsFrame
  2174. mov ax,VLcbsKERNINGPAIR ; bx = ckp * sizeof(KERNINGPAIR)
  2175. mul word ptr _P_&ckp
  2176. xchg ax,bx
  2177. mov ax,_P_&lpkp ; cx:ax = lpkp
  2178. mov cx,_P_&lpkp+2
  2179. lcall LP0
  2180. endif
  2181. endm
  2182. API int GetKerningPairs, TEXT
  2183. P_HDC hdc
  2184. P_LPKERNINGPAIRS0 ckp, lpkp
  2185. ; in OUTMAN.ASM
  2186. API BOOL, LineTo, TEXT, <ASM>
  2187. P_HDCNOIC hdc ;validated by VALID? (3.0 and 3.1)
  2188. P_int x
  2189. P_int y
  2190. ; in OUTMAN.ASM
  2191. API DWORD, MoveTo, TEXT, <ASM>
  2192. P_HDCMETA hdc ;validated by VALID? (3.0 and 3.1) in DPXlate
  2193. P_int x
  2194. P_int y
  2195. ; in WIN32.C
  2196. API BOOL, MoveToEx, TEXT
  2197. P_HDCMETA hdc
  2198. P_int x
  2199. P_int y
  2200. P_LPPOINT0 lpPoint
  2201. ; in OUTMAN.ASM
  2202. API BOOL, Polyline, TEXT, <ASM>
  2203. P_HDCNOIC hdc ;validated by VALID? (3.0 and 3.1)
  2204. P_CLPPOINTBUFFER lpPoints, nCount
  2205. ; in LINEDDA.ASM
  2206. API void, LineDDA, TEXT, <ASM, FUNNYFRAME>
  2207. P_XY1XY2 x1,y1,x2,y2 ; overflow problem here too?
  2208. P_LPFNLENUM lpFontFunc ; **
  2209. P_DWORD lpData ; CLPVOID0 ?, but often just contains data
  2210. ; in MULDIV.ASM
  2211. API int, MulDiv, TEXT, <ASM, NOGEN>
  2212. P_int a
  2213. P_int b
  2214. P_intN0 c ;** MulDiv checks for overflow
  2215. ; in POLYGON.ASM
  2216. API BOOL, Polygon, TEXT, <ASM>
  2217. P_HDCNOIC hdc ;validated by VALID? (3.0 and 3.1)
  2218. P_CLPPOINTBUFFER lpPoints, nCount
  2219. ; in POLYGON.ASM
  2220. API BOOL, PolyPolygon, TEXT, <ASM>
  2221. P_HDCNOIC hdc ;validated by VALID? (3.0 and 3.1)
  2222. P_POLYPOLYPOINTS lpPoints, lpPolyCounts, nCount ;lpPolyCounts is a buffer
  2223. ;of nCount Integers. lpPoints
  2224. ;is a buffer of POINTS. Size of
  2225. ;lpPoints det. by sum of all
  2226. ;integers in lpPolyCounts
  2227. ifdef WOW
  2228. API BOOL, PolyPolylineWOW, TEXT, <ASM>
  2229. P_HDCNOIC hdc ;validated by VALID? (3.0 and 3.1)
  2230. P_POLYPOLYLARGEPOINTS lpPoints, lpPolyCounts, nCount
  2231. endif
  2232. ; in PATBL.ASM
  2233. API BOOL, StretchBlt, TEXT, <ASM>
  2234. P_HDCNOIC hdcDst ; validated by VALID? (3.0 and 3.1)
  2235. P_int xDst
  2236. P_int yDst
  2237. P_int cxDst
  2238. P_int cyDst
  2239. P_HDC hdcSrc ; validated by VALID? (3.0 and 3.1)
  2240. P_int xSrc
  2241. P_int ySrc
  2242. P_int cxSrc
  2243. P_int cySrc
  2244. P_ROP rop
  2245. ; in PATBL.ASM
  2246. API BOOL, BitBlt, TEXT, <ASM>
  2247. P_HDCNOIC hdcDst ; validated by VALID? (3.0 and 3.1)
  2248. P_int xDst
  2249. P_int yDst
  2250. P_int cxDst
  2251. P_int cyDst
  2252. P_HDC0 hdcSrc ; ** hSrcDC Used only if higher 2 bits of each
  2253. P_int cxSrc ; nibble of HIWORD(rop) != lower 2 bis of
  2254. P_int cySrc ; same nibble. Validated by VALID? (3.1 only)
  2255. P_ROP rop ; XSrc and YSrc are int. values.
  2256. ; in PATBL.ASM
  2257. API BOOL, PatBlt, TEXT, <ASM>
  2258. P_HDCNOIC hdc ;validated by VALID? (3.0 and 3.1)
  2259. P_int x
  2260. P_int y
  2261. P_int cx
  2262. P_int cy
  2263. P_ROP rop ; ** Only HIWORD used. LOWORD carried
  2264. ; around for 1.x driver compatiblity
  2265. ; in GETPOBJ.ASM
  2266. API DWORD, SetBrushOrg, TEXT, <ASM>
  2267. P_HDC hdc ; validated by VALID? (3.0 and 3.1)
  2268. P_int x
  2269. P_int y
  2270. ; in GETPOBJ.ASM
  2271. API BOOL, UnrealizeObject, TEXT, <ASM>
  2272. P_HGDIOBJUNR hObject ;** brush or palette
  2273. ;cannot be selected into any DC
  2274. ; in CLIPMAN.ASM
  2275. API int, ExcludeClipRect, TEXT, <ASM, FUNNYFRAME,NODATA>
  2276. P_HDCMETA hdc ;validated by VALID? (3.0 and 3.1) in RectStuff
  2277. P_XY1XY2 x1,y1,x2,y2
  2278. ; in CLIPMAN.ASM
  2279. API int, GetClipBox, TEXT, <ASM>
  2280. P_HDC hdc ;validated by VALID? (3.0 and 3.1)
  2281. P_LPRECT lpRect ;buffer filled in DEBUG Win 3.1
  2282. ; in CLIPMAN.ASM
  2283. API int, IntersectClipRect, TEXT, <ASM, FUNNYFRAME,NODATA> ; nogen
  2284. P_HDCMETA hdc ;validated by VALID? (3.0 and 3.1) in RectStuff
  2285. P_XY1XY2 x1,y1,x2,y2
  2286. ; in CLIPMAN.ASM
  2287. API int, SelectClipRgn, TEXT, <ASM>
  2288. P_HDCMETA hdc ; validated by VALID? (3.0 and 3.1)
  2289. P_HRGN0 hrgn ; validated by VALID? (3.0), VALIDDEBUG? (3.1)
  2290. ; in RG.ASM
  2291. API HRGN, CreateRectRgnIndirect, TEXT, <ASM>
  2292. P_CLPRECT lpRect
  2293. ; in RG.ASM
  2294. API BOOL, EqualRgn, TEXT, <ASM>
  2295. P_HRGN hrgn1 ;validated by VALID? (3.0 and 3.1) in RectStuff
  2296. P_HRGN hrgn2 ;validated by VALID? (3.0 and 3.1) in RectStuff
  2297. ; in RG.ASM
  2298. API BOOL, RectInRegion, TEXT, <ASM, FUNNYFRAME> ;nogen
  2299. P_HRGN hrgn ;validated by VALID? (3.0), ValidDebug? (3.1) StuffInRegion
  2300. P_CLPRECT lpRect
  2301. ; in RG.ASM
  2302. API BOOL, RectVisible, TEXT, <ASM, FUNNYFRAME> ; nogen
  2303. P_HDC hdc ;validated by VALID? (3.0), ValidDebug? (3.1) StuffVisible
  2304. P_CLPRECT lpRect
  2305. ; in RG.ASM
  2306. API int, OffsetRgn, TEXT, <ASM>
  2307. P_HRGN hrgn ;validated by VALID? (3.0 and 3.1)
  2308. P_int x
  2309. P_int y
  2310. ; in RG.ASM
  2311. API int, OffsetClipRgn, TEXT, <ASM>
  2312. P_HDCMETA hdc ;validated by VALID? (3.0 and 3.1)
  2313. P_int x
  2314. P_int y
  2315. ; in REGION.ASM
  2316. API HRGN, CreateRectRgn, TEXT, <ASM, NOGEN>
  2317. P_XY1XY2 x1,y1,x2,y2 ; X2-X1 and Y2-Y1 under 32,767 units
  2318. ; in REGION.ASM
  2319. API int, CombineRgn, TEXT, <ASM>
  2320. P_HRGN hrgnDst ;validated by VALID? (3.0 and 3.1)
  2321. P_HRGN hrgnSrc1 ;validated by VALID? (3.0 and 3.1)
  2322. P_HRGN0 hrgnSrc2 ;validated by VALID? (3.0 and 3.1)
  2323. ; Can be NULL if code is RGN_COPY
  2324. P_RVALUE code, RGN_MIN, RGN_MAX ;** range 1-5
  2325. ; in REGION.ASM
  2326. API void, SetRectRgn, TEXT, <ASM>
  2327. P_HRGN hrgn ; validated by VALID? (3.0 and 3.1)
  2328. P_XY1XY2 x1,y1,x2,y2
  2329. ; in RGOUT.C
  2330. API BOOL, FillRgn, TEXT
  2331. P_HDCNOIC hdc ; Checked by Valid()
  2332. P_HRGN hrgn ; Checked by Valid()
  2333. P_HBRUSH hBrush ; Checked by Valid()
  2334. ; in RG.ASM
  2335. API BOOL, PtInRegion, TEXT, <ASM>
  2336. P_HRGN hrgn ;checked by Valid() (3.0 and 3.1)
  2337. P_int x
  2338. P_int y
  2339. ; in RGOUT.C
  2340. API BOOL, PaintRgn, TEXT
  2341. P_HDCNOIC hdc ;checked by Valid() (3.0 and 3.1)
  2342. P_HRGN hrgn ;checked by Valid() (3.0 and 3.1)
  2343. ; in RG.ASM
  2344. API BOOL, PtVisible, TEXT, <ASM>
  2345. P_HDC hdc ;validated by Valid() (3.0 and 3.1)
  2346. P_int x
  2347. P_int y
  2348. ; in RGOUT.C
  2349. API BOOL, FrameRgn, TEXT
  2350. P_HDCNOIC hdc ; Checked by Valid()
  2351. P_HRGN hrgn ; Checked by Valid()
  2352. P_HBRUSH hBrush ; Checked by Valid()
  2353. P_int cx
  2354. P_int cy
  2355. ; in RGOUTZ.ASM
  2356. API BOOL, InvertRgn, TEXT, <ASM>
  2357. P_HDCNOIC hdc ;validated by VALID? (3.0 and 3.1)
  2358. P_HRGN hrgn ;validated by VALID? (3.0 and 3.1)
  2359. ; in OBJSEL.ASM
  2360. API HANDLE, SelectObject, TEXT, <ASM, ATMFRAMEDS>
  2361. P_HDCMETA hdc ; validated by VALID? (3.0 and 3.1)
  2362. P_HGDIOBJSEL hObj ; ** validated by VALID? (3.0 and 3.1)
  2363. ; only pens, brushes, fonts, bitmaps &
  2364. ; regions (no palettes)
  2365. ; in COLOR.ASM
  2366. API DWORD, SetTextColor, TEXT, <ASM>
  2367. P_HDCMETA hdc ; validated by VALID? (3.0 and 3.1)
  2368. P_COLORREF color
  2369. ; in COLOR.ASM
  2370. API DWORD, SetBkColor, TEXT, <ASM>
  2371. P_HDCMETA hdc ; validated by VALID? (3.0 and 3.1)
  2372. P_COLORREF color
  2373. APIERR
  2374. mov dh,80h ;; return 0x8000:0x0000
  2375. APIEND
  2376. ; in NEWXFORM.ASM
  2377. API int, SetBkMode, TEXT, <ASM,FUNNYFRAME,NODATA> ;nogen
  2378. P_HDCMETA hdc ; validated by VALID? (3.0 and 3.1) in WordSet
  2379. P_RVALUE nBkMode, BK_MIN, BK_MAX ; range 1-2
  2380. ; in NEWXFORM.ASM
  2381. API WORD, SetTextAlign, TEXT, <ASM,FUNNYFRAME> ;nogen
  2382. P_HDCMETA hdc ; validated by VALID? (3.0 and 3.1) in WordSet
  2383. P_FLAGS wFlags, TA_VALID ; **
  2384. ; in NEWXFORM.ASM
  2385. API int, SetROP2, TEXT, <ASM, FUNNYFRAME,NODATA> ;nogen
  2386. P_HDCMETA hdc ; validated by VALID? (3.0 and 3.1) in WordSet
  2387. P_RVALUE nDrawMode, R2_MIN,R2_MAX ; ** range 1-16
  2388. ; in NEWXFORM.ASM
  2389. API int, SetStretchBltMode, TEXT, <ASM, FUNNYFRAME,NODATA> ;nogen
  2390. P_HDCMETA hdc ;validated by VALID? (3.0 and 3.1) in WordSet
  2391. P_RVALUE nStrMode, STR_MIN, STR_MAX ;** range 1-3
  2392. ; in NEWXFORM.ASM
  2393. API int, SetPolyFillMode, TEXT, <ASM,FUNNYFRAME,NODATA> ;nogen
  2394. P_HDCMETA hdc ;validated by VALID? (3.0 and 3.1) in WordSet
  2395. P_RVALUE nPolyFillMode,PFILL_MIN, PFILL_MAX ; ** range 1-2
  2396. ; in NEWXFORM.ASM
  2397. API DWORD, SetWindowOrg, TEXT, <ASM>
  2398. P_HDCMETA hdc ;validated by VALID? (3.0 and 3.1)
  2399. P_int x
  2400. P_int y
  2401. ; in WIN32.C
  2402. API BOOL, SetWindowOrgEx, TEXT
  2403. P_HDCMETA hdc
  2404. P_int x
  2405. P_int y
  2406. P_LPPOINT0 lpPoint
  2407. ; in NEWXFORM.ASM
  2408. API DWORD, SetViewportOrg, TEXT, <ASM>
  2409. P_HDCMETA hdc ;validated by VALID? (3.0 and 3.1)
  2410. P_int x
  2411. P_int y
  2412. ; in WIN32.C
  2413. API BOOL, SetViewportOrgEx, TEXT
  2414. P_HDCMETA hdc
  2415. P_int x
  2416. P_int y
  2417. P_LPPOINT0 lpPoint
  2418. ;----------------------------------------------------------------------------;
  2419. ; D I B V A L I D A T I O N R O U T I N E S ;
  2420. ;----------------------------------------------------------------------------;
  2421. ; NOTES: ;
  2422. ; ;
  2423. ; (1). The size of a color table entry is sizeof RGB_TRIPLE for a core DIB ;
  2424. ; header and RGB_QUAD for a info DIB header. However, if wUsage ;
  2425. ; indicates a npalette usage, the size per entry is 2 bytes. ;
  2426. ; ;
  2427. ; (2). The lpInfoHeader paramater in CreateDIBitmap may not have a color ;
  2428. ; table in the header. ;
  2429. ; ;
  2430. ; (3). For SetDIBits/GetDIBits and SetDIBitsToDevice, a 'numScans' parameter ;
  2431. ; specifies the size of the DIBits. The buffer may not contain the ;
  2432. ; complete DIB. ;
  2433. ; ;
  2434. ; However, in the case of StretchDIBits, the entire DIB buffer should ;
  2435. ; be present and the height of the DIB should be picked up from the ;
  2436. ; associated header. Likewise, if an initializer DIB is provided in the ;
  2437. ; CreateDIBitmap call, it has to have a complete DIB buffer. ;
  2438. ; ;
  2439. ; (4). SetDIBitsToDevice specifies a rectangle in the DIB. This is the only ;
  2440. ; part of the DIB that will be accessed. The validation code should ;
  2441. ; figure out the amount of the DIB buffer that will need to ve accessed ;
  2442. ; and validate that the buffer is big enough for it. ;
  2443. ; ;
  2444. ; (5). If the DIB is RLE compressed and the biSizeImage field is non zero, ;
  2445. ; we will use that size to validate the length of the DIB buffer. ;
  2446. ; ;
  2447. ; (6). The validation code will not validate the bits per pixel and the ;
  2448. ; biCompression fields. This is to allow expansion of these fields in ;
  2449. ; the future. The validation code for these would instead be done in ;
  2450. ; the DIB simulation code. ;
  2451. ;----------------------------------------------------------------------------;
  2452. ; in DIBITM.ASM
  2453. API int, SetDIBits, TEXT, <ASM>
  2454. P_HDCNOIC hdc ;validated by VALID? (3.0 and 3.1)
  2455. P_HANDLE hBitmap ;validated by VALID? (3.1 only)
  2456. ;must not be selected into a DC
  2457. P_WORD nStartScan
  2458. P_CLPBITSINFOBUFFER nNumScans, lpBits, lpBitsInfo, wUsage
  2459. ;** lpBits size depends on number of
  2460. ;scans and info. in lpBitsInfo
  2461. ;lpBitsInfo points to BITMAPINFO
  2462. ;or BITMAPCOREINFO
  2463. ; in DIBITM.ASM
  2464. API HBITMAP, CreateDIBitmap, TEXT, <ASM>
  2465. P_HDCNOIC hdc ; validated by VALID? (3.0 and 3.1)
  2466. P_CLPBITMAPINFOHEADER lpInfoHeader ; ** ptr. to BITMAPINFOHEADER or BITMAPCOREHEADER
  2467. P_CLPDIBITMAP0 dwUsage, lpInitBits, lpInitInfo, wUsage
  2468. ; ** lpInitBits NULL if
  2469. ; dwUsage is not CBM_INIT
  2470. ; Size of lpInitBits depends
  2471. ; on fields in info. block
  2472. ; lpInitInfo points to BITMAPINFO
  2473. ; or BITMAPCOREINFO
  2474. ; in DIBITM.ASM
  2475. API int, SetDIBitsToDevice, TEXT, <ASM>
  2476. P_HDCNOIC hdc ;validated by VALID? (3.0 and 3.1)
  2477. P_WORD xDst
  2478. P_WORD yDst
  2479. P_WORD cxDst
  2480. P_CLPRECTBITSINFOBUFFER cyDst, xSrc, ySrc, nStartScan,nNumScans, lpBits, lpBitsInfo, wUsage
  2481. ;** lpBits size depends on number of
  2482. ;scans and info. in lpBitsInfo
  2483. ;lpBitsInfo points to BITMAPINFO
  2484. ;or BITMAPCOREINFO
  2485. ; in DIBITM.ASM
  2486. API int, GetDIBits, TEXT, <ASM>
  2487. P_HDC hdc ;validated by VALID? (3.0 and 3.1)
  2488. P_HANDLE hBitmap ;validated by VALID? (3.1 only)
  2489. P_WORD nStartScan
  2490. P_LPBITSINFOBUFFER0 nNumScans, lpBits, lpBitsInfo, wUsage
  2491. ;**lpBits
  2492. ;can be NULL.
  2493. ;buffer size depends on number of
  2494. ;scans and info. in lpBitsInfo
  2495. ;lpBitsInfo is a ptr. to
  2496. ;BITMAPINFO or BITMAPCOREINFO
  2497. ; in DIBSTRCH.ASM
  2498. API int, StretchDIBits, TEXT, <ASM>
  2499. P_HDCNOIC hdc ;validated by VALID? (3.0 and 3.1)
  2500. P_WORD xDst
  2501. P_WORD yDst
  2502. P_WORD cxDst
  2503. P_WORD cyDst
  2504. P_WORD xSrc
  2505. P_WORD ySrc
  2506. P_WORD cxSrc
  2507. P_WORD cySrc
  2508. P_CFULLLPBITSINFOBUFFER lpBits, lpBitsInfo, wUsage
  2509. ;** lpBits size depends on height
  2510. ;and info. in lpBitsInfo
  2511. ;lpBitsInfo points to BITMAPINFO
  2512. ;or BITMAPCOREINFO
  2513. P_ROP rop
  2514. ;----------------------------------------------------------------------------;
  2515. ; in TEXTOUT.C
  2516. API BOOL, ExtTextOut, TEXT, <ATMFRAMEDS>
  2517. P_HDCNOIC hdc ; checked by Valid()
  2518. P_int x
  2519. P_int y
  2520. P_FLAGS flags, ETO_VALID ; ** (1,2,4)
  2521. P_CLPRECT0 lprc
  2522. P_CLPETOBUF lpString, nCount, lpDx ;lpDx is NULL or has nCount integers
  2523. ; in TEXTOUT.C
  2524. API BOOL, TextOut, TEXT
  2525. P_HDCNOIC hdc
  2526. P_int X
  2527. P_int Y
  2528. P_CLPBUFFER lpString, nCount