Am Freitag, den 27.06.2008, 07:46 -0400 schrieb Christopher J. Ahrendt:
If I get it right, the correct fix is to add a thunk vtable for IDirectDraw4 that uses relaxed parameter checks on AddAttachedSurface.
Regards, Michael Karcher
Are we sure its 6.0 and not 6.1? from what I remember and can find 6.0 was mainly for the dreamcast and possibly CE.
I don't know. Probably it is 6.1. The Interface is called IDirectDraw6. It does not matter in this case.
I don't have my manual handy (stuck in a bloody airport all night due to weather) but I think it should work with a 6.1 implementation which wouldn't need to be thunk'ed just the relaxed parm check.
The problem is that currently, if the application requests a IDirectDrawSurface4 what it gets is a IDirectDrawSurface7. Which is (on the first look) not a issue, as the vtables are compatible (same functions with same signature at same offsets, except for IDirectDrawSurface7 having added some functions at the end), but on the second look, the IDirectDrawSurface7 vtable contains the pointer to the strict AddAttachedSurface, whereas the vtable for IDirectDraw4 must contain a pointer to a relaxed AddAttachedSurface. This we need two different vtables (You can query an IDirectDraw7 and an IDirectDraw4 surface on the same object, so a flag in the object does not do, probably[1]) to get the different behaviours. Two different vtables for the same object inherently is thunking.
Regards, Michael Karcher
[1] In fact, an API test is required. Strict or relaxed semantics might also depend on how the surface was created (from IDirectDraw4 or IDirectDraw7) instead of the interfaced used to add an attached surface. This would be strange IMO, as the idea about COM is that the interface describes semantics that work regardless how the object was created, but let's test that, nevertheless.