Hi all,
I'm currently trying to learn how to draw on WoW by hooking the DirectX functions, however I've run into a problem I don't know how to approach.
I can successfully create a D3DDevice (and grab functions from its vtable) from an injected dll, however doing so causes a number of problems to appear, notably:
Lua errors (triggered by combat log and appear occasionally): https://i.imgur.com/EzFjHTh.png
Latency jumping to an incredibly high number: https://i.imgur.com/zyoJKlP.png
WoW hanging when closed after logging into the game world (but not if hook is only done on the login screen)
My only assumption is that there's some kind of memory corruption going on, but I have no idea what could be causing it or how to fix it.
These problems only appear when the d3d9device is created, and not before.
Here is my code (called from WoW's main thread):
Code:
// 0x20
LPDIRECT3D9 Direct3D_Object = Direct3DCreate9(D3D_SDK_VERSION);
D3DPRESENT_PARAMETERS params;
ZeroMemory(¶ms, sizeof(params));
params.Windowed = true;
params.SwapEffect = D3DSWAPEFFECT_DISCARD;
params.BackBufferFormat = D3DFMT_UNKNOWN;
IDirect3DDevice9* device = nullptr;
// Was using WoW's HWND before this, added this to see if that was the issue
HWND window = CreateWindowA("STATIC", "dummy", 0, 0, 0, 100, 100, NULL, NULL, NULL, NULL);
// After this line is executed, problems appear
HRESULT result = Direct3D_Object->CreateDevice(0x0, D3DDEVTYPE_HAL, window, D3DCREATE_SOFTWARE_VERTEXPROCESSING, ¶ms, &device);
if (result < 0)
{
PrintD3DError(result);
return;
}
return;
Any help would be greatly appreciated. Thank you!