Patch 7:
> + if (!(desc.ddsCaps.dwCaps & DDSCAPS_3DDEVICE))
> + return DDERR_INVALIDCAPS;
Do you need an explicit check for this? I imagine that IDirect3D2::CreateDevice or IDirectDrawSurface::QueryInterface(&IID_IDirect3DDevice) take care of this task for you.