2010-12-02 33 views
2

我必須在遊戲中進行一些內存讀取和一些注入。但是,爲了避免競爭條件,我需要將我的ASM代碼注入到endcene中。Hooking Direct X在Direct X 11中的Endscene遊戲

此前我已經使用這個代碼:

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); 

要訪問Dx9中設備,並找到利用反向偏置的endscene。

但是,在Windows 7中,強制使用directx 11,這意味着此讀取失敗並給出空對象。

任何想法如何在DirectX 11使用時執行鉤子到遊戲的endcene?

回答

0

你應該是IAT掛鉤GetProcAddress和調用D3DCreate,捕獲設備指針並從那裏掛鉤VFTable。不知道你如何'扭轉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)`來獲得偏移量),但是你閱讀它們的方式看起來也是錯誤的(你有一個太多的indirections)。

試着看看類似MSDetours的東西,它有一個COM對象掛鉤的例子。你也可以給this question一個朗讀