首页
社区
课程
招聘
未解决 [求助] 实用d3d9 虚拟表hook DrawIndexedPrimitive导致程序崩溃 救救孩子吧
发表于: 2019-4-19 18:06 2968

未解决 [求助] 实用d3d9 虚拟表hook DrawIndexedPrimitive导致程序崩溃 救救孩子吧

2019-4-19 18:06
2968
获取虚拟表的地址为6688b6b1(windows7 64  我感觉实用虚拟表获取错误了 之前手动hook并不是这个地址)
救救我吧 琢磨一天了!!!

void Cheat::Initialize()
{
	AllocConsole();
	freopen("CON", "w", stdout);
	SetConsoleTitleA("CheatDll");
	
	HWND hwnd =FindWindow(NULL, "D3D Tutorial 05: Textures");
	sd.Windowed = TRUE;
	sd.SwapEffect = D3DSWAPEFFECT_COPY;
	sd.BackBufferFormat = D3DFMT_UNKNOWN;
	g_pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &sd, &D3DVT);
	
	void ** pVTable = *reinterpret_cast<void ***>(D3DVT);
	_DrawIndexedPrimitive = (DrawIndexedPrimitive)(pVTable[82]);

	printf("%d", (int)hwnd);
	printf("_DrawIndexedPrimitive Address:%x \n", (int)_DrawIndexedPrimitive);
	Hook::HookFunction((PVOID*)&_DrawIndexedPrimitive, hooks::My_DrawIndexedPrimitive);

}
#include"stdafx.h"
#include"hook.h"
#include<detours.h>

//HOOK的代码封装成函数了
void Hook::HookFunction(PVOID *oFunction, PVOID pDetour)
{
	DetourTransactionBegin();
	DetourUpdateThread(GetCurrentThread());
	DetourAttach(oFunction, pDetour);
	DetourTransactionCommit();
}
void Hook::UnHookFunction(PVOID *oFunction, PVOID pDetour)
{
	DetourTransactionBegin();
	DetourUpdateThread(GetCurrentThread());
	DetourDetach(oFunction, pDetour);
	DetourTransactionCommit();
}



定义HOOKs.h头  



开始hook的代码

#include "stdafx.h"
#include"hooks.h"

namespace hooks
{
	DrawIndexedPrimitive oPresent;
	bool bOnce = false;
	HRESULT __stdcall My_DrawIndexedPrimitive(
		LPDIRECT3DDEVICE9 pDevice,
		D3DPRIMITIVETYPE type,
		INT BaseVertexIndex,
		UINT MinIndex,
		UINT NumVertices,
		UINT StartIndex,
		UINT PrimitiveCount) {
		if (!bOnce)
		{
			///
		}
		printf("666");
		return oPresent(pDevice,type, BaseVertexIndex, MinIndex, NumVertices, StartIndex, PrimitiveCount);
	}
}


[课程]FART 脱壳王!加量不加价!FART作者讲授!

收藏
免费 0
支持
分享
最新回复 (2)
雪    币: 914
活跃值: (2288)
能力值: ( LV5,RANK:68 )
在线值:
发帖
回帖
粉丝
2
你不知道d3d9.dll 每次加载 地址都不一样吗
DrawIndexedPrimitive在 win7 x64上固定在
d3d9.dll+2B6B1 这个地址
2019-4-20 11:11
0
雪    币: 446
活跃值: (595)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
万剑归宗 你不知道d3d9.dll 每次加载 地址都不一样吗[em_13] DrawIndexedPrimitive在 win7 x64上固定在 d3d9.dll+2B6B1 这个地址
知道~~现在已经解决了~ ~
2019-4-20 19:26
0
游客
登录 | 注册 方可回帖
返回
//