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.

131 lines
4.8 KiB

  1. ;-----------------------------------------------------------------------;
  2. ; Picture of stack upon entering 32-bit half of WNDPROC callback:
  3. ;
  4. ; +-----------------------+
  5. ; | callback parameters |
  6. ; +-----------------------+
  7. ; | retf to Win3.0 |
  8. ; | |
  9. ; +-----------------------+
  10. ; | 32-bit pfn |
  11. ; | |
  12. ; +-----------------------+
  13. ; | iCallbackType |
  14. ; | |
  15. ; +-----------------------+
  16. ; | bp | <-- bp/ebp, references up
  17. ; +-----------------------+
  18. ; | si |
  19. ; +-----------------------+
  20. ; | di |
  21. ; +-----------------------+
  22. ; | ds | <-- si/esi, references down if necessary
  23. ; +-----------------------+
  24. ; | THKSPACE16 | if necessary
  25. ; +-----------------------+
  26. ; | MSGSTRUCT | if necessary
  27. ; +-----------------------+
  28. ; | repacked structure(s) | if necessary
  29. ; +-----------------------+
  30. ; | retf to thunk cleanup | if necessary
  31. ; | |
  32. ; +-----------------------+
  33. ; | ss, sp | <-- ebx, references saved ss:sp
  34. ; | |
  35. ; +-----------------------+
  36. ; | dword alignment pad | if necessary
  37. ; +-----------------------+
  38. ;-----------------------------------------------------------------------;
  39. ;-----------------------------------------------------------------------;
  40. ; Picture of stack upon entering 32-bit half of non-WNDPROC callback:
  41. ;
  42. ; +-----------------------+
  43. ; | callback parameters |
  44. ; +-----------------------+
  45. ; | retf to Win3.0 |
  46. ; | |
  47. ; +-----------------------+
  48. ; | 32-bit pfn |
  49. ; | |
  50. ; +-----------------------+
  51. ; | iCallbackType |
  52. ; | |
  53. ; +-----------------------+
  54. ; | bp | <-- bp/ebp, references up
  55. ; +-----------------------+
  56. ; | si |
  57. ; +-----------------------+
  58. ; | di |
  59. ; +-----------------------+
  60. ; | ds |
  61. ; +-----------------------+
  62. ; | ss, sp | <-- ebx, references saved ss:sp
  63. ; | |
  64. ; +-----------------------+
  65. ; | dword alignment pad | if necessary
  66. ; +-----------------------+
  67. ;-----------------------------------------------------------------------;
  68. ;-----------------------------------------------------------------------;
  69. ; ParameterFrame
  70. ;
  71. ; base
  72. ; The register on which to base addresses.
  73. ;
  74. ; Define the parameter frame for 16->32 callbacks. This should match
  75. ; the picture above.
  76. ;-----------------------------------------------------------------------;
  77. ParameterFrame macro base
  78. base&_pParams equ < [base+14]>
  79. ;retf <dword ptr [base+10]>
  80. base&_pCallback32 equ <dword ptr [base+ 6]>
  81. base&_iCallbackType equ <dword ptr [base+ 2]>
  82. ;bp < word ptr [base+ 0]>
  83. ;si < word ptr [base- 2]>
  84. ;di < word ptr [base- 4]>
  85. ;ds < word ptr [base- 6]>
  86. ;ss,sp <dword ptr [base-10]>
  87. base&_addr_registers equ < [base-10]>
  88. endm
  89. ;-----------------------------------------------------------------------;
  90. ; LocalFrame
  91. ;
  92. ; base
  93. ; The register on which to base addresses.
  94. ;
  95. ; segovr
  96. ; The segment override necessary, if any.
  97. ;
  98. ; Define the local variable frame. The variables will be accessed via
  99. ; the THKSPACE16 structure offsets. The base&_cleanup label is used
  100. ; for discarding the local variables and any extra space used by the
  101. ; thunk.
  102. ;-----------------------------------------------------------------------;
  103. LocalFrame macro base, segovr
  104. base&_cleanup equ <dword ptr segovr&[base]>
  105. base&_space equ < segovr&[base - (size THKSPACE16)]>
  106. endm
  107. ParameterFrame ebp
  108. LocalFrame esi
  109. ParameterFrame bp
  110. LocalFrame bp
  111. LocalFrame si, ss:
  112. LocalFrame bx, ss:
  113. ;-----------------------------------------------------------------------;
  114. ;Equates related to stack frame setup by thunk-compiler generated
  115. ;dispatcher.
  116. ;-----------------------------------------------------------------------;
  117. ifdef FSAVEALL
  118. offsetThkParams equ 72 ;must match value generated by thunk.exe
  119. else
  120. offsetThkParams equ 40 ;must match value generated by thunk.exe
  121. endif
  122. bp_top equ <[bp+offsetThkParams]>
  123. bx_top equ <ss:[bx+offsetThkParams]>