There is a racing game, I need to collect telemetry and statistics. And to add an additional HUD
I compiled the Detours. And could make the hook to change the name of the application window.Like:
LRESULT (WINAPI * TrueSendMessageW)(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) = SendMessageW;
__declspec(dllexport) LRESULT WINAPI MySendMessageW(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
if (Msg == WM_SETTEXT)
return TrueSendMessageW(hWnd, Msg, wParam, (LPARAM)L"new name window");
return TrueSendMessageW(hWnd, Msg, wParam, lParam);
}
...
And run it with withdll.exe. All ok.
But I cannot figure out how to intercept direct3d. With the help of API monitor, I found that the program uses Microsoft.Xna.Framework.Graphics.dll
IDirect3DDevice9::SetTexture
Can someone tell how to get this texture? In general, I would like to get something like link
Detour intercepts OS API calls and Direct3D is implemented via COM object concept. You probably can intercept the very first step of D3D device object creation but after this point you'll have to deal with COM object interfaces and Detour won't be helping you.