2

I have to do some memory reading in a game and some injection. However, to avoid race conditions, I need to inject my ASM code into the endscene.

Previously I have used this code:

uint D3D9_Device;
D3D9_Device = Memory.Read<uint>(Memory.BaseAddress + Direct3D9__Device);
D3D9_Device = Memory.Read<uint>(D3D9_Device + Direct3D9__Device__OffsetA);
D3D9_Device = Memory.Read<uint>(D3D9_Device);
D3D9_Device = Memory.Read<uint>(D3D9_Device + Direct3D9__Device__OffsetB);

To access the Dx9 device, and find the endscene using reversed offsets.

However, in windows 7, directx 11 is forced, which means that this read fails and gives a null object.

Any idea how I might perform a hook into the endscene of a game when DirectX 11 is in use?

Jens Björnhager
  • 5,632
  • 3
  • 27
  • 47
Jason
  • 2,445
  • 3
  • 17
  • 17

1 Answers1

0

You should be IAT hooking GetProcAddress and calls to D3DCreate, capturing the device pointer and hooking the VFTable from there. dunno how you 'reversed' the COM vftable offsets (these are predefined by how COM dlls are build, you need only count up the virtual methods defined in the DX SDK headers, start at 0, then multiply by sizeof(INT_PTR) to get the offset), but the way your reading them looks wrong too (you've got one too many indirections).

Try having a look at something like MSDetours, it has an example on COM object hooking. you can also give this question a read through too

Marcs
  • 3,768
  • 5
  • 33
  • 42
Necrolis
  • 25,836
  • 3
  • 63
  • 101