分享
 
 
 

Pcode粗略分析(1)

王朝c#·作者佚名  2006-12-17
窄屏简体版  字體: |||超大  

分析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->msvbvm60.rtcMsgBox

|

:004018BB 0A01001400 ImpAdCallFPR4 ;Call ptr_00401020; check stack 0014; Push EAX //调用MsgBox

{MsgBox z, vbOKOnly, "pcode"}

:004018C0 36060044FF24FF04 FFreeVar ;Free 0006/2 variants //释放变量

:004018C9 13 ExitProcHresult ; //退出程序

:004018CA 0000 LargeBos ;IDE beginning of line with 00 byte codes

分析3:

Private Declare Function MessageBox Lib "user32" Alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long

Const MB_OK = &H0&

Private Sub Command1_Click()

Dim x As Integer, y As Integer, z As Integer

x = 123

y = 321

z = x + y

MessageBox Me.hwnd, "sum=" & z, "pcode", MB_OK

End Sub

[Command1.Click]

:004018FC F47B LitI2_Byte ;Push 7B //123入栈

:004018FE 707AFF FStI2 ;Pop WORD [LOCAL_0086] //弹出0086操作数

{x = 123}

:00401901 F34101 LitI2 ;Push 0141 //321入栈

:00401904 7078FF FStI2 ;Pop WORD [LOCAL_0088] //弹出0088操作数

{x = 123}

:00401907 6B7AFF FLdI2 ;Push WORD [LOCAL_0086] //ADD第一个参数入栈

:0040190A 6B78FF FLdI2 ;Push WORD [LOCAL_0088] //ADD第二个参数入栈

:0040190D A9 AddI2 ; /ADD

{z = x + y}

:0040190E 7076FF FStI2 ;Pop WORD [LOCAL_008A] //SUM出栈待用

:00401911 0470FF FLdRfVar ;Push LOCAL_0090 //将地址入栈,记录地址

:00401914 080800 FLdPr ;[SR]=[STACK_0008]

:00401917 0D58000000 VCallHresult ;Call ptr_004014CC //这里应该是调用Me.hwnd,保存在0090

==================//MsgBox原形

int MessageBox(

HWND hWnd, // handle of owner window

LPCTSTR lpText, // address of text in message box

LPCTSTR lpCaption, // address of title of message box

UINT uType // style of message box

);

==================//下面是参数入栈

:0040191C F500000000 LitI4 ;Push 00000000 //uType,参数一

******Possible String Ref To->"pcode"

|

:00401921 1B0100 LitStr ;Push ptr_00401624 //装入"pcode"字符

:00401924 0460FF FLdRfVar ;Push LOCAL_00A0

:00401927 34 CStr2Ansi ;vbaStrToAnsi //把Unicode形式转换为Ansi

:00401928 6C60FF ILdRf ;Push DWORD [LOCAL_00A0] //lpCaption,参数二

******Possible String Ref To->"sum="

|

:0040192B 1B0200 LitStr ;Push ptr_00401614 //装入"sum="字符

:0040192E 6B76FF FLdI2 ;Push WORD [LOCAL_008A] //参数SUM入栈

:00401931 FBFD CStrUI1 ;vbaStrI2 //将整数转换为字符型,保存在0094

:00401933 236CFF FStStrNoPop ;SysFreeString [LOCAL_0094]; [LOCAL_0094]=[stack]

:00401936 2A ConcatStr ;vbaStrCat //连接字符,保存在0098

:00401937 2368FF FStStrNoPop ;SysFreeString [LOCAL_0098]; [LOCAL_0098]=[stack]

:0040193A 0464FF FLdRfVar ;Push LOCAL_009C //将地址入栈,记录地址

:0040193D 34 CStr2Ansi ;vbaStrToAnsi //把Unicode形式转换为Ansi

:0040193E 6C64FF ILdRf ;Push DWORD [LOCAL_009C] //lpText,参数三

:00401941 6C70FF ILdRf ;Push DWORD [LOCAL_0090] //hWnd,参数四

***********Reference To:user32.MessageBoxA

|

:00401944 0A03001000 ImpAdCallFPR4 ;Call ptr_004015E8; check stack 0010; Push EAX //调用MessageBox

:00401949 3C SetLastSystemError ;Kernel GetLastError //针对调用MessageBox函数,取得扩展错误信息

:0040194A 3208006CFF68FF64 FFreeStr ;Do SysFreeString [arg_n]; [arg_n]=0 0008/2 times ~ arg

:00401955 13 ExitProcHresult ;

:00401956 0000 LargeBos ;IDE beginning of line with 00 byte codes

Moodsky[DFCG]

2005.02.01

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有