Intercepting Direct3D9Device methods - can't get it to work.

Giganews Newsgroups
Subject: Intercepting Direct3D9Device methods - can't get it to work.
Posted by:  R.Wieser (addre…@not.available)
Date: Mon, 5 Aug 2019

Hello all,

I'm trying to intercept selected Direct3D9Device methods, but cannot even
get the basics to run. :-(

What I'm doing:

After calling the CreateDevice method I allocate some memory enough for the
119 methods Direct3D9Device has, copy the VTable into that memory, and
replace the pointer to the origional VTable with the one from the just
allocated memory.  Nothing more.  Not even a single redirection.

The program (game) crashes on startup (just after the CreateDevice method
returns) . :-(

After a look at the origional VTable I noticed that it seemed to be quite a
bit longer than the decription I got, namely 160 entries.    Alas, when I
allocate for, and copy that ammount the program doesn't crash, but after the
initial selection screen the game screen stays black.

It does still seem to respond to keypresses though, even causing the
mousepointer to pop up when it should. Also,"graciously" exiting using
ALT-F4 also works.  In other words, the program doesn't seem to have
crashed.

Does anyone recognise the approach and can tell me what/where it goes wrong
?

Regards,
Rudy Wieser

P.s.
When using another approach - creating a full in-between Direct3D9Device
object implementing just/all 119 methods (most just a bit of logging and
than pass-thru) - the program works without a problem.

Replies