So i tried to create a DirectDraw proxy dll.
What for? Well, e.g. for forcing old games into windowed mode to ease debugging them. Or for wasting my spare time, who knows.
To make it short, hooking IDirectDraw works flawlessly. I get full control there.
So I implemented an IDirectDrawSurface wrapper class exactly the same way as with IDirectDraw and modified CreateSurface to return my own object.
It strangely works for some time but eventually crashes. Anyone got a clue why this happens?