I am trying to develop a specific extension for the Desktop Window Manager. I chose the DLL insertion method and function. It is assumed that it works on Windows 7 and Windows 8.
I successfully injected my DLL into the dwm.exe process and enabled the creation of a Direct3D device (D3D10CreateDevice1 on Win7 and D3D11CreateDevice / D3D11Device :: GetImmediateContext on Win8). However, I have a problem with the drawing procedures (Draw / DrawIndexed / etc.).
Whenever I replace pointers to vtable with pointers to my functions, they are restored back to the original pointers after a while. There is probably some hook protection in DWM / Direct3D ??? I tried to create a background thread that replaces pointers. It works on Win7, but rarely on Win8 (it seems that pointers are restored faster there)
void thread(void* _device) { ID3D10Device1* device = (ID3D10Device1*)_device; while(threadRunning) { if(device->lpVtbl->Draw != My_ID3D10Device1_Draw) { DX_METHOD_HOOK(device, ID3D10Device1, Draw); DX_METHOD_HOOK(device, ID3D10Device1, DrawIndexed); } } }
Does anyone have any connection experience and can it help me? Thank you very much!
source share