windows-nt/Source/XPSP1/NT/base/mvdm/thunk/thkframe.inc

132 lines
4.8 KiB
PHP
Raw Permalink Normal View History

2020-09-26 03:20:57 -05:00
;-----------------------------------------------------------------------;
; Picture of stack upon entering 32-bit half of WNDPROC callback:
;
; +-----------------------+
; | callback parameters |
; +-----------------------+
; | retf to Win3.0 |
; | |
; +-----------------------+
; | 32-bit pfn |
; | |
; +-----------------------+
; | iCallbackType |
; | |
; +-----------------------+
; | bp | <-- bp/ebp, references up
; +-----------------------+
; | si |
; +-----------------------+
; | di |
; +-----------------------+
; | ds | <-- si/esi, references down if necessary
; +-----------------------+
; | THKSPACE16 | if necessary
; +-----------------------+
; | MSGSTRUCT | if necessary
; +-----------------------+
; | repacked structure(s) | if necessary
; +-----------------------+
; | retf to thunk cleanup | if necessary
; | |
; +-----------------------+
; | ss, sp | <-- ebx, references saved ss:sp
; | |
; +-----------------------+
; | dword alignment pad | if necessary
; +-----------------------+
;-----------------------------------------------------------------------;
;-----------------------------------------------------------------------;
; Picture of stack upon entering 32-bit half of non-WNDPROC callback:
;
; +-----------------------+
; | callback parameters |
; +-----------------------+
; | retf to Win3.0 |
; | |
; +-----------------------+
; | 32-bit pfn |
; | |
; +-----------------------+
; | iCallbackType |
; | |
; +-----------------------+
; | bp | <-- bp/ebp, references up
; +-----------------------+
; | si |
; +-----------------------+
; | di |
; +-----------------------+
; | ds |
; +-----------------------+
; | ss, sp | <-- ebx, references saved ss:sp
; | |
; +-----------------------+
; | dword alignment pad | if necessary
; +-----------------------+
;-----------------------------------------------------------------------;
;-----------------------------------------------------------------------;
; ParameterFrame
;
; base
; The register on which to base addresses.
;
; Define the parameter frame for 16->32 callbacks. This should match
; the picture above.
;-----------------------------------------------------------------------;
ParameterFrame macro base
base&_pParams equ < [base+14]>
;retf <dword ptr [base+10]>
base&_pCallback32 equ <dword ptr [base+ 6]>
base&_iCallbackType equ <dword ptr [base+ 2]>
;bp < word ptr [base+ 0]>
;si < word ptr [base- 2]>
;di < word ptr [base- 4]>
;ds < word ptr [base- 6]>
;ss,sp <dword ptr [base-10]>
base&_addr_registers equ < [base-10]>
endm
;-----------------------------------------------------------------------;
; LocalFrame
;
; base
; The register on which to base addresses.
;
; segovr
; The segment override necessary, if any.
;
; Define the local variable frame. The variables will be accessed via
; the THKSPACE16 structure offsets. The base&_cleanup label is used
; for discarding the local variables and any extra space used by the
; thunk.
;-----------------------------------------------------------------------;
LocalFrame macro base, segovr
base&_cleanup equ <dword ptr segovr&[base]>
base&_space equ < segovr&[base - (size THKSPACE16)]>
endm
ParameterFrame ebp
LocalFrame esi
ParameterFrame bp
LocalFrame bp
LocalFrame si, ss:
LocalFrame bx, ss:
;-----------------------------------------------------------------------;
;Equates related to stack frame setup by thunk-compiler generated
;dispatcher.
;-----------------------------------------------------------------------;
ifdef FSAVEALL
offsetThkParams equ 72 ;must match value generated by thunk.exe
else
offsetThkParams equ 40 ;must match value generated by thunk.exe
endif
bp_top equ <[bp+offsetThkParams]>
bx_top equ <ss:[bx+offsetThkParams]>