小小的ret汇编指令大有文章,找到ret的一段ret宏,可管中窥豹:)
macro ret AddEspNum
{
if ~ AddEspNum eq 0 ; return value
if (AddEspNum mod 4)<>0 ; 32-bit cpu
.err
end if
lea esp, [esp+(AddEspNum+4)]
jmp dword [esp-(AddEspNum+4)] ; skip AddEspNum bits stack value, and jump to next instruction
else
sub esp, -4
jmp dword [esp-4] ; no return value, jump to next instruction
end if
}