首页
社区
课程
招聘
[求助]又一个通宵过去了,还一事未成,请大家进来看下!!!
发表于: 2008-1-16 07:45 9062

[求助]又一个通宵过去了,还一事未成,请大家进来看下!!!

2008-1-16 07:45
9062
上一次的“【求助】在桌面上画图, 桌面重画时也不消失!!! ”,坛主教我的“HOOK EndPaint”确实是好方法,但还有几个问题,我未能处理:

1,当运行有“NP”的游戏时,Hook无效了,“explorer.exe”还会同时出错

  我只能再加一个勾来检查当前有没有“NP”运行,有的就退出!

2,当挂勾的主程序退出时,勾子也会“UnHook”

我想了一个通宵,下面的方法可能可行:

第一步: 写一个功能,用来在桌面上画图。
第二步: 将上面写的过程写入“桌面”的内存中。(请问, 这个又如何可以将一个功能或过程写入到其它程序, 并能执行?)

第三步: 找到桌面重画过程的关键位置,在重画过程中写入一些代码,用来 JMP 到“第二步”(自已写的画图过程)

最后,再在自已写的过程中 JMP 到桌面重画。

如果上面的方法可行,请问大家,如何可找到“桌面重画过程的关键位置”?其实我对桌面也不是很理解,请大家指点:

Progman--->SHELLDLL_DefView-->SysListView32(桌面的ListView)???  这个是“explorer.exe”中的子窗体吗?
Shell_TrayWnd---->

上面的窗体是由“explorer.exe”创建的吧?

在 OD 里,想找“桌面重画过程”, 要附加“explorer.exe”这个进程吗?

[课程]Linux pwn 探索篇!

收藏
免费 0
支持
分享
最新回复 (15)
雪    币: 223
活跃值: (10)
能力值: ( LV6,RANK:90 )
在线值:
发帖
回帖
粉丝
2
自己得一点理解:
系统得整个桌面是一个控件,而桌面上的图标是动态得绘制上去的(包括任务栏),完成这个任务是由explorer.exe这个进程来完成得。
所以说得,按你的意思,也就是你得第二不来说的,你应该做的是把你的代码注入到exeplorer这个进程中去,这个过程不是难,网上可以找到现成得代码。至于这个然你的代码在恰当得时间运行,是不是就是让你的代码先与exeplorer.exe得代码来运行? 这个我就不感确定了。实在不行你就跟踪一下exeplorer.exe这个进程看看。
/*****************************************************/
以上是我自己得一点愚见,有错误之处还请大家指点。
2008-1-16 08:49
0
雪    币: 189
活跃值: (4810)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
3
谢谢!!!!
顶起来!!!!
2008-1-16 19:14
0
雪    币: 1852
活跃值: (504)
能力值: (RANK:1010 )
在线值:
发帖
回帖
粉丝
4
EndPaint就是添加自定义GDI绘制的关键位置。
GDI绘图过程大致是这样的:
WM_PAINT:
{
BeginPaint ( hdc ) ;
/ /具体绘制……
EndPaint ( hdc ) ;
}
break ;
2008-1-17 00:26
0
雪    币: 189
活跃值: (4810)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
5
我试试
我怕附加了“explorer.exe”后, 分不清是:
Progman--->SHELLDLL_DefView-->SysListView32(桌面的ListView)???  

还是:
Shell_TrayWnd

的重画
2008-1-17 18:40
0
雪    币: 189
活跃值: (4810)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
6
0102025B   $  8BFF          mov     edi, edi
0102025D   .  55            push    ebp
0102025E   .  8BEC          mov     ebp, esp
01020260   .  81EC DC000000 sub     esp, 0DC
01020266   .  A1 80600401   mov     eax, dword ptr [1046080]
0102026B   .  53            push    ebx
0102026C   .  8945 FC       mov     dword ptr [ebp-4], eax
0102026F   .  56            push    esi
01020270   .  57            push    edi
01020271   .  8BD9          mov     ebx, ecx
01020273   .  33C9          xor     ecx, ecx
01020275   .  33C0          xor     eax, eax
01020277   .  394D 08       cmp     dword ptr [ebp+8], ecx
0102027A   .  898D 34FFFFFF mov     dword ptr [ebp-CC], ecx
01020280   .  8DBD 38FFFFFF lea     edi, dword ptr [ebp-C8]
01020286   .  AB            stos    dword ptr es:[edi]
01020287   .  AB            stos    dword ptr es:[edi]
01020288   .  AB            stos    dword ptr es:[edi]
01020289   .  894D AC       mov     dword ptr [ebp-54], ecx
0102028C   .  0F84 47030000 je      010205D9
01020292   .  398B B4010000 cmp     dword ptr [ebx+1B4], ecx
01020298   .  894D B0       mov     dword ptr [ebp-50], ecx
0102029B   .  0F84 38030000 je      010205D9
010202A1   >  394D 08       cmp     dword ptr [ebp+8], ecx
010202A4   .  0F84 3B030000 je      010205E5
010202AA   .  8D45 BC       lea     eax, dword ptr [ebp-44]
010202AD   .  50            push    eax                              ; /pPaintstruct
010202AE   .  FF73 04       push    dword ptr [ebx+4]                ; |hWnd
010202B1   .  FF15 AC170001 call    dword ptr [<&USER32.BeginPaint>] ; \BeginPaint
010202B7   >  FF75 BC       push    dword ptr [ebp-44]               ; /hDC
010202BA   .  FF15 A0100001 call    dword ptr [<&GDI32.CreateCompati>; \CreateCompatibleDC
010202C0   .  8BF0          mov     esi, eax
010202C2   .  33FF          xor     edi, edi
010202C4   .  3BF7          cmp     esi, edi
010202C6   .  8975 B8       mov     dword ptr [ebp-48], esi
010202C9   .  0F84 AF020000 je      0102057E
010202CF   .  8B45 D0       mov     eax, dword ptr [ebp-30]
010202D2   .  2B45 C8       sub     eax, dword ptr [ebp-38]
010202D5   .  50            push    eax                              ; /Height
010202D6   .  8B45 CC       mov     eax, dword ptr [ebp-34]          ; |
010202D9   .  2B45 C4       sub     eax, dword ptr [ebp-3C]          ; |
010202DC   .  50            push    eax                              ; |Width
010202DD   .  FF75 BC       push    dword ptr [ebp-44]               ; |hDC
010202E0   .  FF15 A4100001 call    dword ptr [<&GDI32.CreateCompati>; \CreateCompatibleBitmap
010202E6   .  3BC7          cmp     eax, edi
010202E8   .  8985 48FFFFFF mov     dword ptr [ebp-B8], eax
010202EE   .  0F84 2D650000 je      01026821
010202F4   .  50            push    eax                              ; /hObject
010202F5   .  56            push    esi                              ; |hDC
010202F6   .  FF15 DC100001 call    dword ptr [<&GDI32.SelectObject>>; \SelectObject
010202FC   .  57            push    edi                              ; /pPoint => NULL
010202FD   .  FF75 C8       push    dword ptr [ebp-38]               ; |YOffset
01020300   .  8985 4CFFFFFF mov     dword ptr [ebp-B4], eax          ; |
01020306   .  FF75 C4       push    dword ptr [ebp-3C]               ; |XOffset
01020309   .  56            push    esi                              ; |hDC
0102030A   .  FF15 A8100001 call    dword ptr [<&GDI32.OffsetWindowO>; \OffsetWindowOrgEx
01020310   >  3BF7          cmp     esi, edi
01020312   .  0F84 66020000 je      0102057E
01020318   .  8B43 04       mov     eax, dword ptr [ebx+4]
0102031B   .  8D4D C4       lea     ecx, dword ptr [ebp-3C]
0102031E   .  51            push    ecx
0102031F   .  56            push    esi
01020320   .  50            push    eax
01020321   .  50            push    eax                              ; /hWnd
01020322   .  FF15 A0180001 call    dword ptr [<&USER32.GetParent>]  ; \GetParent
01020328   .  50            push    eax
01020329   .  E8 93FCFFFF   call    0101FFC1
0102032E   .  57            push    edi
0102032F   .  8BCB          mov     ecx, ebx
01020331   .  E8 91FEFFFF   call    010201C7
01020336   .  397D B0       cmp     dword ptr [ebp-50], edi
01020339   .  0F85 45030000 jnz     01020684
0102033F   .  66:39BB 04010>cmp     word ptr [ebx+104], di
01020346   .  0F84 38030000 je      01020684
0102034C   >  8D85 34FFFFFF lea     eax, dword ptr [ebp-CC]
01020352   .  50            push    eax                              ; /pRect
01020353   .  56            push    esi                              ; |hDC
01020354   .  FF15 C0100001 call    dword ptr [<&GDI32.GetClipBox>]  ; \GetClipBox
0102035A   .  33C9          xor     ecx, ecx
0102035C   .  41            inc     ecx
0102035D   .  3BC1          cmp     eax, ecx
0102035F   .  0F84 CD640000 je      01026832
01020365   >  8D85 78FFFFFF lea     eax, dword ptr [ebp-88]
0102036B   .  50            push    eax                              ; /pRect
0102036C   .  FF73 04       push    dword ptr [ebx+4]                ; |hWnd
0102036F   .  FF15 B4180001 call    dword ptr [<&USER32.GetClientRec>; \GetClientRect
01020375   .  8B83 B0010000 mov     eax, dword ptr [ebx+1B0]
0102037B   .  3BC7          cmp     eax, edi
0102037D   .  74 0E         je      short 0102038D
0102037F   .  50            push    eax                              ; /hObject
01020380   .  56            push    esi                              ; |hDC
01020381   .  FF15 DC100001 call    dword ptr [<&GDI32.SelectObject>>; \SelectObject
01020387   .  8985 44FFFFFF mov     dword ptr [ebp-BC], eax
0102038D   >  8B3D DC170001 mov     edi, dword ptr [<&USER32.GetSysC>;  USER32.GetSysColor
01020393   .  6A 0F         push    0F                               ; /Index = COLOR_BTNFACE
01020395   .  FFD7          call    edi                              ; \GetSysColor
01020397   .  50            push    eax                              ; /Color
01020398   .  56            push    esi                              ; |hDC
01020399   .  FF15 B0100001 call    dword ptr [<&GDI32.SetBkColor>]  ; \SetBkColor
0102039F   .  6A 12         push    12                               ; /Index = COLOR_BTNTEXT
010203A1   .  FFD7          call    edi                              ; \GetSysColor
010203A3   .  50            push    eax                              ; /Color
010203A4   .  56            push    esi                              ; |hDC
010203A5   .  FF15 7C100001 call    dword ptr [<&GDI32.SetTextColor>>; \SetTextColor
010203AB   .  33C0          xor     eax, eax
010203AD   .  33C9          xor     ecx, ecx
010203AF   .  894D 9C       mov     dword ptr [ebp-64], ecx
010203B2   .  8D7D A0       lea     edi, dword ptr [ebp-60]
010203B5   .  AB            stos    dword ptr es:[edi]
010203B6   .  AB            stos    dword ptr es:[edi]
010203B7   .  AB            stos    dword ptr es:[edi]
010203B8   .  33C0          xor     eax, eax
010203BA   .  898D 60FFFFFF mov     dword ptr [ebp-A0], ecx
010203C0   .  8DBD 64FFFFFF lea     edi, dword ptr [ebp-9C]
010203C6   .  AB            stos    dword ptr es:[edi]
010203C7   .  AB            stos    dword ptr es:[edi]
010203C8   .  AB            stos    dword ptr es:[edi]
010203C9   .  894D 88       mov     dword ptr [ebp-78], ecx
010203CC   .  33C0          xor     eax, eax
010203CE   .  8D7D 8C       lea     edi, dword ptr [ebp-74]
010203D1   .  AB            stos    dword ptr es:[edi]
010203D2   .  894D 98       mov     dword ptr [ebp-68], ecx
010203D5   .  898D 74FFFFFF mov     dword ptr [ebp-8C], ecx
010203DB   .  AB            stos    dword ptr es:[edi]
010203DC   .  8D4D 9C       lea     ecx, dword ptr [ebp-64]
010203DF   .  51            push    ecx
010203E0   .  FFB3 B0000000 push    dword ptr [ebx+B0]
010203E6   .  AB            stos    dword ptr es:[edi]
010203E7   .  8D83 04010000 lea     eax, dword ptr [ebx+104]
010203ED   .  50            push    eax
010203EE   .  56            push    esi
010203EF   .  8BCB          mov     ecx, ebx
010203F1   .  E8 97FDFFFF   call    0102018D
010203F6   .  8D8D 60FFFFFF lea     ecx, dword ptr [ebp-A0]
010203FC   .  51            push    ecx
010203FD   .  FF73 0C       push    dword ptr [ebx+C]
01020400   .  8D43 60       lea     eax, dword ptr [ebx+60]
01020403   .  50            push    eax
01020404   .  56            push    esi
01020405   .  8BCB          mov     ecx, ebx
01020407   .  E8 81FDFFFF   call    0102018D
0102040C   .  8D4D 88       lea     ecx, dword ptr [ebp-78]
0102040F   .  51            push    ecx
01020410   .  FFB3 54010000 push    dword ptr [ebx+154]
01020416   .  8D83 58010000 lea     eax, dword ptr [ebx+158]
0102041C   .  50            push    eax
0102041D   .  56            push    esi
0102041E   .  8BCB          mov     ecx, ebx
01020420   .  E8 68FDFFFF   call    0102018D
01020425   .  8B4D A8       mov     ecx, dword ptr [ebp-58]
01020428   .  2B4D A0       sub     ecx, dword ptr [ebp-60]
0102042B   .  8BC1          mov     eax, ecx
0102042D   .  99            cdq
0102042E   .  2BC2          sub     eax, edx
01020430   .  8B55 94       mov     edx, dword ptr [ebp-6C]
01020433   .  2B55 8C       sub     edx, dword ptr [ebp-74]
01020436   .  D1F8          sar     eax, 1
01020438   .  03C8          add     ecx, eax
0102043A   .  03D1          add     edx, ecx
0102043C   .  3B55 84       cmp     edx, dword ptr [ebp-7C]
0102043F   .  8985 70FFFFFF mov     dword ptr [ebp-90], eax
01020445   .  0F8C FB630000 jl      01026846
0102044B   >  2BC8          sub     ecx, eax
0102044D   .  8B45 84       mov     eax, dword ptr [ebp-7C]
01020450   .  2BC1          sub     eax, ecx
01020452   .  99            cdq
01020453   .  2BC2          sub     eax, edx
01020455   .  D1F8          sar     eax, 1
01020457   .  85C0          test    eax, eax
01020459   .  0F8E B3010000 jle     01020612
0102045F   .  8945 B4       mov     dword ptr [ebp-4C], eax
01020462   >  8B45 80       mov     eax, dword ptr [ebp-80]
01020465   .  2B45 A4       sub     eax, dword ptr [ebp-5C]
01020468   .  8D75 9C       lea     esi, dword ptr [ebp-64]
0102046B   .  0345 9C       add     eax, dword ptr [ebp-64]
0102046E   .  8DBD 50FFFFFF lea     edi, dword ptr [ebp-B0]
01020474   .  A5            movs    dword ptr es:[edi], dword ptr [e>
01020475   .  A5            movs    dword ptr es:[edi], dword ptr [e>
01020476   .  99            cdq
01020477   .  2BC2          sub     eax, edx
01020479   .  A5            movs    dword ptr es:[edi], dword ptr [e>
0102047A   .  D1F8          sar     eax, 1
0102047C   .  85C0          test    eax, eax
0102047E   .  A5            movs    dword ptr es:[edi], dword ptr [e>
0102047F   .  0F8E 18640000 jle     0102689D
01020485   >  FF75 B4       push    dword ptr [ebp-4C]               ; /dY
01020488   .  50            push    eax                              ; |dX
01020489   .  8D85 50FFFFFF lea     eax, dword ptr [ebp-B0]          ; |
0102048F   .  50            push    eax                              ; |pRect
01020490   .  FF15 00170001 call    dword ptr [<&USER32.OffsetRect>] ; \OffsetRect
01020496   .  8D85 50FFFFFF lea     eax, dword ptr [ebp-B0]
0102049C   .  50            push    eax
0102049D   .  FFB3 B0000000 push    dword ptr [ebx+B0]
010204A3   .  8D83 04010000 lea     eax, dword ptr [ebx+104]
010204A9   .  50            push    eax
010204AA   .  FF75 B8       push    dword ptr [ebp-48]
010204AD   .  8BCB          mov     ecx, ebx
010204AF   .  E8 67FDFFFF   call    0102021B
010204B4   .  8B45 A8       mov     eax, dword ptr [ebp-58]
010204B7   .  8BC8          mov     ecx, eax
010204B9   .  2B4D A0       sub     ecx, dword ptr [ebp-60]
010204BC   .  038D 70FFFFFF add     ecx, dword ptr [ebp-90]
010204C2   .  014D B4       add     dword ptr [ebp-4C], ecx
010204C5   .  83BD 74FFFFFF>cmp     dword ptr [ebp-8C], 0
010204CC   .  0F85 D2630000 jnz     010268A4
010204D2   >  8B4D A4       mov     ecx, dword ptr [ebp-5C]
010204D5   .  2B4D 9C       sub     ecx, dword ptr [ebp-64]
010204D8   .  3B4D 80       cmp     ecx, dword ptr [ebp-80]
010204DB   .  0F8F 3A010000 jg      0102061B
010204E1   .  2B45 A0       sub     eax, dword ptr [ebp-60]
010204E4   .  3B45 84       cmp     eax, dword ptr [ebp-7C]
010204E7   .  0F8F 2E010000 jg      0102061B
010204ED   .  33C0          xor     eax, eax
010204EF   >  83BB B0010000>cmp     dword ptr [ebx+1B0], 0
010204F6   .  8983 B8010000 mov     dword ptr [ebx+1B8], eax
010204FC   .  74 0F         je      short 0102050D
010204FE   .  FFB5 44FFFFFF push    dword ptr [ebp-BC]               ; /hObject
01020504   .  FF75 B8       push    dword ptr [ebp-48]               ; |hDC
01020507   .  FF15 DC100001 call    dword ptr [<&GDI32.SelectObject>>; \SelectObject
0102050D   >  83BB BC010000>cmp     dword ptr [ebx+1BC], 0
01020514   .  0F85 4A640000 jnz     01026964
0102051A   >  8B75 B8       mov     esi, dword ptr [ebp-48]
0102051D   .  33FF          xor     edi, edi
0102051F   >  8B45 D0       mov     eax, dword ptr [ebp-30]
01020522   .  2B45 C8       sub     eax, dword ptr [ebp-38]
01020525   .  68 2000CC00   push    0CC0020                          ; /ROP = SRCCOPY
0102052A   .  FF75 C8       push    dword ptr [ebp-38]               ; |YSrc
0102052D   .  FF75 C4       push    dword ptr [ebp-3C]               ; |XSrc
01020530   .  56            push    esi                              ; |hSrcDC
01020531   .  50            push    eax                              ; |Height
01020532   .  8B45 CC       mov     eax, dword ptr [ebp-34]          ; |
01020535   .  2B45 C4       sub     eax, dword ptr [ebp-3C]          ; |
01020538   .  50            push    eax                              ; |Width
01020539   .  FF75 C8       push    dword ptr [ebp-38]               ; |YDest
0102053C   .  FF75 C4       push    dword ptr [ebp-3C]               ; |XDest
0102053F   .  FF75 BC       push    dword ptr [ebp-44]               ; |hDestDC
01020542   .  FF15 B4100001 call    dword ptr [<&GDI32.BitBlt>]      ; \BitBlt
01020548   .  FFB5 4CFFFFFF push    dword ptr [ebp-B4]               ; /hObject
0102054E   .  56            push    esi                              ; |hDC
0102054F   .  FF15 DC100001 call    dword ptr [<&GDI32.SelectObject>>; \SelectObject
01020555   .  FFB5 48FFFFFF push    dword ptr [ebp-B8]               ; /hObject
0102055B   .  FF15 D4100001 call    dword ptr [<&GDI32.DeleteObject>>; \DeleteObject
01020561   .  56            push    esi                              ; /hDC
01020562   .  FF15 AC100001 call    dword ptr [<&GDI32.DeleteDC>]    ; \DeleteDC
01020568   .  397D 08       cmp     dword ptr [ebp+8], edi
0102056B   .  0F84 90000000 je      01020601
01020571   .  8D45 BC       lea     eax, dword ptr [ebp-44]
01020574   .  50            push    eax                              ; /pPaintstruct
01020575   .  FF73 04       push    dword ptr [ebx+4]                ; |hWnd
01020578   .  FF15 B0170001 call    dword ptr [<&USER32.EndPaint>]   ; \EndPaint   // 是这个了吧
2008-1-20 09:39
0
雪    币: 189
活跃值: (4810)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
7
是不是在这里 JMP 到“第二步”(自已写的画图过程)再 JMP 来??

01020574   .  50            push    eax                              ; /pPaintstruct
01020575   .  FF73 04       push    dword ptr [ebx+4]                ; |hWnd
01020578   .  FF15 B0170001 call    dword ptr [<&USER32.EndPaint>]   ; \EndPaint   // 是这个了吧

请问大家, 如何可以将一个功能或过程写入到其它程序???
2008-1-20 09:46
0
雪    币: 189
活跃值: (4810)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
8
请问, 在桌面上画几个图形和写十行字出(自已写的功能, 每次重画都触发一次) 和 直接设一个桌面背景   相比(只用API设一次),  哪一个"以后"要占用内存和CPU多(相对于系统), 如何计算出来?

(因为 Windows 的桌面背景图片有成 2 MB, 桌面重画触发也比较多, 如果桌面设背景图片, 不知Windows 桌面重画时, 画被挡隹的区域还是重画整个区域)

请高手必答
2008-1-23 14:15
0
雪    币: 189
活跃值: (4810)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
9
顶起!!!!!
2008-1-25 08:29
0
雪    币: 189
活跃值: (4810)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
10
2008-1-25 08:29
0
雪    币: 189
活跃值: (4810)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
11
顶起来!!!!
2008-1-27 05:00
0
雪    币: 189
活跃值: (4810)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
12
顶起来!!!!
2008-1-27 05:01
0
雪    币: 1852
活跃值: (504)
能力值: (RANK:1010 )
在线值:
发帖
回帖
粉丝
13
一种是inline patch
一种是基本的函数HOOK,你把功能写到一个DLL,注入到explore,关于这方面资料已经很多了,可以使用搜索功能,或者参考[专题一]中的几篇相关文章
2008-1-27 23:59
0
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
14
楼主能说一下具体是在搞什么吗?或许我有相关的资料可以提供。
2008-2-8 02:12
0
雪    币: 189
活跃值: (4810)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
15
[QUOTE=北极星2003;411209]一种是inline patch
一种是基本的函数HOOK,你把功能写到一个DLL,注入到explore,关于这方面资料已经很多了,可以使用搜索功能,或者参考[专题一]中的几篇相关文章[/QUOTE]

谢谢!!!!!!!!!!!!
2008-2-10 18:30
0
雪    币: 189
活跃值: (4810)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
16
我在做公告牌相关的软件
2008-2-10 18:30
0
游客
登录 | 注册 方可回帖
返回
//