Hi,
Your CreateSurface tests are missing in this patch(assuming that paulo lesgaz is your alter ego)
There's a comment above the SetCooperativeLevel implementation that needs adjustments.
if(cooplevel & DDSCL_NORMAL) {
/* Can't coexist with fullscreen or exclusive */
if(cooplevel & (DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE) )
/* Can't coexist with exclusive only*/
if(cooplevel = DDSCL_NORMAL | DDSCL_EXCLUSIVE )
This check doesn't do what you intend it to do. An application may pass NORMAL | EXCLUSIVE | FPUSETUP for instance
Also, your test shows that NORMAL | EXCLUSIVE | FULLSCREEN means fullscreen mode. The CreateSurface test passes because the FULLSCREEN and EXCLUSIVE flags are added, but the window is still set up for windowed rendering. In this flag combination you want to enter the fullscreen setup codepath.