资源简介
魔兽写屏代码,具体见
http://blog.csdn.net/langyanduan/article/details/7337290
代码片段和文件信息
#include
#include
#include
#pragma comment(lib “detours.lib“)
// globals
// Our hook function
IDirect3D8* __stdcall hook_Direct3DCreate8(UINT sdkVers);
HMODULE WINAPI LoadLibrary_Hook ( LPCSTR lpFileName );
void HookAPI();
// CreateDevice
typedef HRESULT (APIENTRY *CreateDevice_t)(
IDirect3D8*
UINTD3DDEVTYPE
HWNDDWORD
D3DPRESENT_PARAMETERS*
IDirect3DDevice8**);
CreateDevice_t orig_CreateDevice;
HRESULT APIENTRY hook_CreateDevice(
IDirect3D8* pInterface
UINT Adapter
D3DDEVTYPE DeviceType
HWND hFocusWindow
DWORD BehaviorFlags
D3DPRESENT_PARAMETERS* pPresentationParameters
IDirect3DDevice8** ppReturnedDeviceInterface);
// The original to call
typedef IDirect3D8* (__stdcall *Direct3DCreate8_t)(UINT SDKVersion);
Direct3DCreate8_t orig_Direct3DCreate8;
// Holds address that we get in our LoadLibrary hook (used for detour)
PBYTE pDirect3DCreate8;
typedef HMODULE (WINAPI *LoadLibrary_t)(LPCSTR);
LoadLibrary_t orig_LoadLibrary = LoadLibraryA; // holds address of original non-detoured function
BOOL APIENTRY DllMain( HMODULE hModule DWORD ul_reason_for_call LPVOID lpReserved)
{
switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH:
{
DisableThreadLibraryCalls(hModule);
DetourRestoreAfterWith();
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourAttach(&(PVOID&)orig_LoadLibrary LoadLibrary_Hook);
DetourTransactionCommit();
}
}
return TRUE;
}
// Our hooked LoadLibrary
HMODULE WINAPI LoadLibrary_Hook ( LPCSTR lpFileName )
{
static int hooked = 0;
HMODULE hM = orig_LoadLibrary( lpFileName );
if ( strcmp( lpFileName “d3d8.dll“ ) == 0)
{
hooked++;
if (hooked == 3) {
// get address of function to hook
pDirect3DCreate8 = (PBYTE)GetProcAddress(hM “Direct3DCreate8“);
HookAPI();
}
}
return hM;
}
void HookAPI()
{
// simple detour
orig_Direct3DCreate8 = (Direct3DCreate8_t)pDirect3DCreate8;
DetourRestoreAfterWith();
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourAttach(&(PVOID&)orig_Direct3DCreate8 hook_Direct3DCreate8);
DetourTransactionCommit();
}
DWORD* GetVtableAddress(void* pobject)
{
// The first 4 bytes of the object is a pointer to the vtable:
return (DWORD*)*((DWORD*)pobject);
}
void HookFunction(DWORD* pVtable void* pHookProc void* pOldProc int iIndex)
{
// Enable writing to the vtable at address we aquired
DWORD lpflOldProtect;
VirtualProtect((void*)&pVtable[iIndex] sizeof(DWORD) PAGE_READWRITE &lpflOldProtect);
// Store old address
if (pOldProc) {
*(DWORD*)pOldProc = pVtable[iIndex];
}
// Overwrite original address
pVtable[iIndex] = (DWORD)pHookProc;
// Restore protection
VirtualProtect(pVtable sizeof(DWORD) lpflOldProtect &lpflOldProtect);
}
IDirect3D8* __stdcall hook_Direct3DCreate8(UINT sdkVers)
{
IDirect3D8* pD3d8 = orig
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2012-03-09 16:12 Loader\
目录 0 2012-03-09 16:12 Loader\dll\
文件 4657 2012-03-06 14:10 Loader\dll\dll.vcxproj
文件 942 2012-03-03 00:58 Loader\dll\dll.vcxproj.filters
文件 143 2012-03-03 00:19 Loader\dll\dll.vcxproj.user
文件 4039 2012-03-09 15:58 Loader\dll\main.cpp
目录 0 2012-03-09 16:12 Loader\hooker\
文件 4868 2012-03-06 14:10 Loader\hooker\hooker.vcxproj
文件 942 2012-03-06 12:05 Loader\hooker\hooker.vcxproj.filters
文件 143 2012-03-06 10:03 Loader\hooker\hooker.vcxproj.user
文件 5621 2012-03-09 16:06 Loader\hooker\main.cpp
文件 1268 2012-03-06 10:03 Loader\hooker\main.h
目录 0 2012-03-09 16:12 Loader\Loader\
文件 1790 2012-03-06 12:05 Loader\Loader.sln
文件 15872 2012-03-09 16:11 Loader\Loader.suo
文件 1184 2012-03-09 12:45 Loader\Loader\inject.cpp
文件 156 2012-03-09 12:44 Loader\Loader\inject.h
文件 4025 2012-03-03 00:58 Loader\Loader\Loader.vcxproj
文件 1151 2012-03-03 00:58 Loader\Loader\Loader.vcxproj.filters
文件 143 2012-03-03 00:08 Loader\Loader\Loader.vcxproj.user
文件 1543 2012-03-09 13:31 Loader\Loader\main.cpp
- 上一篇:QQ截图绿色版
- 下一篇:Tcl_Telnet
相关资源
- HFSS喇叭天线仿真文件
- 带状线转微带线仿真HFSS
- 弯曲线单极子天线2.45GHzHFSS仿真设计
- SMA射频接口HFSS仿真文件
- 2D Pathfinding.zip
- HFSS_sma_模型
- HFSS射频仿真设计大全_PDF_工程文件
- FlashFXP最新 注册码 注册机
- 同轴-矩形波导仿真HFSS
- 2.45GHz贴片天线
- 同轴探针微带贴片天线
- hfss 天线模型 22种
- 基于HFSS的半波偶极子天线仿真
- HFSS天线模型导入PCB layout步骤.pdf
- 实验一 绘图类及其对象程序设计
- 方向图赋形的锥形振子天线HFSS设计
- HFSS平面螺旋天线设计
- HFSS螺旋天线仿真
- HFSS与腔体滤波器的设计
- Http File Server (HFS) 专用HFS模板 最终
- Http File Server (HFS) 专用HFS模板 最新
- PCB倒F天线HFSS模型
- 运用AnsoftHFSS设计圆极化微带天线阵
- HFSS15.0_WINx64完美破解版_详细图文破解
- 威尔金森wilkinson功率分配器
- Txline使用说明书.pdf
- 微带天线HFSS仿真
- 倒F天线HFSS仿真
- 喇叭天线模型
- 基于HFSS的圆锥喇叭天线设计
评论
共有 条评论