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.

92 lines
3.2 KiB

  1. ; DWORD CallCPLEntry16(UINT hinst, DWORD lpfnEntry,
  2. ; HWND hwndCPL, UINT msg,
  3. ; DWORD lParam1, DWORD lParam2)
  4. BODYQT_CALLCPLENTRY16 macro index
  5. local CPL_afMapping
  6. local do_callcplentry16
  7. local apm_map_explicit
  8. local before_call
  9. local call_the_bugger
  10. local no_unmapping
  11. hinst equ <[ebp_qttop]>
  12. lpfnEntry equ <[ebp_qttop+4]>
  13. hwndCPL equ <[ebp_qttop+8]>
  14. msg equ <[ebp_qttop+12]>
  15. lParam1 equ <[ebp_qttop+16]>
  16. lParam2 equ <[ebp_qttop+20]>
  17. ; skip past our table below to the meat of the routine
  18. jmp do_callcplentry16
  19. ;
  20. ; This table indicates whether we need to thunk lParam2 or not.
  21. ;
  22. CPL_afMapping label byte
  23. db 0 ; CPL_INIT
  24. db 0 ; CPL_GETCOUNT
  25. db 1 ; CPL_INQUIRE int, LPCPINFO
  26. db 0 ; CPL_SELECT int, DWORD
  27. db 0 ; CPL_DBLCLK int, DWORD
  28. db 0 ; CPL_STOP int, DWORD
  29. db 0 ; CPL_EXIT
  30. db 1 ; CPL_NEWINQUIRE int, LPNEWCPLINFO
  31. db 1 ; CPL_STARTWPARAMS int, LPSTR
  32. CPL_MAX equ ($-CPL_afMapping)
  33. apm_map_explicit:
  34. inc ecx ;explicitly set mapping flag
  35. jmp before_call
  36. do_callcplentry16:
  37. xor ecx, ecx ;ecx controls pointer mapping, init 0
  38. mov edx, dword ptr msg ;message index so we can decide
  39. ; HACK: OEM APM extensions use entrypoints identical to CPlApplet,
  40. ; but have msgs needing special care. Caller sets bit 15
  41. ; (0x8000) on these msgs. Both msgs needing special care
  42. ; map identically to CPL_NEWINQUIRE
  43. test edx, 8000h ;special APM msg?
  44. jnz apm_map_explicit ;we will need to map
  45. ; use table above to determine mapping, assumes ecx is still zero
  46. dec edx ;the table is 0 based
  47. cmp edx, CPL_MAX ;check for index within table
  48. jnc before_call ;let it through with no mapping
  49. ; move the correct mapping flag from our table into ecx
  50. mov cl, byte ptr cs:[edx + CPL_afMapping]
  51. before_call:
  52. push ecx ;save mapping flag for thunk return
  53. jcxz call_the_bugger ;skip mapping if it's zero
  54. ; map lParam2 to 16:16
  55. push dword ptr lParam2
  56. call MapLS
  57. mov dword ptr lParam2, eax ;pass mapped result instead
  58. call_the_bugger:
  59. push word ptr hinst ;hinst: dword->word
  60. push dword ptr lpfnEntry ;lpfnEntry: dword->dword
  61. push word ptr hwndCPL ;hwndCPL: dword->word
  62. push word ptr msg ;msg: dword->word
  63. push dword ptr lParam1 ;lParam1: dword->dword
  64. push dword ptr lParam2 ;lParam2: dword->dword
  65. mov cl,index ;thunk index
  66. call QT_Call16_DWordToDWord
  67. pop ecx ;restore mapping flag from above
  68. jcxz no_unmapping ;skip unmapping if it's zero
  69. ; free 16:16 mapping for lParam2
  70. push eax ;save CplApplet return value
  71. push dword ptr lParam2
  72. call UnMapLS
  73. pop eax ;restore CplApplet return value
  74. no_unmapping:
  75. endm