On 5/23/19 8:55 PM, Huw Davies wrote:
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. Thanks.
The reason I am not using NULL parameter here because it will return STATUS_INVALID_PARAMETER instead of STATUS_PROCEDURE_NOT_FOUND.
+ || !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.
Sure.
Huw.