include vmm.inc
ArgVar varname, size, used
Declares a stack argument for a procedure.
This macro is used in writing assembly-language procedures which use the C, Pascal, or StdCall calling convention.
If the variable is a WORD, then two additional symbols are defined: varnameL refers to the low byte and varnameH refers to the high byte. If the variable is a DWORD, then six additional symbols are defined: varnameL refers to the low word, varnameLL to the low byte of the low word, varnameLH to the high byte of the low word, varnameH to the high word, varnameHL to the low byte of the high word, and varnameHH to the high byte of the high word.
When the EndProc is reached, the names of all ArgVar variables are set to an intentionally undefined symbol so that they cannot be used by accident later. (This behavior can be overridden by using the KEEPFRAMEVARS attribute on EndProc.) Here is an example procedure that uses these macros. The example procedure doesn't do anything interesting, but it illustrates the proper use of the macros.
BeginProc MyProc, CCALL
ArgVar Param1, DWORD
ArgVar Param2, WORD
ArgVar Param3, 12 ; third parameter is a 12-byte structure,
; passed by value
LocalVar Local1, DWORD
LocalVar Local2, <size FOO>
EnterProc
SaveReg <ebx, esi>
lea eax, Local2 ; eax now points to a FOO structure on the stack
mov cx, Param2 ; cx contains the value of Param2
mov Local1LL, ch ; Store ch into the low byte of the low
; word of Local1
lea edx, Param3 ; edx points to the 128-byte structure on the stack
RestoreReg <esi, ebx>
LeaveProc
Return
EndProc MyProc
The above example illustrates several important points.
Debug_Test_Valid_Handle