When I started, I thought it'd just be a case of changing the calls to IDirectDraw7::SetCooperativeLevel and IDirectDraw7::SetDisplayMode to prevent it going fullscreen.
Unfortunately, the game doesn't use DDraw7, it creates a IDirectDraw interface instead, and calls it's version of functions. Also, changing the cooperative level prevents the game from making a swap chain, so I had to make my own swap chain class which is a IDirectDrawSurface proxy, and manages two real surfaces internally, calling Blt() when Flip() is called.
That also worked, but it left huge black smears over the desktop. So I added a clipper, which sorted that.
My current problem is that the game crashes reading some weird address (somewhere above 0xe0000000, which makes me think it's a surface lock (it's in kernel space) or a completely borked address). The call stack says that the crash happens in _DD_Surface_BltFast, but nothing calls my version of that. After a bit of poking about, it turns out that there were some QueryInterface() calls I didn't spot, where the game asks for an IDirectDraw2 interface, a IDirectDraw4 interface, a IDirectDrawSurface2 interface and a IDirectDrawSurface4 interface, as well as a couple of D3D ones.
So, I need to implement proxy classes for those interfaces too. I'll probably just end up making a version 4 interface and casting it to the "lower" interfaces, since the vtable is backwards compatible (But v4 interfaces take IDirectDrawSurface4* parameters and so on, meaning I need to cast bits and pieces).
Another problem is that the window style is still WS_POPUPWINDOW, and I'd like to make it WS_OVERLAPPEDWINDOW, but I can see that having all sorts of issues, so I might end up subclassing the window.
And yes, I know this is complete and utter overkill. My reasoning is that if I can get this working fully, I can make windowed mode versions of any game using D3D7 or below. Which would be nice. But also pointless.
Oh well. It's after midnight, and I've just realised I forgot to eat this evening. And I forgot to watch Heroes.
*Sigh*