简单的装配问题 [英] Simple assembly questions

查看:162
本文介绍了简单的装配问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

; int __stdcall wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd)
_wWinMain@16 proc near

var_4= dword ptr -4
hInstance= dword ptr  4
hPrevInstance= dword ptr  8
lpCmdLine= dword ptr  0Ch
nShowCmd= dword ptr  10h


$ b b从我可以看到,最后4个变量是传递给WinMain函数的参数。另外,var_4必须是稍后在函数体中声明的int变量。现在,我有几个问题:

From what I can see, the last 4 variables are the parameters passed to the WinMain function. Also, the var_4 must be a int variable I declared later in the function body. Now, I have a couple of questions:

a)32位Windows程序上的字的大小是多少? 4字节? a dword 8?

a) What is the size of a word on a 32bit windows program? 4 bytes? being a dword 8?

b)为什么var_4设置为-4?为什么不从0开始?

b) Why is var_4 set to -4? Why not start at, let's say, 0?

c)在c中定义int的标准过程是

c) The standard procedure for defining ints in c is though

var_x = dword ptr y?

var_x = dword ptr y?

谢谢。

推荐答案

。 DWORD未签署,32位:请参阅此处 (旧名称,MS在Windows为16位时开始使用它。)

a. DWORD is unsigned, 32 bit: see here (old name, MS started using it back when Windows was 16-bit).

b。堆栈顶部(dword ptr 0)由返回地址

b. the top of stack (dword ptr 0) is taken up by the return-address

c占用。一个变量 y 这里不工作。无论如何, dword ptr 的系统使用是某些汇编程序和反汇编程序的特性,而不是标准过程。

c. a variable y here would not work. Anyway, this systematic use of dword ptr is characteristic of certain assemblers and disassemblers, not a "standard procedure".

这篇关于简单的装配问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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