我对堆栈里的参数不是很懂,比如[EBP-50]之类不懂,你们怎么知道这是第几个参数呢?
罗云彬编的32位汇编我大概看得懂,但是反汇编后大部分看不懂?
----------------------------
00401000 /. 55 PUSH EBP ; 保护现场原先的EBP指针
00401001 |. 8BEC MOV EBP,ESP ; 设置新的EBP指针,指向栈顶
00401003 |. 83C4 AC ADD ESP,-54 ; 在堆栈中留出点空间放局部变量
00401006 |. 53 PUSH EBX ; 参数3压入堆栈
00401007 |. 57 PUSH EDI ; 参数2压入堆栈
00401008 |. 56 PUSH ESI ; 参数1压入堆栈
00401009 |. 8B45 0C MOV EAX,DWORD PTR SS:[EBP+C] ; 把消息放入EAX
0040100C |. 83F8 0F CMP EAX,0F ; 跟消息比较
0040100F |. 75 3E JNZ SHORT FirstWin.0040104F ; 不相等则跳转
00401011 |. 8D45 C0 LEA EAX,DWORD PTR SS:[EBP-40] ; 把第一个局部变量的地址赋给EAX
00401014 |. 50 PUSH EAX ; /pPaintstruct
00401015 |. FF75 08 PUSH DWORD PTR SS:[EBP+8] ; |hWnd
00401018 |. E8 53010000 CALL <JMP.&user32.BeginPaint> ; \BeginPaint
0040101D |. 8945 AC MOV DWORD PTR SS:[EBP-54],EAX ; 保存句柄
00401020 |. 8D45 B0 LEA EAX,DWORD PTR SS:[EBP-50] ; 把第二个局部变量的地址赋于EAX
00401023 |. 50 PUSH EAX ; /pRect
00401024 |. FF75 08 PUSH DWORD PTR SS:[EBP+8] ; |hWnd
00401027 |. E8 6E010000 CALL <JMP.&user32.GetClientRect> ; \GetClientRect
0040102C |. 6A 25 PUSH 25 ; /Flags = DT_CENTER|DT_VCENTER|DT_SINGLELINE
0040102E |. 8D45 B0 LEA EAX,DWORD PTR SS:[EBP-50] ; |把第二个局部变量的地址赋于EAX
00401031 |. 50 PUSH EAX ; |pRect
00401032 |. 6A FF PUSH -1 ; |Count = FFFFFFFF (-1.)
00401034 |. 68 6A204000 PUSH FirstWin.0040206A ; |win32 assembly, simple and powerful !
00401039 |. FF75 AC PUSH DWORD PTR SS:[EBP-54] ; |hDC
0040103C |. E8 4D010000 CALL <JMP.&user32.DrawTextA> ; \DrawTextA
00401041 |. 8D45 C0 LEA EAX,DWORD PTR SS:[EBP-40] ; ????????这里不懂啊,[EBP-40]是哪个参数啊
00401044 |. 50 PUSH EAX ; /pPaintstruct
00401045 |. FF75 08 PUSH DWORD PTR SS:[EBP+8] ; |hWnd
00401048 |. E8 47010000 CALL <JMP.&user32.EndPaint> ; \EndPaint
0040104D |. EB 31 JMP SHORT FirstWin.00401080
0040104F |> 83F8 10 CMP EAX,10
00401052 |. 75 14 JNZ SHORT FirstWin.00401068
00401054 |. FF35 04304000 PUSH DWORD PTR DS:[403004] ; /hWnd = NULL
0040105A |. E8 23010000 CALL <JMP.&user32.DestroyWindow> ; \DestroyWindow
0040105F |. 6A 00 PUSH 0 ; /ExitCode = 0
00401061 |. E8 46010000 CALL <JMP.&user32.PostQuitMessage> ; \PostQuitMessage
00401066 |. EB 18 JMP SHORT FirstWin.00401080
00401068 |> FF75 14 PUSH DWORD PTR SS:[EBP+14] ; /lParam
0040106B |. FF75 10 PUSH DWORD PTR SS:[EBP+10] ; |wParam
0040106E |. FF75 0C PUSH DWORD PTR SS:[EBP+C] ; |Message
00401071 |. FF75 08 PUSH DWORD PTR SS:[EBP+8] ; |hWnd
00401074 |. E8 03010000 CALL <JMP.&user32.DefWindowProcA> ; \DefWindowProcA
00401079 |. 5E POP ESI
0040107A |. 5F POP EDI
0040107B |. 5B POP EBX
0040107C |. C9 LEAVE
0040107D |. C2 1000 RETN 10
00401080 |> 33C0 XOR EAX,EAX
00401082 |. 5E POP ESI
00401083 |. 5F POP EDI
00401084 |. 5B POP EBX
00401085 |. C9 LEAVE
00401086 \. C2 1000 RETN 10
00401089 /$ 55 PUSH EBP ; 保护现场原先的EBP指针
0040108A |. 8BEC MOV EBP,ESP ; 设置新的EBP指针,指向栈顶
0040108C |. 83C4 B4 ADD ESP,-4C ; 在堆栈中留出点空间放局部变量,为什么这里跟00401003不一样呢
0040108F |. 6A 00 PUSH 0 ; /pModule = NULL
00401091 |. E8 3A010000 CALL <JMP.&kernel32.GetModuleHandleA> ; \GetModuleHandleA
00401096 |. A3 00304000 MOV DWORD PTR DS:[403000],EAX ; 获得模块句柄
0040109B |. 6A 30 PUSH 30 ; /Length = 30 (48.)
0040109D |. 8D45 D0 LEA EAX,DWORD PTR SS:[EBP-30] ; |?????这里不懂,只知道是传地址,但[EBP-30]是指什么?
004010A0 |. 50 PUSH EAX ; |Destination
004010A1 |. E8 30010000 CALL <JMP.&kernel32.RtlZeroMemory> ; \RtlZeroMemory
004010A6 |. 68 007F0000 PUSH 7F00 ; /RsrcName = IDC_ARROW
004010AB |. 6A 00 PUSH 0 ; |hInst = NULL
004010AD |. E8 F4000000 CALL <JMP.&user32.LoadCursorA> ; \LoadCursorA
004010B2 |. 8945 EC MOV DWORD PTR SS:[EBP-14],EAX ; 获取光标句柄
004010B5 |. FF35 00304000 PUSH DWORD PTR DS:[403000] ; FirstWin.00400000
004010BB |. 8F45 E4 POP DWORD PTR SS:[EBP-1C]
004010BE |. C745 D0 30000>MOV DWORD PTR SS:[EBP-30],30 ; ????[EBP-30]这些地址是怎么来的?
004010C5 |. C745 D4 03000>MOV DWORD PTR SS:[EBP-2C],3
004010CC |. C745 D8 00104>MOV DWORD PTR SS:[EBP-28],FirstWin.00401>
004010D3 |. C745 F0 06000>MOV DWORD PTR SS:[EBP-10],6
004010DA |. C745 F8 50204>MOV DWORD PTR SS:[EBP-8],FirstWin.004020>; myclass
004010E1 |. 8D45 D0 LEA EAX,DWORD PTR SS:[EBP-30] ; 把stWndClass的地址赋于EAX
004010E4 |. 50 PUSH EAX ; /pWndClassEx
004010E5 |. E8 C8000000 CALL <JMP.&user32.RegisterClassExA> ; \RegisterClassExA
004010EA |. 6A 00 PUSH 0 ; /lParam = NULL
004010EC |. FF35 00304000 PUSH DWORD PTR DS:[403000] ; |hInst = 00400000
004010F2 |. 6A 00 PUSH 0 ; |hMenu = NULL
004010F4 |. 6A 00 PUSH 0 ; |hParent = NULL
004010F6 |. 68 90010000 PUSH 190 ; |Height = 190 (400.)
004010FB |. 68 58020000 PUSH 258 ; |Width = 258 (600.)
00401100 |. 6A 64 PUSH 64 ; |Y = 64 (100.)
00401102 |. 6A 64 PUSH 64 ; |X = 64 (100.)
00401104 |. 68 0000CF00 PUSH 0CF0000 ; |Style = WS_OVERLAPPED|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_SYSMENU|WS_THICKFRAME|WS_CAPTION
00401109 |. 68 58204000 PUSH FirstWin.00402058 ; |my first window !
0040110E |. 68 50204000 PUSH FirstWin.00402050 ; |myclass
00401113 |. 68 00020000 PUSH 200 ; |ExtStyle = WS_EX_CLIENTEDGE
00401118 |. E8 59000000 CALL <JMP.&user32.CreateWindowExA> ; \CreateWindowExA
0040111D |. A3 04304000 MOV DWORD PTR DS:[403004],EAX
00401122 |. 6A 01 PUSH 1 ; /ShowState = SW_SHOWNORMAL
00401124 |. FF35 04304000 PUSH DWORD PTR DS:[403004] ; |hWnd = NULL
0040112A |. E8 89000000 CALL <JMP.&user32.ShowWindow> ; \ShowWindow
0040112F |. FF35 04304000 PUSH DWORD PTR DS:[403004] ; /hWnd = NULL
00401135 |. E8 8A000000 CALL <JMP.&user32.UpdateWindow> ; \UpdateWindow
0040113A |> 6A 00 /PUSH 0 ; /MsgFilterMax = 0
0040113C |. 6A 00 |PUSH 0 ; |MsgFilterMin = 0
0040113E |. 6A 00 |PUSH 0 ; |hWnd = NULL
00401140 |. 8D45 B4 |LEA EAX,DWORD PTR SS:[EBP-4C] ; |
00401143 |. 50 |PUSH EAX ; |pMsg
00401144 |. E8 57000000 |CALL <JMP.&user32.GetMessageA> ; \GetMessageA
00401149 |. 0BC0 |OR EAX,EAX
0040114B |. 74 14 |JE SHORT FirstWin.00401161
0040114D |. 8D45 B4 |LEA EAX,DWORD PTR SS:[EBP-4C]
00401150 |. 50 |PUSH EAX ; /pMsg
00401151 |. E8 68000000 |CALL <JMP.&user32.TranslateMessage> ; \TranslateMessage
00401156 |. 8D45 B4 |LEA EAX,DWORD PTR SS:[EBP-4C]
00401159 |. 50 |PUSH EAX ; /pMsg
0040115A |. E8 29000000 |CALL <JMP.&user32.DispatchMessageA> ; \DispatchMessageA
0040115F |.^ EB D9 \JMP SHORT FirstWin.0040113A
00401161 |> C9 LEAVE
00401162 \. C3 RETN
00401163 >/$ E8 21FFFFFF CALL FirstWin.00401089 ; (初始 cpu 选择)
00401168 |. 6A 00 PUSH 0 ; /ExitCode = 0
0040116A \. E8 5B000000 CALL <JMP.&kernel32.ExitProcess> ; \ExitProcess
0040116F CC INT3
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)