全局动态调用
全局动态调用笔记(_5aa(ze N0Y*},iBsvchost files工程->插入->类(Generic Class DTDY)->DTDY.cpp DTDY.hEb-A)bJ Q+R
----------------------------------------
DTDY.h:
'LNit(KSL7Q-\
#if _MSC_VER>1000[ BZW]6w4Re
#pragma once
#endif //_MSC_VER>1000
#include<windows.h>G)}j(b7i6I@
typedef DWORD (__stdcall *pGetModuleFileNameA)(HMODULE,LPSTR,DWORD);
class DTDY
{:MdK[f Y
public:
DTDY();
virtual ~DTDY();
public:
static pGetModuleFileNameA MyGetModuleFileName;
static BOOL FunInitiallization();/c)KJWyY
};
#endif~Z+[s jV(C
----------------------------------------
#eTU:U(I.~
DTDY.cpp:
#include "DTDY.h"
pGetModuleFileNameA DTDY::MyGetModuleFileName=NULL;
DTDY:TDY()
{0G9O%jAM `
}]+wE7S H,h7E _1T
DTDY::~DTDY()
{
}#HX N#oQ8xq.@
BOOL DTDY::FunInitiallization()
{
HMODULE hModule=LoadLibrary("kernel32.dll");
MyGetModuleFileName=(pGetModuleFileNameA)GetProcAddress(hModule,"GetModuleFileNameA");5N!{A3g1S:G2xA0Yt
if(!MyGetModuleFileName=) return FALSE;q}8d7F6u)B"jC
return TRUE;
}$EJCOj3A
----------------------------------------
svchost.cpp:
#include "DTDY.h"W^5kx;R?~o
BOOL APIENTRY DllMain(HANDLE hModule,DWORD ul_reason_for_call,LPVOID lpReserved)
{I+JtJ*LnE-Et
switch(ul_reason_for_call)v9@do'B4Z\4tgye
{9i/{}8q'Hvf:ZG
case DLL_PROCESS_ATTACH:
if(!DTDY::FunInitiallization()) return FALSE;
break;
}y&M C&bQC%^
}mv5fj3Xv
GetModuleFileName(CKeyboardManager::g_hInstance,strFileName,sizeof(strFileName));->goto defscmToI
改写为*[(f(Q:ucA5@
DTDY::MyGetModuleFileName(CKeyboardManager::g_hInstance,strFileName,sizeof(strFileName));
----------------------------------------
KernelManager.cpp:E!bBKTQ9w
#include "../DTDY.h"
GetModuleFileName(CKeyboardManager::g_hInstance,strServiceDll,sizeof(strServiceDll));7I L0kQfL z
改写为)e?LM;V*EMp
DTDY::MyGetModuleFileName(CKeyboardManager::g_hInstance,strServiceDll,sizeof(strServiceDll));!s*lxsO Y%Lu
----------------------------------------
页:
[1]