0

I am messing around with Direct3D - modifying vtable entries for a device object so that my functions get called instead the provided ones. I noticed that despite this mostly working, at points something restores the IDirect3DDevice9 vtable, for example ID3DXFont::DrawText - the very first call; ulterior ones don't touch it.

Why does this happen?

foxx1337
  • 1,859
  • 3
  • 19
  • 23
  • I'm looking for a lighter way to insert my calls, without patching `jmp`s inside the COM methods I want hooked (already works, but somehow being able to do it through the vtables would bring me more joy). – foxx1337 Aug 13 '11 at 23:25

1 Answers1

0

Modifying vtables is pretty much undefined behavior. Maybe there are caches or different copies of the vtable. It's all implementation dependent. You're lucky it works at all!

AshleysBrain
  • 22,335
  • 15
  • 88
  • 124
  • Taksi does it, but only for `AddRef` and `Release`. You'd advise I use the plain old `jmp` method? Keep in mind we're talking about COM objects' vtables, which aren't exactly like C++ objects' vtables. – foxx1337 Aug 13 '11 at 23:50