日期:2008-06-12  浏览次数:20669 次

分析1:

Private Sub Command1_Click()
Dim x As Integer, y As Integer, z As Integer

x = 123
y = 321
z = x + y
MsgBox z

End Sub

[Command1.Click]
:00401874 F47B LitI2_Byte ;Push 7B //123入栈
:00401876 707AFF FStI2 ;Pop word [LOCAL_0086] //弹出0086操作数
//整形占2个字
{x=123}
:00401879 F34101 LitI2 ;Push 0141 //321入栈
:0040187C 7078FF FStI2 ;Pop word [LOCAL_0088] //弹出0088操作数
//正好是0086+2,说明内存写时是连续的
{y=321}
:0040187F 6B7AFF FLdI2 ;Push word [LOCAL_0086] //f?load?i2应该是integer
:00401882 6B78FF FLdI2 ;Push word [LOCAL_0088] //继续第二个参数入栈
:00401885 A9 AddI2 ; //整数相加,保存在0088+2
{z = x + y}
:00401886 7076FF FStI2 ;Pop word [LOCAL_008A] //SUM出栈待用

================ //MsgBox原形
MsgBox(prompt[, buttons] [, title] [, helpfile, context])
================

:00401889 2704FF LitVar ;PushVar LOCAL_00FC //未负值参数,context
:0040188C 2724FF LitVar ;PushVar LOCAL_00DC //未负值参数,helpfile
:0040188F 2744FF LitVar ;PushVar LOCAL_00BC //未负值参数,title
:00401892 F500000000 LitI4 ;Push 00000000 //buttons 缺省值为 0
:00401897 0476FF FLdRfVar ;Push LOCAL_008A //prompt,作为显示在对话框中的消息.
:0040189A 4D64FF0240 CVarRef ;

**********Reference To->msvbvm60.rtcMsgBox
|
:0040189F 0A00001400 ImpAdCallFPR4 ;Call ptr_00401020; check stack 0014; Push EAX //调用MsgBox
{MsgBox z}
:004018A4 36060044FF24FF04 FFreeVar ;Free 0006/2 variants //释放变量
:004018AD 13 ExitProcHresult ; //退出程序

分析2:

Private Sub Command1_Click()
Dim x As Integer, y As Integer, z As Integer
x = 123
y = 321
z = x + y
MsgBox z, vbOKOnly, "pcode"

End Sub

[Command1.Click]

:00401888 F47B LitI2_Byte ;Push 7B //123入栈
:0040188A 707AFF FStI2 ;Pop word [LOCAL_0086] //弹出0086操作数
{x=123}
:0040188D F34101 LitI2 ;Push 0141 //321入栈
:00401890 7078FF FStI2 ;Pop word [LOCAL_0088] //弹出0088操作数
{y=321}
:00401893 6B7AFF FLdI2 ;Push word [LOCAL_0086] //ADD第一个参数入栈
:00401896 6B78FF FLdI2 ;Push word [LOCAL_0088] //ADD第二个参数入栈
:00401899 A9 AddI2 ; //ADD
{z = x + y}
:0040189A 7076FF FStI2 ;Pop word [LOCAL_008A] //SUM出栈待用
:0040189D 2704FF LitVar ;PushVar LOCAL_00FC //未负值参数,context
:004018A0 2724FF LitVar ;PushVar LOCAL_00DC //未负值参数,helpfile
******Possible String Ref To->"pcode"
|
:004018A3 3A54FF0000 LitVarStr ;PushVarString ptr_004013C8 //"pcode"入栈
:004018A8 4E44FF FStVarCopyObj ;[LOCAL_00BC]=vbaVarDup(Pop) //地址负值
:004018AB 0444FF FLdRfVar ;Push LOCAL_00BC //title果然被负值,看来分析并没有错误
:004018AE F500000000 LitI4 ;Push 00000000 //buttons 缺省值为 0
:004018B3 0476FF FLdRfVar ;Push LOCAL_008A //prompt,SUM
:004018B6 4D64FF0240 CVarRef ;
**********Reference To