Hi,
> + hr = DirectDrawCreateClipper(0, &clipper, NULL);
> + ref = get_refcount((IUnknown *)clipper);
You're not reading ref anywhere as far as I can see. Did you forget to re-check the refcount after creating the device?
If the refcount is incremented by 2 or more: See if the clipper is assigned to the render target and / or depth stencil. This wouldn't really do anything, but it's Microsoft we're talking about here.
> + memcpy(&driver, &IID_IDirect3DRGBDevice, sizeof(GUID));
I think an assignment should do the job.
There's no need to try to set the display mode to 8. Also testing if changing the mode works is outside the scope of this test. What's interesting is that the pixel format of the primary surface of a new device after changing the mode.