<div dir="ltr"><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><pre>This is by no means a full review, just a couple of obvious things I noticed.

On 24 June 2015 at 17:02, Aaryaman Vasishta <<a href="https://www.winehq.org/mailman/listinfo/wine-devel">jem456.vasishta at gmail.com</a>> wrote:
><i> +static HRESULT CALLBACK surface_callback(IDirectDrawSurface *surface, DDSURFACEDESC *desc, void *context)
</i>><i> +{
</i>><i> +    IDirectDrawClipper *d3drm_clipper = NULL;
</i>Initializing this to NULL is pointless, you initialize it before all
uses with the IDirectDrawSurface_GetClipper() call below.

><i> +        if (context)
</i>><i> +        {
</i>"context" should always be non-NULL here.

><i> +            hr = IDirectDrawSurface_GetClipper(surface, &d3drm_clipper);
</i>><i> +            ok(hr == DD_OK, "Cannot get attached clipper from primary surface (hr = %x).\n", hr);
</i>><i> +            if (SUCCEEDED(hr))
</i>You have an ok() one line above that states "hr == DD_OK" at this
point. If the GetClipper() call failed you'd get a test failure.

Once you've found the primary you can of course return DDENUMRET_CANCEL.

I think you're making things too complicated though. I'd just call
EnumSurfaces() with "&primary" as context pointer, set it in the
callback, and then just do the rest of the tests after EnumSurfaces()
returns, instead of trying to fit those into the callback.</pre></blockquote><div>Thank you for the suggestions! I have decided to return the primary surface directly, and set it to NULL if it doesn't exist via the context, something like this, which seems to run fine on my windows machine:<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">static HRESULT CALLBACK surface_callback(IDirectDrawSurface *surface, DDSURFACEDESC *desc, void **context)<br>{<br>    IDirectDrawClipper *d3drm_clipper;<br>    HRESULT hr;<br><br>    if (desc->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)<br>    {<br>        *context = surface;<br>        return DDENUMRET_CANCEL;<br>    }<br>    IDirectDrawSurface_Release(surface);<br><br>    return DDENUMRET_OK;<br>}<br></blockquote><div>Then in the tests, simply check if the context returned is NULL, if yes then perform related tests on it inside the test.<br><br><br></div><div>Thank you!<br></div></div></div>