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.

1495 lines
41 KiB

  1. CodeData equ <THUNK16CodeData>
  2. include thkrp.inc
  3. include cbcheck.inc
  4. include thkframe.inc
  5. include public.inc
  6. include thkmacro.inc
  7. include struc.inc
  8. include cbcid.inc
  9. include pwcbid.inc
  10. externDef PrivateEscape:near16
  11. externDef CALLBACK_BODY_16:far16
  12. externDef Escape:far16
  13. externDef AllocCallback:far16
  14. ;externDef MapLS:far16
  15. ;externDef UnmapLS:far16
  16. externDef GlobalAlloc:far16
  17. externDef GlobalSize:far16
  18. externDef GlobalFree:far16
  19. externDef GlobalFix:far16
  20. externDef GlobalUnfix:far16
  21. externDef GlobalLock:far16
  22. externDef GlobalUnlock:far16
  23. externDef GetTextExtentPoint:far16
  24. ifdef DEBUG
  25. externDef _wsprintf:far16
  26. externDef OutputDebugString:far16
  27. endif
  28. externDef AllocSelectorArray:far16
  29. externDef SetSelectorBase:far16
  30. externDef SetSelectorLimit:far16
  31. externDef FreeSelector:far16
  32. externDef SelectorAccessRights:far16
  33. fLocalFlag equ fLzLog16
  34. MAXHOTSPOT equ 8
  35. ;===========================================================================
  36. body_ADDPENINPUTHRC macro
  37. local L0, L1, L2, L3, L4, L5
  38. bp_hrc equ <[bp_top]> ; bp+40 hrc
  39. bp_rgPnt equ <[bp_top+4]> ; bp+44 rgPnt
  40. bp_rgOem equ <[bp_top+8]> ; bp+48 rgOem
  41. bp_fuOem equ <[bp_top+12]> ; bp+52 fuOem
  42. bp_lpsi equ <[bp_top+16]> ; bp+56 lpsi
  43. APILOG16 ADDPENINPUTHRC, fApiLog16
  44. ;-------------------------------------
  45. ; Temp storage
  46. xor eax,eax
  47. push eax ; ptr param #1 rgPnt
  48. push eax ; handle param #2 rgPnt
  49. push eax ; ptr param #3 rgOem
  50. push eax ; ptr param #4 lpsi
  51. ;-------------------------------------
  52. ; *** BEGIN parameter packing
  53. ; rgPnt
  54. ; pointer struct POINT --> struct POINT
  55. cld ; esi, edi will increment
  56. ; different pointer types
  57. mov eax,bp_rgPnt ; base address
  58. or eax,eax
  59. jz L0 ; skip if null
  60. ; structures are not identical
  61. ; structures don't have pointers
  62. mov ecx,dword ptr bp_lpsi ; lpsi
  63. push ds
  64. mov ds,cs:THUNK16CodeData
  65. mov es, FlatData
  66. mov ecx, es:[ecx+0] ;lpsi->cPnt
  67. pop ds
  68. or ecx,ecx
  69. jle L0 ; skip if count negative or zero
  70. mov ds,cs:THUNK16CodeData ; LocalAlloc needs this
  71. mov esi,eax
  72. push ecx ; will get trashed by LocalAlloc
  73. push byte ptr 0 ; alloc fixed
  74. lea eax,[ecx*4]
  75. push ax
  76. call LocalAlloc
  77. pop ecx
  78. or ax,ax ; did we get a handle?
  79. jz L0
  80. mov [bp-8],ax ; save handle
  81. MYLOCALLOCK ax
  82. or ax,ax ; did we get a near pointer?
  83. jz L0
  84. mov [bp-4],ax
  85. mov [bp-2],ds
  86. movzx edi,ax
  87. mov es,cs:THUNK16CodeData ; es:edi == destination
  88. mov ds,es:FlatData ; ds:esi == source
  89. L1:
  90. ; x
  91. ; long --> short
  92. lods dword ptr ds:[esi]
  93. stos word ptr es:[edi]
  94. ; y
  95. ; long --> short
  96. lods dword ptr ds:[esi]
  97. stos word ptr es:[edi]
  98. loop L1
  99. mov ds,cs:THUNK16CodeData ; es:edi == destination
  100. L0:
  101. ; rgOem
  102. ; pointer void --> void
  103. ; same pointer types
  104. mov eax,bp_rgOem ; base address
  105. or eax,eax
  106. jz L2 ; skip if null
  107. push eax
  108. ; cod3216x.c, 1003
  109. call MapLS
  110. mov [bp-12],eax
  111. L2:
  112. ; lpsi
  113. ; pointer struct STROKEINFO --> struct STROKEINFO
  114. sub sp,12 ; lpsi alloc space on stack
  115. ; different pointer types
  116. mov eax,bp_lpsi ; base address
  117. or eax,eax
  118. jz L3 ; skip if null
  119. ; structures are not identical
  120. ; structures don't have pointers
  121. mov [bp-16],sp ; save offset to buffer
  122. mov [bp-14],ss ; save selector to buffer
  123. mov di,ss
  124. mov es,di
  125. movzx edi,sp ; es:edi == destination address
  126. mov esi,eax
  127. mov ds,cs:THUNK16CodeData ; need access to FlatData
  128. mov ds,FlatData ; ds:esi == source address
  129. ; cPnt
  130. ; unsigned long --> unsigned short
  131. lods dword ptr ds:[esi]
  132. stos word ptr es:[edi]
  133. ; cbPnts
  134. ; unsigned long --> unsigned short
  135. lods dword ptr ds:[esi]
  136. stos word ptr es:[edi]
  137. ; wPdk
  138. ; unsigned short --> unsigned short
  139. movs word ptr es:[edi],word ptr ds:[esi]
  140. ; dwTick
  141. ; unsigned long --> unsigned long
  142. movs dword ptr es:[edi],dword ptr ds:[esi] ; no conversion
  143. L3:
  144. ; *** END parameter packing
  145. ;-------------------------------------
  146. ; create new call frame and make the call
  147. ; hrc
  148. push dword ptr bp_hrc ;
  149. ; rgPnt from: struct POINT
  150. push dword ptr [bp-4] ; to: struct POINT
  151. ; rgOem from: void
  152. push dword ptr [bp-12] ; to: void
  153. ; fuOem from: unsigned long
  154. push word ptr bp_fuOem ; to unsigned short
  155. ; lpsi from: struct STROKEINFO
  156. push dword ptr [bp-16] ; to: struct STROKEINFO
  157. call AddPenInputHRC ; call 16-bit version
  158. ; return code short --> long
  159. cwde
  160. ;-------------------------------------
  161. ; *** BEGIN parameter unpacking
  162. push eax ; save return code
  163. ; rgPnt
  164. mov ax,[bp-4] ; get pointer
  165. or ax,ax
  166. jz L4 ; no pointer, but might have handle
  167. push word ptr [bp-8] ; push handle
  168. call LocalUnlock
  169. L4:
  170. mov ax,[bp-8] ; get handle again
  171. or ax,ax
  172. jz L5
  173. push ax
  174. call LocalFree
  175. L5:
  176. pop eax ; restore return code
  177. ; *** END parameter unpacking
  178. push eax
  179. push dword ptr [bp - 12]
  180. call UnmapLS
  181. pop eax
  182. ;-------------------------------------
  183. ;--- If return value == -1, SetLastError(87)
  184. ERRCHK_EXIT -1,87,Exit_20
  185. endm;
  186. ;===========================================================================
  187. body_ADDPOINTSPENDATA macro
  188. local L0, L1, L2, L3, L4, L5
  189. bp_hpndt equ <[bp_top]> ; bp+40 hpndt
  190. bp_lppt equ <[bp_top+4]> ; bp+44 lppt
  191. bp_lpvOemData equ <[bp_top+8]> ; bp+48 lpvOemData
  192. bp_lpsi equ <[bp_top+12]> ; bp+52 lpsi
  193. APILOG16 ADDPOINTSPENDATA, fApiLog16
  194. ;-------------------------------------
  195. ; Temp storage
  196. xor eax,eax
  197. push eax ; ptr param #1 lppt
  198. push eax ; handle param #2 lppt
  199. push eax ; ptr param #3 lpvOemData
  200. push eax ; ptr param #4 lpsi
  201. ;-------------------------------------
  202. ; *** BEGIN parameter packing
  203. ; lppt
  204. ; pointer struct POINT --> struct POINT
  205. cld ; esi, edi will increment
  206. ; different pointer types
  207. mov eax,bp_lppt ; base address
  208. or eax,eax
  209. jz L0 ; skip if null
  210. ; structures are not identical
  211. ; structures don't have pointers
  212. mov ecx,dword ptr bp_lpsi ; lpsi
  213. push ds
  214. mov ds,cs:THUNK16CodeData
  215. mov es, FlatData
  216. mov ecx, es:[ecx+0] ;lpsi->cPnt
  217. pop ds
  218. or ecx,ecx
  219. jle L0 ; skip if count negative or zero
  220. mov ds,cs:THUNK16CodeData ; LocalAlloc needs this
  221. mov esi,eax
  222. push ecx ; will get trashed by LocalAlloc
  223. push byte ptr 0 ; alloc fixed
  224. lea eax,[ecx*4]
  225. push ax
  226. call LocalAlloc
  227. pop ecx
  228. or ax,ax ; did we get a handle?
  229. jz L0
  230. mov [bp-8],ax ; save handle
  231. MYLOCALLOCK ax
  232. or ax,ax ; did we get a near pointer?
  233. jz L0
  234. mov [bp-4],ax
  235. mov [bp-2],ds
  236. movzx edi,ax
  237. mov es,cs:THUNK16CodeData ; es:edi == destination
  238. mov ds,es:FlatData ; ds:esi == source
  239. L1:
  240. ; x
  241. ; long --> short
  242. lods dword ptr ds:[esi]
  243. stos word ptr es:[edi]
  244. ; y
  245. ; long --> short
  246. lods dword ptr ds:[esi]
  247. stos word ptr es:[edi]
  248. loop L1
  249. mov ds,cs:THUNK16CodeData ; es:edi == destination
  250. L0:
  251. ; lpvOemData
  252. ; pointer void --> void
  253. ; same pointer types
  254. mov eax,bp_lpvOemData ; base address
  255. or eax,eax
  256. jz L2 ; skip if null
  257. push eax
  258. ; cod3216x.c, 1003
  259. call MapLS
  260. mov [bp-12],eax
  261. L2:
  262. ; lpsi
  263. ; pointer struct STROKEINFO --> struct STROKEINFO
  264. sub sp,12 ; lpsi alloc space on stack
  265. ; different pointer types
  266. mov eax,bp_lpsi ; base address
  267. or eax,eax
  268. jz L3 ; skip if null
  269. ; structures are not identical
  270. ; structures don't have pointers
  271. mov [bp-16],sp ; save offset to buffer
  272. mov [bp-14],ss ; save selector to buffer
  273. mov di,ss
  274. mov es,di
  275. movzx edi,sp ; es:edi == destination address
  276. mov esi,eax
  277. mov ds,cs:THUNK16CodeData ; need access to FlatData
  278. mov ds,FlatData ; ds:esi == source address
  279. ; cPnt
  280. ; unsigned long --> unsigned short
  281. lods dword ptr ds:[esi]
  282. stos word ptr es:[edi]
  283. ; cbPnts
  284. ; unsigned long --> unsigned short
  285. lods dword ptr ds:[esi]
  286. stos word ptr es:[edi]
  287. ; wPdk
  288. ; unsigned short --> unsigned short
  289. movs word ptr es:[edi],word ptr ds:[esi]
  290. ; dwTick
  291. ; unsigned long --> unsigned long
  292. movs dword ptr es:[edi],dword ptr ds:[esi] ; no conversion
  293. L3:
  294. ; *** END parameter packing
  295. ;-------------------------------------
  296. ; create new call frame and make the call
  297. ; hpndt
  298. push word ptr bp_hpndt ; UINT conversion
  299. ; lppt from: struct POINT
  300. push dword ptr [bp-4] ; to: struct POINT
  301. ; lpvOemData from: void
  302. push dword ptr [bp-12] ; to: void
  303. ; lpsi from: struct STROKEINFO
  304. push dword ptr [bp-16] ; to: struct STROKEINFO
  305. call AddPointsPenData ; call 16-bit version
  306. ; return code short --> long
  307. cwde
  308. ;-------------------------------------
  309. ; *** BEGIN parameter unpacking
  310. push eax ; save return code
  311. ; lppt
  312. mov ax,[bp-4] ; get pointer
  313. or ax,ax
  314. jz L4 ; no pointer, but might have handle
  315. push word ptr [bp-8] ; push handle
  316. call LocalUnlock
  317. L4:
  318. mov ax,[bp-8] ; get handle again
  319. or ax,ax
  320. jz L5
  321. push ax
  322. call LocalFree
  323. L5:
  324. pop eax ; restore return code
  325. ; *** END parameter unpacking
  326. push eax
  327. push dword ptr [bp - 12]
  328. call UnmapLS
  329. pop eax
  330. ;-------------------------------------
  331. ;--- If return value == -1, SetLastError(87)
  332. ERRCHK_EXIT -1,87,Exit_16
  333. endm;
  334. ;===========================================================================
  335. body_INSERTPENDATASTROKE macro
  336. local L0, L1, L2, L3, L4, L5
  337. bp_hpndt equ <[bp_top]> ; bp+40 hpndt
  338. bp_iStrk equ <[bp_top+4]> ; bp+44 iStrk
  339. bp_lppt equ <[bp_top+8]> ; bp+48 lppt
  340. bp_lpvOemData equ <[bp_top+12]> ; bp+52 lpvOemData
  341. bp_lpsi equ <[bp_top+16]> ; bp+56 lpsi
  342. APILOG16 INSERTPENDATASTROKE, fApiLog16
  343. ;-------------------------------------
  344. ; Temp storage
  345. xor eax,eax
  346. push eax ; ptr param #1 lppt
  347. push eax ; handle param #2 lppt
  348. push eax ; ptr param #3 lpvOemData
  349. push eax ; ptr param #4 lpsi
  350. ;-------------------------------------
  351. ; *** BEGIN parameter packing
  352. ; lppt
  353. ; pointer struct POINT --> struct POINT
  354. cld ; esi, edi will increment
  355. ; different pointer types
  356. mov eax,bp_lppt ; base address
  357. or eax,eax
  358. jz L0 ; skip if null
  359. ; structures are not identical
  360. ; structures don't have pointers
  361. mov ecx,dword ptr bp_lpsi ; lpsi
  362. push ds
  363. mov ds,cs:THUNK16CodeData
  364. mov es, FlatData
  365. mov ecx, es:[ecx+0] ;lpsi->cPnt
  366. pop ds
  367. or ecx,ecx
  368. jle L0 ; skip if count negative or zero
  369. mov ds,cs:THUNK16CodeData ; LocalAlloc needs this
  370. mov esi,eax
  371. push ecx ; will get trashed by LocalAlloc
  372. push byte ptr 0 ; alloc fixed
  373. lea eax,[ecx*4]
  374. push ax
  375. call LocalAlloc
  376. pop ecx
  377. or ax,ax ; did we get a handle?
  378. jz L0
  379. mov [bp-8],ax ; save handle
  380. MYLOCALLOCK ax
  381. or ax,ax ; did we get a near pointer?
  382. jz L0
  383. mov [bp-4],ax
  384. mov [bp-2],ds
  385. movzx edi,ax
  386. mov es,cs:THUNK16CodeData ; es:edi == destination
  387. mov ds,es:FlatData ; ds:esi == source
  388. L1:
  389. ; x
  390. ; long --> short
  391. lods dword ptr ds:[esi]
  392. stos word ptr es:[edi]
  393. ; y
  394. ; long --> short
  395. lods dword ptr ds:[esi]
  396. stos word ptr es:[edi]
  397. loop L1
  398. mov ds,cs:THUNK16CodeData ; es:edi == destination
  399. L0:
  400. ; lpvOemData
  401. ; pointer void --> void
  402. ; same pointer types
  403. mov eax,bp_lpvOemData ; base address
  404. or eax,eax
  405. jz L2 ; skip if null
  406. push eax
  407. ; cod3216x.c, 1003
  408. call MapLS
  409. mov [bp-12],eax
  410. L2:
  411. ; lpsi
  412. ; pointer struct STROKEINFO --> struct STROKEINFO
  413. sub sp,12 ; lpsi alloc space on stack
  414. ; different pointer types
  415. mov eax,bp_lpsi ; base address
  416. or eax,eax
  417. jz L3 ; skip if null
  418. ; structures are not identical
  419. ; structures don't have pointers
  420. mov [bp-16],sp ; save offset to buffer
  421. mov [bp-14],ss ; save selector to buffer
  422. mov di,ss
  423. mov es,di
  424. movzx edi,sp ; es:edi == destination address
  425. mov esi,eax
  426. mov ds,cs:THUNK16CodeData ; need access to FlatData
  427. mov ds,FlatData ; ds:esi == source address
  428. ; cPnt
  429. ; unsigned long --> unsigned short
  430. lods dword ptr ds:[esi]
  431. stos word ptr es:[edi]
  432. ; cbPnts
  433. ; unsigned long --> unsigned short
  434. lods dword ptr ds:[esi]
  435. stos word ptr es:[edi]
  436. ; wPdk
  437. ; unsigned short --> unsigned short
  438. movs word ptr es:[edi],word ptr ds:[esi]
  439. ; dwTick
  440. ; unsigned long --> unsigned long
  441. movs dword ptr es:[edi],dword ptr ds:[esi] ; no conversion
  442. L3:
  443. ; *** END parameter packing
  444. ;-------------------------------------
  445. ; create new call frame and make the call
  446. ; hpndt
  447. push word ptr bp_hpndt ; UINT conversion
  448. ; iStrk
  449. push word ptr bp_iStrk ; UINT conversion
  450. ; lppt from: struct POINT
  451. push dword ptr [bp-4] ; to: struct POINT
  452. ; lpvOemData from: void
  453. push dword ptr [bp-12] ; to: void
  454. ; lpsi from: struct STROKEINFO
  455. push dword ptr [bp-16] ; to: struct STROKEINFO
  456. call InsertPenDataStroke ; call 16-bit version
  457. ; return code short --> long
  458. cwde
  459. ;-------------------------------------
  460. ; *** BEGIN parameter unpacking
  461. push eax ; save return code
  462. ; lppt
  463. mov ax,[bp-4] ; get pointer
  464. or ax,ax
  465. jz L4 ; no pointer, but might have handle
  466. push word ptr [bp-8] ; push handle
  467. call LocalUnlock
  468. L4:
  469. mov ax,[bp-8] ; get handle again
  470. or ax,ax
  471. jz L5
  472. push ax
  473. call LocalFree
  474. L5:
  475. pop eax ; restore return code
  476. ; *** END parameter unpacking
  477. push eax
  478. push dword ptr [bp - 12]
  479. call UnmapLS
  480. pop eax
  481. ;-------------------------------------
  482. ;--- If return value == -1, SetLastError(87)
  483. ERRCHK_EXIT -1,87,Exit_20
  484. endm;
  485. body_GETPENMISCINFO macro
  486. local exit, error_exit, L0, L3
  487. local anpfnGPI, MAX_ACTION
  488. local thk_PMI_BEDIT ;1
  489. ; local thk_PMI_IMECOLOR ;2
  490. local thk_PMI_CXTABLET ;3
  491. local thk_PMI_CYTABLET ;4
  492. local thk_PMI_COUNTRY ;5
  493. local thk_PMI_PENTIP ;6
  494. local thk_PMI_LENS ;7
  495. local thk_PMI_TIMEOUT ;8
  496. local thk_PMI_TIMEOUTGEST ;9
  497. local thk_PMI_TIMEOUTSEL ;10
  498. local thk_PMI_SYSFLAGS ;11
  499. local thk_PMI_INDEXFROMRGB ;12
  500. local thk_PMI_RGBFROMINDEX ;13
  501. bp_uParam equ <bp_top>
  502. bp_lParam equ <bp_top+4>
  503. ;BP=SP upon entry
  504. bp_pTmp equ <dword ptr [bp-4]>
  505. mov bx,word ptr bp_uParam
  506. cmp bx,MAX_ACTION
  507. ja error_exit
  508. add bx,bx
  509. jmp word ptr cs:anpfnGPI[bx]
  510. anpfnGPI label word
  511. dw offset error_exit
  512. dw offset thk_PMI_BEDIT ;1
  513. ; dw offset thk_PMI_IMECOLOR ;2
  514. dw offset thk_PMI_CXTABLET ;3
  515. dw offset thk_PMI_CYTABLET ;4
  516. dw offset thk_PMI_COUNTRY ;5
  517. dw offset thk_PMI_PENTIP ;6
  518. dw offset thk_PMI_LENS ;7
  519. dw offset thk_PMI_TIMEOUT ;8
  520. dw offset thk_PMI_TIMEOUTGEST ;9
  521. dw offset thk_PMI_TIMEOUTSEL ;10
  522. dw offset thk_PMI_SYSFLAGS ;11
  523. dw offset thk_PMI_INDEXFROMRGB ;12
  524. dw offset thk_PMI_RGBFROMINDEX ;13
  525. MAX_ACTION equ ($ - anpfnGPI)/2
  526. error_exit:
  527. sub eax,eax
  528. jmp exit
  529. ;-----------------------------------------------------------------------;
  530. ; uParam = UINT
  531. ; lParam = LPUINT
  532. ;-----------------------------------------------------------------------;
  533. thk_PMI_COUNTRY:
  534. thk_PMI_CXTABLET:
  535. thk_PMI_CYTABLET:
  536. thk_PMI_LENS:
  537. thk_PMI_SYSFLAGS:
  538. thk_PMI_TIMEOUT:
  539. thk_PMI_TIMEOUTGEST:
  540. thk_PMI_TIMEOUTSEL:
  541. push byte ptr 0 ;reserve and init local var
  542. mov ax,sp ;save addr of local var
  543. push word ptr bp_uParam
  544. mov esi,bp_lParam
  545. or esi,esi
  546. jz error_exit
  547. push ss
  548. push ax
  549. call GetPenMiscInfo
  550. cwde
  551. pop cx ;recover local var value, clean stack
  552. mov es,FlatData
  553. movzx ecx,cx
  554. mov es:[esi],ecx
  555. jmp exit
  556. ;-----------------------------------------------------------------------;
  557. ; uParam = INT
  558. ; lParam = LPSTR
  559. ;-----------------------------------------------------------------------;
  560. thk_PMI_PENTIP:
  561. thk_PMI_RGBFROMINDEX:
  562. thk_PMI_INDEXFROMRGB:
  563. push word ptr bp_uParam
  564. push dword ptr bp_lParam
  565. call MapLS
  566. mov dword ptr bp_lParam,eax
  567. push eax
  568. call GetPenMiscInfo
  569. cwde
  570. push eax
  571. push dword ptr bp_lParam
  572. call UnmapLS
  573. pop eax
  574. jmp exit
  575. thk_PMI_BEDIT:
  576. ;-----------------------------------------------------------------------;
  577. ; uParam = INT
  578. ; lParam = LPBOXEDITINFO
  579. ;-----------------------------------------------------------------------;
  580. ; bp+40 lpb
  581. ;-------------------------------------
  582. ; Temp storage
  583. xor eax,eax
  584. push eax ; ptr param #1 lpb
  585. ;-------------------------------------
  586. ; *** BEGIN parameter packing
  587. ; lpb
  588. ; pointer struct BOXEDITINFO --> struct BOXEDITINFO
  589. sub sp,84 ; lpb alloc space on stack
  590. ; different pointer types
  591. mov eax,[bp+40] ; base address
  592. or eax,eax
  593. jz L0 ; skip if null
  594. ; structures are not identical
  595. ; structures don't have pointers
  596. mov [bp-4],sp ; save offset to buffer
  597. mov [bp-2],ss ; save selector to buffer
  598. L0:
  599. ; *** END parameter packing
  600. ;-------------------------------------
  601. ; create new call frame and make the call
  602. ; lpb from: struct BOXEDITINFO
  603. push dword ptr [bp-4] ; to: struct BOXEDITINFO
  604. call GetPenMiscInfo ; call 16-bit version
  605. ; return code short --> long
  606. cwde
  607. ;-------------------------------------
  608. ; *** BEGIN parameter unpacking
  609. push eax ; save return code
  610. cld ; esi, edi will increment
  611. ; lpb
  612. ; pointer struct BOXEDITINFO --> struct BOXEDITINFO
  613. mov eax,[bp+40] ; base address
  614. or eax,eax
  615. jz L3 ; skip if null
  616. ; structures are not identical
  617. ; structures don't have pointers
  618. mov es,cs:THUNK16CodeData
  619. mov es,es:FlatData
  620. mov edi,eax ; es:edi == destination address
  621. mov si,ss
  622. mov ds,si
  623. movzx esi,word ptr [bp-4] ; ds:esi == source address
  624. ; cxBox
  625. ; short --> long
  626. lods word ptr ds:[esi]
  627. cwde
  628. stos dword ptr es:[edi]
  629. ; cyBox
  630. ; short --> long
  631. lods word ptr ds:[esi]
  632. cwde
  633. stos dword ptr es:[edi]
  634. ; cxBase
  635. ; short --> long
  636. lods word ptr ds:[esi]
  637. cwde
  638. stos dword ptr es:[edi]
  639. ; cyBase
  640. ; short --> long
  641. lods word ptr ds:[esi]
  642. cwde
  643. stos dword ptr es:[edi]
  644. ; cyMid
  645. ; short --> long
  646. lods word ptr ds:[esi]
  647. cwde
  648. stos dword ptr es:[edi]
  649. ; box
  650. ; struct BOXLAYOUT --> struct BOXLAYOUT
  651. ; cyCusp
  652. ; short --> long
  653. lods word ptr ds:[esi]
  654. cwde
  655. stos dword ptr es:[edi]
  656. ; cyEndCusp
  657. ; short --> long
  658. lods word ptr ds:[esi]
  659. cwde
  660. stos dword ptr es:[edi]
  661. ; style
  662. ; unsigned short --> unsigned long
  663. xor eax,eax
  664. lods word ptr ds:[esi]
  665. stos dword ptr es:[edi]
  666. ; dwReserved1
  667. ; unsigned long --> unsigned long
  668. movs dword ptr es:[edi],dword ptr ds:[esi] ; no conversion
  669. ; dwReserved2
  670. ; unsigned long --> unsigned long
  671. movs dword ptr es:[edi],dword ptr ds:[esi] ; no conversion
  672. ; dwReserved3
  673. ; unsigned long --> unsigned long
  674. movs dword ptr es:[edi],dword ptr ds:[esi] ; no conversion
  675. ; wFlags
  676. ; unsigned short --> unsigned short
  677. movs word ptr es:[edi],word ptr ds:[esi]
  678. ; szFaceName
  679. ; unsigned char[32] --> unsigned char[32]
  680. mov ecx,8
  681. rep movs dword ptr es:[edi],dword ptr ds:[esi]
  682. ; wFontHeight
  683. ; unsigned short --> unsigned long
  684. xor eax,eax
  685. lods word ptr ds:[esi]
  686. stos dword ptr es:[edi]
  687. ; rgwReserved
  688. ; unsigned char[16] --> unsigned char[16]
  689. mov ecx,4
  690. rep movs dword ptr es:[edi],dword ptr ds:[esi]
  691. L3:
  692. pop eax ; restore return code
  693. ; *** END parameter unpacking
  694. ;-------------------------------------
  695. ;--- No error checking.
  696. jmp exit
  697. exit:
  698. mov sp,bp
  699. endm
  700. body_SETPENMISCINFO macro
  701. local exit, error_exit, L0
  702. local anpfnGPI, MAX_ACTION
  703. local thk_PMI_BEDIT ;1
  704. ; local thk_PMI_IMECOLOR ;2
  705. local thk_PMI_CXTABLET ;3
  706. local thk_PMI_CYTABLET ;4
  707. local thk_PMI_COUNTRY ;5
  708. local thk_PMI_PENTIP ;6
  709. local thk_PMI_LENS ;7
  710. local thk_PMI_TIMEOUT ;8
  711. local thk_PMI_TIMEOUTGEST ;9
  712. local thk_PMI_TIMEOUTSEL ;10
  713. local thk_PMI_SYSFLAGS ;11
  714. local thk_PMI_INDEXFROMRGB ;12
  715. local thk_PMI_RGBFROMINDEX ;13
  716. bp_uParam equ <bp_top>
  717. bp_lParam equ <bp_top+4>
  718. ;BP=SP upon entry
  719. bp_pTmp equ <dword ptr [bp-4]>
  720. mov bx,word ptr bp_uParam
  721. cmp bx,MAX_ACTION
  722. ja error_exit
  723. add bx,bx
  724. jmp word ptr cs:anpfnGPI[bx]
  725. anpfnGPI label word
  726. dw offset error_exit
  727. dw offset thk_PMI_BEDIT ;1
  728. dw offset error_exit ;2 Deal with IME_COLOR later
  729. ; dw offset thk_PMI_IMECOLOR ;2
  730. dw offset thk_PMI_CXTABLET ;3
  731. dw offset thk_PMI_CYTABLET ;4
  732. dw offset thk_PMI_COUNTRY ;5
  733. dw offset thk_PMI_PENTIP ;6
  734. dw offset thk_PMI_LENS ;7
  735. dw offset thk_PMI_TIMEOUT ;8
  736. dw offset thk_PMI_TIMEOUTGEST ;9
  737. dw offset thk_PMI_TIMEOUTSEL ;10
  738. dw offset thk_PMI_SYSFLAGS ;11
  739. dw offset thk_PMI_INDEXFROMRGB ;12
  740. dw offset thk_PMI_RGBFROMINDEX ;13
  741. MAX_ACTION equ ($ - anpfnGPI)/2
  742. error_exit:
  743. sub eax,eax
  744. jmp exit
  745. ;-----------------------------------------------------------------------;
  746. ; uParam = UINT
  747. ; lParam = LPUINT
  748. ;-----------------------------------------------------------------------;
  749. thk_PMI_COUNTRY:
  750. thk_PMI_CXTABLET:
  751. thk_PMI_CYTABLET:
  752. thk_PMI_LENS:
  753. thk_PMI_SYSFLAGS:
  754. thk_PMI_TIMEOUT:
  755. thk_PMI_TIMEOUTGEST:
  756. thk_PMI_TIMEOUTSEL:
  757. thk_PMI_RGBFROMINDEX:
  758. thk_PMI_INDEXFROMRGB:
  759. mov eax, bp_lparam
  760. or eax,eax
  761. jz error_exit
  762. push word ptr bp_uParam
  763. push eax
  764. call SetPenMiscInfo
  765. cwde
  766. jmp exit
  767. ;-----------------------------------------------------------------------;
  768. ; uParam = INT
  769. ; lParam = PENTIP
  770. ;-----------------------------------------------------------------------;
  771. thk_PMI_PENTIP:
  772. push word ptr bp_uParam
  773. push dword ptr bp_lParam
  774. call MapLS
  775. mov dword ptr bp_lParam,eax
  776. push eax
  777. call SetPenMiscInfo
  778. cwde
  779. push eax
  780. push dword ptr bp_lParam
  781. call UnmapLS
  782. pop eax
  783. jmp exit
  784. thk_PMI_BEDIT:
  785. ;-----------------------------------------------------------------------;
  786. ; uParam = INT
  787. ; lParam = LPBOXEDITINFO
  788. ;-----------------------------------------------------------------------;
  789. ;===========================================================================
  790. ; bp+40 lpb
  791. ;-------------------------------------
  792. ; Temp storage
  793. xor eax,eax
  794. push eax ; ptr param #1 lpb
  795. ;-------------------------------------
  796. ; *** BEGIN parameter packing
  797. ; lpb
  798. ; pointer struct BOXEDITINFO --> struct BOXEDITINFO
  799. cld ; esi, edi will increment
  800. sub sp,84 ; lpb alloc space on stack
  801. ; different pointer types
  802. mov eax,[bp+40] ; base address
  803. or eax,eax
  804. jz L0 ; skip if null
  805. ; structures are not identical
  806. ; structures don't have pointers
  807. mov [bp-4],sp ; save offset to buffer
  808. mov [bp-2],ss ; save selector to buffer
  809. mov di,ss
  810. mov es,di
  811. movzx edi,sp ; es:edi == destination address
  812. mov esi,eax
  813. mov ds,cs:THUNK16CodeData ; need access to FlatData
  814. mov ds,FlatData ; ds:esi == source address
  815. ; cxBox
  816. ; long --> short
  817. lods dword ptr ds:[esi]
  818. stos word ptr es:[edi]
  819. ; cyBox
  820. ; long --> short
  821. lods dword ptr ds:[esi]
  822. stos word ptr es:[edi]
  823. ; cxBase
  824. ; long --> short
  825. lods dword ptr ds:[esi]
  826. stos word ptr es:[edi]
  827. ; cyBase
  828. ; long --> short
  829. lods dword ptr ds:[esi]
  830. stos word ptr es:[edi]
  831. ; cyMid
  832. ; long --> short
  833. lods dword ptr ds:[esi]
  834. stos word ptr es:[edi]
  835. ; box
  836. ; struct BOXLAYOUT --> struct BOXLAYOUT
  837. ; cyCusp
  838. ; long --> short
  839. lods dword ptr ds:[esi]
  840. stos word ptr es:[edi]
  841. ; cyEndCusp
  842. ; long --> short
  843. lods dword ptr ds:[esi]
  844. stos word ptr es:[edi]
  845. ; style
  846. ; unsigned long --> unsigned short
  847. lods dword ptr ds:[esi]
  848. stos word ptr es:[edi]
  849. ; dwReserved1
  850. ; unsigned long --> unsigned long
  851. movs dword ptr es:[edi],dword ptr ds:[esi] ; no conversion
  852. ; dwReserved2
  853. ; unsigned long --> unsigned long
  854. movs dword ptr es:[edi],dword ptr ds:[esi] ; no conversion
  855. ; dwReserved3
  856. ; unsigned long --> unsigned long
  857. movs dword ptr es:[edi],dword ptr ds:[esi] ; no conversion
  858. ; wFlags
  859. ; unsigned short --> unsigned short
  860. movs word ptr es:[edi],word ptr ds:[esi]
  861. ; szFaceName
  862. ; unsigned char[32] --> unsigned char[32]
  863. mov ecx,8
  864. rep movs dword ptr es:[edi],dword ptr ds:[esi]
  865. ; wFontHeight
  866. ; unsigned long --> unsigned short
  867. lods dword ptr ds:[esi]
  868. stos word ptr es:[edi]
  869. ; rgwReserved
  870. ; unsigned char[16] --> unsigned char[16]
  871. mov ecx,4
  872. rep movs dword ptr es:[edi],dword ptr ds:[esi]
  873. L0:
  874. ; *** END parameter packing
  875. ;-------------------------------------
  876. ; create new call frame and make the call
  877. ; lpb from: struct BOXEDITINFO
  878. push dword ptr [bp-4] ; to: struct BOXEDITINFO
  879. call SetPenMiscInfo ; call 16-bit version
  880. ; return code short --> long
  881. cwde
  882. ;-------------------------------------
  883. ;--- No error checking.
  884. jmp exit
  885. exit:
  886. mov sp,bp
  887. endm
  888. ;===========================================================================
  889. body_TARGETPOINTS macro
  890. local L0, L01, L1, L2, L3, L4, L5
  891. bp_lpTarg equ <[bp_top]> ; bp+40 lpTarg
  892. bp_rgPnt equ <[bp_top+4]> ; bp+44 rgPnt
  893. bp_rgOem equ <[bp_top+8]> ; bp+48 rgOem
  894. bp_fuOem equ <[bp_top+12]> ; bp+52 fuOem
  895. bp_lpsi equ <[bp_top+16]> ; bp+56 lpsi
  896. APILOG16 TARGETPOINTS, fApiLog16
  897. ;-------------------------------------
  898. ; Temp storage
  899. xor eax,eax
  900. push eax ; ptr param #2 rgPnt
  901. push eax ; handle param #2 rgPnt
  902. push eax ; ptr param #3 rgOem
  903. push eax ; ptr param #4 lpsi
  904. push eax ; ptr param #1 lpTarg
  905. ;-------------------------------------
  906. ; *** BEGIN parameter packing
  907. ; rgPnt
  908. ; pointer struct POINT --> struct POINT
  909. cld ; esi, edi will increment
  910. ; different pointer types
  911. mov eax,bp_rgPnt ; base address
  912. or eax,eax
  913. jz L0 ; skip if null
  914. ; structures are not identical
  915. ; structures don't have pointers
  916. mov ecx,dword ptr bp_lpsi ; lpsi
  917. push ds
  918. mov ds,cs:THUNK16CodeData
  919. mov es, FlatData
  920. mov ecx, es:[ecx+0] ;lpsi->cPnt
  921. pop ds
  922. or ecx,ecx
  923. jle L0 ; skip if count negative or zero
  924. mov ds,cs:THUNK16CodeData ; LocalAlloc needs this
  925. mov esi,eax
  926. push ecx ; will get trashed by LocalAlloc
  927. push byte ptr 0 ; alloc fixed
  928. lea eax,[ecx*4]
  929. push ax
  930. call LocalAlloc
  931. pop ecx
  932. or ax,ax ; did we get a handle?
  933. jz L0
  934. mov [bp-8],ax ; save handle
  935. MYLOCALLOCK ax
  936. or ax,ax ; did we get a near pointer?
  937. jz L0
  938. mov [bp-4],ax
  939. mov [bp-2],ds
  940. movzx edi,ax
  941. mov es,cs:THUNK16CodeData ; es:edi == destination
  942. mov ds,es:FlatData ; ds:esi == source
  943. L1:
  944. ; x
  945. ; long --> short
  946. lods dword ptr ds:[esi]
  947. stos word ptr es:[edi]
  948. ; y
  949. ; long --> short
  950. lods dword ptr ds:[esi]
  951. stos word ptr es:[edi]
  952. loop L1
  953. mov ds,cs:THUNK16CodeData ; es:edi == destination
  954. L0:
  955. ; lpTarg
  956. ; pointer void --> void
  957. ; same pointer types
  958. mov eax,bp_lpTarg ; base address
  959. or eax,eax
  960. jz L01 ; skip if null
  961. push eax
  962. ; cod3216x.c, 1003
  963. call MapLS
  964. mov [bp-20],eax
  965. L01:
  966. ; rgOem
  967. ; pointer void --> void
  968. ; same pointer types
  969. mov eax,bp_rgOem ; base address
  970. or eax,eax
  971. jz L2 ; skip if null
  972. push eax
  973. ; cod3216x.c, 1003
  974. call MapLS
  975. mov [bp-12],eax
  976. L2:
  977. ; lpsi
  978. ; pointer struct STROKEINFO --> struct STROKEINFO
  979. sub sp,12 ; lpsi alloc space on stack
  980. ; different pointer types
  981. mov eax,bp_lpsi ; base address
  982. or eax,eax
  983. jz L3 ; skip if null
  984. ; structures are not identical
  985. ; structures don't have pointers
  986. mov [bp-16],sp ; save offset to buffer
  987. mov [bp-14],ss ; save selector to buffer
  988. mov di,ss
  989. mov es,di
  990. movzx edi,sp ; es:edi == destination address
  991. mov esi,eax
  992. mov ds,cs:THUNK16CodeData ; need access to FlatData
  993. mov ds,FlatData ; ds:esi == source address
  994. ; cPnt
  995. ; unsigned long --> unsigned short
  996. lods dword ptr ds:[esi]
  997. stos word ptr es:[edi]
  998. ; cbPnts
  999. ; unsigned long --> unsigned short
  1000. lods dword ptr ds:[esi]
  1001. stos word ptr es:[edi]
  1002. ; wPdk
  1003. ; unsigned short --> unsigned short
  1004. movs word ptr es:[edi],word ptr ds:[esi]
  1005. ; dwTick
  1006. ; unsigned long --> unsigned long
  1007. movs dword ptr es:[edi],dword ptr ds:[esi] ; no conversion
  1008. L3:
  1009. ; *** END parameter packing
  1010. ;-------------------------------------
  1011. ; create new call frame and make the call
  1012. ; lpTarg
  1013. push dword ptr [bp-20] ;
  1014. ; rgPnt from: struct POINT
  1015. push dword ptr [bp-4] ; to: struct POINT
  1016. ; rgOem from: void
  1017. push dword ptr [bp-12] ; to: void
  1018. ; fuOem from: unsigned long
  1019. push word ptr bp_fuOem ; to unsigned short
  1020. ; lpsi from: struct STROKEINFO
  1021. push dword ptr [bp-16] ; to: struct STROKEINFO
  1022. call TargetPoints ; call 16-bit version
  1023. ; return code short --> long
  1024. cwde
  1025. ;-------------------------------------
  1026. ; *** BEGIN parameter unpacking
  1027. push eax ; save return code
  1028. ; rgPnt
  1029. mov ax,[bp-4] ; get pointer
  1030. or ax,ax
  1031. jz L4 ; no pointer, but might have handle
  1032. push word ptr [bp-8] ; push handle
  1033. call LocalUnlock
  1034. L4:
  1035. mov ax,[bp-8] ; get handle again
  1036. or ax,ax
  1037. jz L5
  1038. push ax
  1039. call LocalFree
  1040. L5:
  1041. pop eax ; restore return code
  1042. ; *** END parameter unpacking
  1043. push eax
  1044. push dword ptr [bp - 12]
  1045. call UnmapLS
  1046. push dword ptr [bp - 20] ; lpTarg
  1047. call UnmapLS
  1048. pop eax
  1049. ;-------------------------------------
  1050. ;--- If return value == -1, SetLastError(87)
  1051. ERRCHK_EXIT -2,87,Exit_20
  1052. endm;
  1053. ;===========================================================================
  1054. body_GETHOTSPOTSHRCRESULT macro
  1055. local L8, L9, L10, L11, L12, L13, L14
  1056. bp_hresult equ <[bp_top]> ; bp+40 hresult
  1057. bp_iSyv equ <[bp_top+4]> ; bp+44 iSyv
  1058. bp_rgPnt equ <[bp_top+8]> ; bp+48 rgPnt
  1059. bp_lphrgnArea equ <[bp_top+12]> ; bp+52 lphrgnArea
  1060. APILOG16 GETHOTSPOTSHRCRESULT, fApiLog16
  1061. ;-------------------------------------
  1062. ; Temp storage
  1063. xor eax,eax
  1064. push eax ; ptr param #1 rgPnt
  1065. push eax ; handle param #2 rgPnt
  1066. push eax ; ptr param #3 lphrgnArea
  1067. ;-------------------------------------
  1068. ; *** BEGIN parameter packing
  1069. ; rgPnt
  1070. ; pointer struct POINT --> struct POINT
  1071. ; different pointer types
  1072. mov eax,bp_rgPnt ; base address
  1073. or eax,eax
  1074. jz L8 ; skip if null
  1075. ; structures are not identical
  1076. ; structures don't have pointers
  1077. mov ecx,MAXHOTSPOT
  1078. mov ds,cs:THUNK16CodeData ; LocalAlloc needs this
  1079. push ecx ; will get trashed by LocalAlloc
  1080. push byte ptr 0 ; alloc fixed
  1081. lea eax,[ecx*4]
  1082. push ax
  1083. call LocalAlloc
  1084. pop ecx
  1085. or ax,ax ; did we get a handle?
  1086. jz L8
  1087. mov [bp-8],ax ; save handle
  1088. MYLOCALLOCK ax
  1089. or ax,ax ; did we get a pointer?
  1090. jz L8
  1091. mov [bp-4],ax
  1092. mov [bp-2],ds
  1093. L8:
  1094. ; lphrgnArea
  1095. ; pointer unsigned long --> unsigned short
  1096. ; different pointer types
  1097. mov eax,bp_lphrgnArea ; base address
  1098. or eax,eax
  1099. jz L9 ; skip if null
  1100. push eax
  1101. call MapLS
  1102. mov [bp-12],eax
  1103. L9:
  1104. ; *** END parameter packing
  1105. ;-------------------------------------
  1106. ; create new call frame and make the call
  1107. ; hresult from: unsigned long
  1108. push dword ptr bp_hresult ; to unsigned long
  1109. ; iSyv from: unsigned long
  1110. push word ptr bp_iSyv ; to unsigned short
  1111. ; rgPnt from: struct POINT
  1112. push dword ptr [bp-4] ; to: struct POINT
  1113. ; lphrgnArea from: unsigned long
  1114. push dword ptr [bp-12] ; to: unsigned short
  1115. call GetHotspotsHRCRESULT ; call 16-bit version
  1116. ; return code short --> long
  1117. cwde
  1118. ;-------------------------------------
  1119. ; *** BEGIN parameter unpacking
  1120. mov ecx,eax ; get the return count
  1121. push eax ; save return code
  1122. cld ; esi, edi will increment
  1123. ; rgPnt
  1124. ; pointer struct POINT --> struct POINT
  1125. mov eax,bp_rgPnt ; base address
  1126. or eax,eax
  1127. jz L12 ; skip if null
  1128. ; structures are not identical
  1129. ; structures don't have pointers
  1130. or ecx,ecx
  1131. jle L12 ; skip if count negative or zero
  1132. mov edi,eax
  1133. movzx esi,word ptr [bp-4]
  1134. or si,si
  1135. jz L10
  1136. mov ds,cs:THUNK16CodeData ; ds:esi = src
  1137. mov es,FlatData ; es:edi = dst
  1138. L13:
  1139. ; x
  1140. ; short --> long
  1141. lods word ptr ds:[esi]
  1142. cwde
  1143. stos dword ptr es:[edi]
  1144. ; y
  1145. ; short --> long
  1146. lods word ptr ds:[esi]
  1147. cwde
  1148. stos dword ptr es:[edi]
  1149. loop L13
  1150. ; rgPnt
  1151. L10:
  1152. mov ax,[bp-4] ; get pointer
  1153. or ax,ax
  1154. jz L11 ; no pointer, but might have handle
  1155. push word ptr [bp-8] ; push handle
  1156. call LocalUnlock
  1157. L11:
  1158. mov ax,[bp-8] ; get handle again
  1159. or ax,ax
  1160. jz L14
  1161. push ax
  1162. call LocalFree
  1163. L14:
  1164. L12:
  1165. pop eax ; restore return code
  1166. ; *** END parameter unpacking
  1167. push eax
  1168. push dword ptr [bp - 12]
  1169. call UnmapLS
  1170. pop eax
  1171. ;-------------------------------------
  1172. ;--- No error checking.
  1173. jmp Exit_16
  1174. endm;