- 帖子
- 11
- 积分
- 14
- 威望
- 17
- 金钱
- 10
- 在线时间
- 0 小时
|
全局动态调用笔记
4 u" b0 o8 R, j' _' b/ esvchost files工程->插入->类(Generic Class DTDY)->DTDY.cpp DTDY.h
; @6 F+ l' \/ v/ s1 U+ | S& V----------------------------------------
% D6 m0 S. R# f* PDTDY.h:; E' D3 s% ~* C! y7 ~
# m* f, h- j3 c5 ?: G- o#if _MSC_VER>1000" T, g P9 \9 j( n3 i* l
#pragma once0 i9 t: }3 U% F7 Z4 x7 a, g
#endif //_MSC_VER>1000
I. F+ }) J X E, n) @/ A7 h#include<windows.h>6 c$ F% N8 t- W, [. Z1 k
9 Z% O& Z3 n" y w4 a& u5 d
typedef DWORD (__stdcall *pGetModuleFileNameA)(HMODULE,LPSTR,DWORD);
& S$ O1 J. y! W0 F7 q5 Aclass DTDY
- R8 r/ B/ n0 D4 y, Z, G. E4 Y{. w% k( G" }: q# D
public:6 ^# i7 S7 O ]2 T5 h0 f; P% ]
DTDY();
) T2 j4 I& `/ ]6 O/ |9 \. Zvirtual ~DTDY();0 F& k v. l% L9 _4 V1 a
public:! l7 H Z$ C1 o, d/ e$ |' W
static pGetModuleFileNameA MyGetModuleFileName;
% P# l) b8 G c5 K8 E* astatic BOOL FunInitiallization();& m, E/ [; q( C C5 K# p" }
};: f% W& f; A$ [1 ^" z
#endif7 s8 E: k% ^/ m8 F" U) ^& K
----------------------------------------" O& |( Z. i% u% p
" o& H& C- V% w# e) LDTDY.cpp:
8 i9 s0 V A; d5 X9 M) i1 o% Q9 g' M& u/ w) M4 U" w
#include "DTDY.h"
: z8 S6 N" }/ N; ?3 \ g! j1 |pGetModuleFileNameA DTDY::MyGetModuleFileName=NULL;
* M" g9 R- Z0 ~/ D9 ]$ m U& ~4 xDTDY:TDY()6 z* J* l6 K _6 S4 u& K/ e p
{
' v6 t& V/ L9 d3 }- Y) s8 q+ `}6 e. q2 v! S& G6 E
DTDY::~DTDY()0 \) B. k6 U5 W$ A/ G
{4 D, U! @4 {1 [
}
: ?/ U7 ~7 o& Z6 ?+ O6 k3 DBOOL DTDY::FunInitiallization()
; I9 E e1 q6 X2 q( D% r+ }4 a{
a+ q; i, ]9 T' y/ d1 ]HMODULE hModule=LoadLibrary("kernel32.dll");
. P: m( o) U z$ s2 n# J; T/ xMyGetModuleFileName=(pGetModuleFileNameA)GetProcAddress(hModule,"GetModuleFileNameA");
0 r7 X) A4 _$ d- a# s7 zif(!MyGetModuleFileName=) return FALSE;
6 d2 R1 o6 W8 b9 M* D C, R' s$ y
4 T: m: I' q6 w' N2 Freturn TRUE;
' F/ x! h* C- Z4 F}, A, P2 ~. r% Q! [ r: R# \
----------------------------------------
8 f4 |; M& J, j' w1 rsvchost.cpp:7 B S; i. B4 [, [$ v
; h# Y. ?, t( `. J" }" A
#include "DTDY.h"
& v2 L. z! M! z- e+ U4 I4 n6 ^
* Y; X; \6 M+ iBOOL APIENTRY DllMain(HANDLE hModule,DWORD ul_reason_for_call,LPVOID lpReserved)
7 M$ ?- M9 A- R/ I* c, B$ `{
: U. {" w. n! p3 h6 mswitch(ul_reason_for_call): U& a. ?) J; [) T* D
{
, ~, u, w. B O# x! j+ l; Z, pcase DLL_PROCESS_ATTACH:
. t' P- A1 m M2 f, |# h- }1 `8 K' e) Lif(!DTDY::FunInitiallization()) return FALSE;; z; n# V' Z& [
0 {( O6 e, |5 q+ e; N6 Lbreak;
% g: H% P( U' d {1 F S/ O}( l7 |) ?9 k* J$ B; w
}1 r7 v$ Y8 j3 }. z- u
: x) ~ B+ i: D% H4 h! K/ t0 H( ]3 r6 O
GetModuleFileName(CKeyboardManager::g_hInstance,strFileName,sizeof(strFileName));->goto def8 @+ J0 t4 d! i2 V
改写为
: o1 i" n. ?3 Z; l) |9 O: fDTDY::MyGetModuleFileName(CKeyboardManager::g_hInstance,strFileName,sizeof(strFileName));/ j3 W, e; o$ P
----------------------------------------
% e6 i/ U0 ]: u5 VKernelManager.cpp:
- ]* V/ C6 a* |; O+ r
4 U! a+ D" P* J( B4 d, T! v#include "../DTDY.h"
; w" r9 a& J" R- k( ~GetModuleFileName(CKeyboardManager::g_hInstance,strServiceDll,sizeof(strServiceDll));
* E* _$ T" l5 b; }改写为" l/ [* y, ~: X* q; Q/ R! U3 b# Q
DTDY::MyGetModuleFileName(CKeyboardManager::g_hInstance,strServiceDll,sizeof(strServiceDll));
5 r0 c2 {" n, X/ @6 ]5 L---------------------------------------- |
|