1

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

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
Echeg
  • 2,321
  • 2
  • 21
  • 26
  • So you've got a detour for SendMessage, but what you really need is to detour the Direct3D API stream. Funny you brought up Matthew Fischer's link, because I'm actually trying to recreate that project in managed C#. I can't help you with C++, but definitely download Fischer's source. You'll notice he doesn't use Detours to intercept Diret3D. He simply puts his *own* d3d9.dll (read up on why this works). He has to recreate most of the interfaces for his wrapper but it works. – Jason Nov 13 '12 at 09:45

1 Answers1

0

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.

real4x
  • 1,433
  • 12
  • 11