全局动态调用
全局动态调用笔记6Dp!WA]'aV*Osvchost files工程->插入->类(Generic Class DTDY)->DTDY.cpp DTDY.h
----------------------------------------;o0m9PP n0A+XdX
DTDY.h:
S;v1D*h"b ^u
#if _MSC_VER>1000J"]4`${zto{;R\"If
#pragma once
#endif //_MSC_VER>1000,SDnBKQO
#include<windows.h>
typedef DWORD (__stdcall *pGetModuleFileNameA)(HMODULE,LPSTR,DWORD);
class DTDY&T(a2A aww bj2S
{9~$T}V2z%n:Y
public:
DTDY();Onp!~k]Mjs
virtual ~DTDY();
public:Z!?Hn'`
static pGetModuleFileNameA MyGetModuleFileName;;{ J8MJ"w%\pP;At6v
static BOOL FunInitiallization();]^!A;`T;J
};
#endif[;eT~;L%YV[BG
----------------------------------------
DTDY.cpp:
u M?1dzG)EL_r
#include "DTDY.h"
pGetModuleFileNameA DTDY::MyGetModuleFileName=NULL;
DTDY:TDY()M%`3NFQ?r#N"E
{
}
DTDY::~DTDY()
{
}
BOOL DTDY::FunInitiallization()1Ml5AeR@'R8R
{y%FST!k5y|
HMODULE hModule=LoadLibrary("kernel32.dll");!Yxqj^9x3B.ZN#U
MyGetModuleFileName=(pGetModuleFileNameA)GetProcAddress(hModule,"GetModuleFileNameA"); xV7JQM)e(jN)K
if(!MyGetModuleFileName=) return FALSE;
D]G/N1kl-jK
return TRUE;
}
----------------------------------------
svchost.cpp:
#include "DTDY.h"
BOOL APIENTRY DllMain(HANDLE hModule,DWORD ul_reason_for_call,LPVOID lpReserved)S9hJ\`L(\
{zKo*SF
switch(ul_reason_for_call)
{5Kgi+l~![;ZH
case DLL_PROCESS_ATTACH:
if(!DTDY::FunInitiallization()) return FALSE;%ut[8u*C3R3b
lU]V#?
break;
}6p5MExk2\
}7h![4Yl[-X jv2{:Vg
$tM.{K`8~lF8d
GetModuleFileName(CKeyboardManager::g_hInstance,strFileName,sizeof(strFileName));->goto def5t%] LkzE
改写为I~t+|Z,W,n-u
DTDY::MyGetModuleFileName(CKeyboardManager::g_hInstance,strFileName,sizeof(strFileName));H['lZ'EvO
----------------------------------------
KernelManager.cpp:
M&M)U[.Q(x S
#include "../DTDY.h"7i7J/{$S$v(X9Ubi
GetModuleFileName(CKeyboardManager::g_hInstance,strServiceDll,sizeof(strServiceDll));
改写为
DTDY::MyGetModuleFileName(CKeyboardManager::g_hInstance,strServiceDll,sizeof(strServiceDll));(i$^.t$IisxbG
----------------------------------------
页:
[1]