调用Windows函数ASM(PUSH / POP问题) [英] Calling windows functions in ASM (push/pop question)

查看:112
本文介绍了调用Windows函数ASM(PUSH / POP问题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要呼吁ASM的睡眠功能。所以我写了以下内容:

I want to call the Sleep function on ASM. So I wrote the following:

push 5000
call Sleep

虽然一切正常,我有这样每次我压入堆栈的值的想法,我也应该弹出它(否则它会得到所有后面的程序混乱?)。我应该弹出呢?我应该怎么办呢?

Although everything went fine, I had the idea that everytime I pushed a value on the stack, I should also pop it(otherwise it'd get all cluttered later in the program?). Should I pop it? How should I do it?

推荐答案

几乎所有的Win32 API函数使用的 __ STDCALL 调用约定,其中的调用的函数的负责弹出参数(S)从栈。所以在的情况下,睡眠(),你不必做任何事情比你已经证明什么。

Virtually all Win32 API functions use the __stdcall calling convention, where the called function is responsible for popping the argument(s) off the stack. So in the case of Sleep(), you don't have to do anything else than what you've shown.

这篇关于调用Windows函数ASM(PUSH / POP问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆