在使用ODICE时,滚动鼠标,感觉太慢了,每次只能滚动2行,想加快一点,但在OD的设置菜单中没有找到相应的设置,只有自己动手DIY了。
使用原版OD加载ODICE,让程序执行,使用OD在ODICE的ICPUASM窗口下WM_MOUSEWHEEL消息断点,然后在ODICE中滚动鼠标轮,可惜没有中断成功。
再查手册,知道MDI窗口是使用WM_VSCROLL消息来滚动的,所以使用OD在ODICE的ICPUASM窗口下WM_VSCROLL消息断点,中断成功
0041E604 > $ 55 push ebp //中断在这里(会中断两次,说明OD每次滚动了两行)
0041E605 . 8BEC mov ebp, esp
0041E607 . 50 push eax
0041E608 . B8 03000000 mov eax, 3
0041E60D > 81C4 04F0FFFF add esp, -0FFC
0041E613 . 50 push eax
0041E614 . 48 dec eax
0041E615 .^ 75 F6 jnz short 0041E60D
0041E617 . 8B45 FC mov eax, [ebp-4] ; Ollydbg3.0041E604
0041E61A . 83C4 F0 add esp, -10
0041E61D . 53 push ebx
0041E61E . 56 push esi ; Ollydbg3.0041E604
一路按F8来到下面代码
0041E7A3 > \8B45 14 mov eax, [ebp+14]
0041E7A6 . 50 push eax ; /Arg5 = 00110310
0041E7A7 . 8B55 10 mov edx, [ebp+10] ; |
0041E7AA . 52 push edx ; |Arg4 = 00000000
0041E7AB . 8B4D 0C mov ecx, [ebp+C] ; |
0041E7AE . 51 push ecx ; |Arg3 = 00000115
0041E7AF . 8B45 08 mov eax, [ebp+8] ; |
0041E7B2 . 50 push eax ; |Arg2 = 00110310
0041E7B3 . 68 A8D64C00 push 004CD6A8 ; |Arg1 = 004CD6A8
0041E7B8 . E8 9F9B0300 call _Tablefunction // OD自己的_Tablefunction函数,各个参数可查OD的手册得到,按F7进入
0045944F |> \817D 10 15010>cmp dword ptr [ebp+10], 115 //比较是否WM_VSCROLL消息
00459456 |. 0F85 8B010000 jnz 004595E7
0045945C |. 6A 10 push 10 ; /Key = VK_SHIFT
0045945E |. E8 FF5F0500 call <jmp.&USER32.GetKeyState> //检测是否一起按下了VK_SHIFT
00459463 |. 0FBFD0 movsx edx, ax
00459466 |. 81E2 00800000 and edx, 8000
0045946C |. 8955 D4 mov [ebp-2C], edx
0045946F |. 66:8B4D 14 mov cx, [ebp+14]
00459473 |. 66:81E1 FFFF and cx, 0FFFF
00459478 |. 0FB7C1 movzx eax, cx //eax为滚动方向,1向上,0向下
0045947B |. 83F8 05 cmp eax, 5 ; Switch (cases 0..5)
0045947E |. 0F87 26010000 ja 004595AA
00459484 |.- FF2485 8B9445>jmp [eax*4+45948B] //分支
0045948B |. E6944500 dd Ollydbg3.004594E6 ; 分支表 被用于 00459484
0045948F |. A3944500 dd Ollydbg3.004594A3
00459493 |. 2D954500 dd Ollydbg3.0045952D
00459497 |. 56954500 dd Ollydbg3.00459556
0045949B |. AA954500 dd Ollydbg3.004595AA
0045949F |. 7D954500 dd Ollydbg3.0045957D
一路按F7来到下面代码
004594C7 |. /E9 E1000000 jmp 004595AD
004594CC |53 push ebx //向下一次滚动的行数(默认1)
004594CD |8B45 FC mov eax, [ebp-4]
004594D0 |50 push eax
004594D1 |. |68 68040000 push 468 ; |Message = MSG(468)
004594D6 |. |8B55 0C mov edx, [ebp+C] ; |
004594D9 |. |52 push edx ; |hWnd = NULL
004594DA |. |E8 91600500 call <jmp.&USER32.SendMessageA> ; \SendMessageA
004594DF |. |8BD8 mov ebx, eax
004594E1 |. |E9 C7000000 jmp 004595AD
004594E6 |> |837D D4 00 cmp dword ptr [ebp-2C], 0 ; Case 0 of switch 0045947B
004594EA |. |74 25 je short 00459511
004594EC |. |F687 35020000>test byte ptr [edi+235], 80
004594F3 |. |74 1C je short 00459511
004594F5 |. |F7DB neg ebx
004594F7 |. |53 push ebx ; /lParam = FFFFFFFE
004594F8 |. |8B4D FC mov ecx, [ebp-4] ; |
004594FB |. |51 push ecx ; |wParam = 110310
004594FC |. |68 6A040000 push 46A ; |Message = MSG(46A)
00459501 |. |8B45 0C mov eax, [ebp+C] ; |
00459504 |. |50 push eax ; |hWnd = NULL
00459505 |. |E8 66600500 call <jmp.&USER32.SendMessageA> ; \SendMessageA
0045950A |. |8BD8 mov ebx, eax
0045950C |. |E9 9C000000 jmp 004595AD
00459511 |F7DB neg ebx
00459513 |53 push ebx // 向上一次滚动的行数(默认-1)
00459514 |8B55 FC mov edx, [ebp-4]
00459517 |52 push edx
00459518 |. |68 68040000 push 468 ; |Message = MSG(468)
0045951D |. |8B4D 0C mov ecx, [ebp+C] ; |
00459520 |. |51 push ecx ; |hWnd = 110310
00459521 |. |E8 4A600500 call <jmp.&USER32.SendMessageA> ; \SendMessageA
**********************************************************************************************************************
分析完就动手开始DIY了,
004594C7 |. /E9 E1000000 jmp 004595AD
004594CC |6A 02 push 2 //默认为1,我就改为2,增加一倍
004594CE |FF75 FC push dword ptr [ebp-4] //执行原来代码
004594D1 |. |68 68040000 push 468 ; |Message = MSG(468)
004594D6 |. |8B55 0C mov edx, [ebp+C] ; |
004594D9 |. |52 push edx ; |hWnd = NULL
004594DA |. |E8 91600500 call <jmp.&USER32.SendMessageA> ; \SendMessageA
004594DF |. |8BD8 mov ebx, eax
004594E1 |. |E9 C7000000 jmp 004595AD
004594E6 |> |837D D4 00 cmp dword ptr [ebp-2C], 0 ; Case 0 of switch 0045947B
004594EA |. |74 25 je short 00459511
004594EC |. |F687 35020000>test byte ptr [edi+235], 80
004594F3 |. |74 1C je short 00459511
004594F5 |. |F7DB neg ebx
004594F7 |. |53 push ebx ; /lParam = FFFFFFFE
004594F8 |. |8B4D FC mov ecx, [ebp-4] ; |
004594FB |. |51 push ecx ; |wParam = 110310
004594FC |. |68 6A040000 push 46A ; |Message = MSG(46A)
00459501 |. |8B45 0C mov eax, [ebp+C] ; |
00459504 |. |50 push eax ; |hWnd = NULL
00459505 |. |E8 66600500 call <jmp.&USER32.SendMessageA> ; \SendMessageA
0045950A |. |8BD8 mov ebx, eax
0045950C |. |E9 9C000000 jmp 004595AD
00459511 |43 inc ebx //默认为1,我就改为2,增加一倍
00459512 |F7DB neg ebx
00459514 |53 push ebx
00459515 |FF75 FC push dword ptr [ebp-4]
00459518 |. |68 68040000 push 468 ; |Message = MSG(468)
0045951D |. |8B4D 0C mov ecx, [ebp+C] ; |
00459520 |. |51 push ecx ; |hWnd = 110310
00459521 |. |E8 4A600500 call <jmp.&USER32.SendMessageA> ; \SendMessageA
修改后使用ODICE就快了一倍,一次能滚动4行了,如感觉不够快,自己根据需要再改更大就可以了。
最后还是没有找到OD是怎样处理WM_MOUSEWHEEL消息,哪位兄弟如找到,请指点一下
****************************************************************************************
再认真分析一下,找到了处理WM_MOUSEWHEEL消息的地方
00439349 > \81BD 3CF6FFFF>cmp dword ptr [ebp-9C4], 20A //比较鼠标WM_MOUSEWHEEL消息
00439353 . 0F85 D1000000 jnz 0043942A
00439359 . 66:8B8D 44F6F>mov cx, [ebp-9BC]
00439360 . 66:81E1 FFFF and cx, 0FFFF
00439365 . 0FB7C1 movzx eax, cx
00439368 . 8945 A4 mov [ebp-5C], eax
0043936B . 8B95 44F6FFFF mov edx, [ebp-9BC]
00439371 . C1EA 10 shr edx, 10
00439374 . 0FB7CA movzx ecx, dx
00439377 . 894D A8 mov [ebp-58], ecx
0043937A . FF75 A8 push dword ptr [ebp-58] ; /pt.Y = 99 (153.)
0043937D . FF75 A4 push dword ptr [ebp-5C] ; |pt.X = D2 (210.)
00439380 . E8 7B620700 call <jmp.&USER32.WindowFromPoint> ; \WindowFromPoint
00439385 . 8BF8 mov edi, eax
00439387 . 3B3D 803B4D00 cmp edi, [4D3B80]
0043938D . 75 08 jnz short 00439397
0043938F . 8BBD 38F6FFFF mov edi, [ebp-9C8]
00439395 . EB 20 jmp short 004393B7
00439397 > 8BC7 mov eax, edi
00439399 . EB 06 jmp short 004393A1
0043939B > 50 push eax ; /hWnd = FFFFFFFE
0043939C . E8 DF600700 call <jmp.&USER32.GetParent> ; \GetParent
004393A1 > 3B05 7C3B4D00 cmp eax, [4D3B7C] ; Ollydbg3.004001E0
004393A7 . 74 04 je short 004393AD
004393A9 . 85C0 test eax, eax
004393AB .^ 75 EE jnz short 0043939B
004393AD > 85C0 test eax, eax
004393AF . 75 06 jnz short 004393B7
004393B1 . 8BBD 38F6FFFF mov edi, [ebp-9C8]
004393B7 > 8B85 40F6FFFF mov eax, [ebp-9C0] //取出WM_MOUSEWHEEL消息参数
004393BD . B9 78000000 mov ecx, 78 //想加快滚动可修改这里,例如改成mov ecx,28就能一次滚动6行
004393C2 . C1E8 10 shr eax, 10
004393C5 . 0FBFC0 movsx eax, ax
004393C8 . 03C0 add eax, eax
004393CA . 99 cdq
004393CB . F7F9 idiv ecx
004393CD . F685 40F6FFFF>test byte ptr [ebp-9C0], 10
004393D4 . 8BD8 mov ebx, eax
004393D6 . 74 05 je short 004393DD
004393D8 . 8D045B lea eax, [ebx+ebx*2]
004393DB . 89C3 mov ebx, eax
004393DD > 83FB F0 cmp ebx, -10
004393E0 . 7D 07 jge short 004393E9
004393E2 . BB F0FFFFFF mov ebx, -10
004393E7 . EB 0A jmp short 004393F3
004393E9 > 83FB 10 cmp ebx, 10
004393EC . 7E 05 jle short 004393F3
004393EE . BB 10000000 mov ebx, 10
004393F3 > 85DB test ebx, ebx
004393F5 .^ 0F84 7CFCFFFF je 00439077
004393FB > 85DB test ebx, ebx //ebx为滚动方向,2向上,-2向下
004393FD . 7D 12 jge short 00439411
004393FF . 6A 00 push 0 ; /lParam = 0
00439401 . 6A 01 push 1 ; |wParam = 1
00439403 . 68 15010000 push 115 ; |Message = WM_VSCROLL
00439408 . 57 push edi ; |hWnd = 3302F0
00439409 . E8 26610700 call <jmp.&USER32.PostMessageA> ; \PostMessageA
0043940E . 43 inc ebx
0043940F . EB 10 jmp short 00439421
00439411 > 6A 00 push 0 ; /lParam = 0
00439413 . 6A 00 push 0 ; |wParam = 0
00439415 . 68 15010000 push 115 ; |Message = WM_VSCROLL
0043941A . 57 push edi ; |hWnd = 3302F0
0043941B . E8 14610700 call <jmp.&USER32.PostMessageA> ; \PostMessageA
00439420 . 4B dec ebx
00439421 > 85DB test ebx, ebx //检测是否已经滚动了2次
00439423 .^\75 D6 jnz short 004393FB //不够两次就再次跳回去滚动
00439425 .^ E9 4DFCFFFF jmp 00439077
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)