[PATCH v2 03/10] gdi32/tests: Add D3DKMTOpenAdapterFromGdiDisplayName tests.

Huw Davies huw at codeweavers.com
Thu May 23 07:55:45 CDT 2019


On Mon, May 20, 2019 at 08:43:43PM +0800, Zhiyi Zhang wrote:
> +static void test_D3DKMTOpenAdapterFromGdiDisplayName(void)
> +{
> +    D3DKMT_OPENADAPTERFROMGDIDISPLAYNAME open_adapter_gdi_desc;
> +    D3DKMT_CLOSEADAPTER close_adapter_desc;
> +    DISPLAY_DEVICEW display_device = {sizeof(display_device)};
> +    NTSTATUS status;
> +    DWORD i;
> +
> +    /* STATUS_PROCEDURE_NOT_FOUND on vista~win7 */
> +    lstrcpyW(open_adapter_gdi_desc.DeviceName, display1W);
> +    if (!pD3DKMTOpenAdapterFromGdiDisplayName
> +        || pD3DKMTOpenAdapterFromGdiDisplayName(&open_adapter_gdi_desc) == STATUS_PROCEDURE_NOT_FOUND

If you called pD3DKKMTOpenAdapterFromGdiDisplayName( NULL ) here you
wouldn't leak the adaptor handle.  This would also get the invalid
parameter test out of the way.

> +        || !pD3DKMTCloseAdapter)

There doesn't seem to be a need to test for D3DKMTCloseAdaper, we can
assume that's going to be present if we get this far.

Similar things apply to other patches in the series.

Huw.



More information about the wine-devel mailing list