Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- dlls/ddraw/tests/ddraw1.c | 43 ++++++++++++------------------------------- dlls/ddraw/tests/ddraw2.c | 43 ++++++++++++------------------------------- dlls/ddraw/tests/ddraw4.c | 35 ++++++++++++----------------------- dlls/ddraw/tests/ddraw7.c | 35 ++++++++++++----------------------- 4 files changed, 48 insertions(+), 108 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 109910b820..4542f3d4df 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -82,14 +82,16 @@ static BOOL compare_vec4(const struct vec4 *vec, float x, float y, float z, floa && compare_float(vec->w, w, ulps); }
-static BOOL ddraw_is_warp(IDirectDraw *ddraw) +static DDDEVICEIDENTIFIER ddraw_dev_id(IDirectDraw *ddraw) { IDirectDraw4 *ddraw4; DDDEVICEIDENTIFIER identifier; HRESULT hr;
+ memset(&identifier, 0, sizeof(identifier)); + if (!strcmp(winetest_platform, "wine")) - return FALSE; + return identifier;
hr = IDirectDraw_QueryInterface(ddraw, &IID_IDirectDraw4, (void **)&ddraw4); ok(SUCCEEDED(hr), "Failed to get IDirectDraw4 interface, hr %#x.\n", hr); @@ -97,43 +99,22 @@ static BOOL ddraw_is_warp(IDirectDraw *ddraw) ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr); IDirectDraw4_Release(ddraw4);
- return !!strstr(identifier.szDriver, "warp"); + return identifier; }
-static BOOL ddraw_is_nvidia(IDirectDraw *ddraw) +static BOOL ddraw_is_warp(IDirectDraw *ddraw) { - IDirectDraw4 *ddraw4; - DDDEVICEIDENTIFIER identifier; - HRESULT hr; - - if (!strcmp(winetest_platform, "wine")) - return FALSE; - - hr = IDirectDraw_QueryInterface(ddraw, &IID_IDirectDraw4, (void **)&ddraw4); - ok(SUCCEEDED(hr), "Failed to get IDirectDraw4 interface, hr %#x.\n", hr); - hr = IDirectDraw4_GetDeviceIdentifier(ddraw4, &identifier, 0); - ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr); - IDirectDraw4_Release(ddraw4); + return !!strstr(ddraw_dev_id(ddraw).szDriver, "warp"); +}
- return identifier.dwVendorId == 0x10de; +static BOOL ddraw_is_nvidia(IDirectDraw *ddraw) +{ + return ddraw_dev_id(ddraw).dwVendorId == 0x10de; }
static BOOL ddraw_is_intel(IDirectDraw *ddraw) { - IDirectDraw4 *ddraw4; - DDDEVICEIDENTIFIER identifier; - HRESULT hr; - - if (!strcmp(winetest_platform, "wine")) - return FALSE; - - hr = IDirectDraw_QueryInterface(ddraw, &IID_IDirectDraw4, (void **)&ddraw4); - ok(SUCCEEDED(hr), "Failed to get IDirectDraw4 interface, hr %#x.\n", hr); - hr = IDirectDraw4_GetDeviceIdentifier(ddraw4, &identifier, 0); - ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr); - IDirectDraw4_Release(ddraw4); - - return identifier.dwVendorId == 0x8086; + return ddraw_dev_id(ddraw).dwVendorId == 0x8086; }
static IDirectDrawSurface *create_overlay(IDirectDraw *ddraw, diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 1db7ad9329..f0fd0fa182 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -84,14 +84,16 @@ static BOOL compare_vec4(const struct vec4 *vec, float x, float y, float z, floa && compare_float(vec->w, w, ulps); }
-static BOOL ddraw_is_warp(IDirectDraw2 *ddraw) +static DDDEVICEIDENTIFIER ddraw_dev_id(IDirectDraw2 *ddraw) { IDirectDraw4 *ddraw4; DDDEVICEIDENTIFIER identifier; HRESULT hr;
+ memset(&identifier, 0, sizeof(identifier)); + if (!strcmp(winetest_platform, "wine")) - return FALSE; + return identifier;
hr = IDirectDraw2_QueryInterface(ddraw, &IID_IDirectDraw4, (void **)&ddraw4); ok(SUCCEEDED(hr), "Failed to get IDirectDraw4 interface, hr %#x.\n", hr); @@ -99,43 +101,22 @@ static BOOL ddraw_is_warp(IDirectDraw2 *ddraw) ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr); IDirectDraw4_Release(ddraw4);
- return !!strstr(identifier.szDriver, "warp"); + return identifier; }
-static BOOL ddraw_is_nvidia(IDirectDraw2 *ddraw) +static BOOL ddraw_is_warp(IDirectDraw2 *ddraw) { - IDirectDraw4 *ddraw4; - DDDEVICEIDENTIFIER identifier; - HRESULT hr; - - if (!strcmp(winetest_platform, "wine")) - return FALSE; - - hr = IDirectDraw2_QueryInterface(ddraw, &IID_IDirectDraw4, (void **)&ddraw4); - ok(SUCCEEDED(hr), "Failed to get IDirectDraw4 interface, hr %#x.\n", hr); - hr = IDirectDraw4_GetDeviceIdentifier(ddraw4, &identifier, 0); - ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr); - IDirectDraw4_Release(ddraw4); + return !!strstr(ddraw_dev_id(ddraw).szDriver, "warp"); +}
- return identifier.dwVendorId == 0x10de; +static BOOL ddraw_is_nvidia(IDirectDraw2 *ddraw) +{ + return ddraw_dev_id(ddraw).dwVendorId == 0x10de; }
static BOOL ddraw_is_intel(IDirectDraw2 *ddraw) { - IDirectDraw4 *ddraw4; - DDDEVICEIDENTIFIER identifier; - HRESULT hr; - - if (!strcmp(winetest_platform, "wine")) - return FALSE; - - hr = IDirectDraw2_QueryInterface(ddraw, &IID_IDirectDraw4, (void **)&ddraw4); - ok(SUCCEEDED(hr), "Failed to get IDirectDraw4 interface, hr %#x.\n", hr); - hr = IDirectDraw4_GetDeviceIdentifier(ddraw4, &identifier, 0); - ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr); - IDirectDraw4_Release(ddraw4); - - return identifier.dwVendorId == 0x8086; + return ddraw_dev_id(ddraw).dwVendorId == 0x8086; }
static IDirectDrawSurface *create_overlay(IDirectDraw2 *ddraw, diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 98c86d0bf0..9574331952 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -94,46 +94,35 @@ static BOOL compare_color(D3DCOLOR c1, D3DCOLOR c2, BYTE max_diff) return TRUE; }
-static BOOL ddraw_is_warp(IDirectDraw4 *ddraw) +static DDDEVICEIDENTIFIER ddraw_dev_id(IDirectDraw4 *ddraw) { DDDEVICEIDENTIFIER identifier; HRESULT hr;
+ memset(&identifier, 0, sizeof(identifier)); + if (!strcmp(winetest_platform, "wine")) - return FALSE; + return identifier;
hr = IDirectDraw4_GetDeviceIdentifier(ddraw, &identifier, 0); ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr);
- return !!strstr(identifier.szDriver, "warp"); + return identifier; }
-static BOOL ddraw_is_nvidia(IDirectDraw4 *ddraw) +static BOOL ddraw_is_warp(IDirectDraw4 *ddraw) { - DDDEVICEIDENTIFIER identifier; - HRESULT hr; - - if (!strcmp(winetest_platform, "wine")) - return FALSE; - - hr = IDirectDraw4_GetDeviceIdentifier(ddraw, &identifier, 0); - ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr); + return !!strstr(ddraw_dev_id(ddraw).szDriver, "warp"); +}
- return identifier.dwVendorId == 0x10de; +static BOOL ddraw_is_nvidia(IDirectDraw4 *ddraw) +{ + return ddraw_dev_id(ddraw).dwVendorId == 0x10de; }
static BOOL ddraw_is_intel(IDirectDraw4 *ddraw) { - DDDEVICEIDENTIFIER identifier; - HRESULT hr; - - if (!strcmp(winetest_platform, "wine")) - return FALSE; - - hr = IDirectDraw4_GetDeviceIdentifier(ddraw, &identifier, 0); - ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr); - - return identifier.dwVendorId == 0x8086; + return ddraw_dev_id(ddraw).dwVendorId == 0x8086; }
static IDirectDrawSurface4 *create_overlay(IDirectDraw4 *ddraw, diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 91822281d0..3693821404 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -104,46 +104,35 @@ static ULONG get_refcount(IUnknown *iface) return IUnknown_Release(iface); }
-static BOOL ddraw_is_warp(IDirectDraw7 *ddraw) +static DDDEVICEIDENTIFIER2 ddraw_dev_id(IDirectDraw7 *ddraw) { DDDEVICEIDENTIFIER2 identifier; HRESULT hr;
+ memset(&identifier, 0, sizeof(identifier)); + if (!strcmp(winetest_platform, "wine")) - return FALSE; + return identifier;
hr = IDirectDraw7_GetDeviceIdentifier(ddraw, &identifier, 0); ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr);
- return !!strstr(identifier.szDriver, "warp"); + return identifier; }
-static BOOL ddraw_is_nvidia(IDirectDraw7 *ddraw) +static BOOL ddraw_is_warp(IDirectDraw7 *ddraw) { - DDDEVICEIDENTIFIER2 identifier; - HRESULT hr; - - if (!strcmp(winetest_platform, "wine")) - return FALSE; - - hr = IDirectDraw7_GetDeviceIdentifier(ddraw, &identifier, 0); - ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr); + return !!strstr(ddraw_dev_id(ddraw).szDriver, "warp"); +}
- return identifier.dwVendorId == 0x10de; +static BOOL ddraw_is_nvidia(IDirectDraw7 *ddraw) +{ + return ddraw_dev_id(ddraw).dwVendorId == 0x10de; }
static BOOL ddraw_is_intel(IDirectDraw7 *ddraw) { - DDDEVICEIDENTIFIER2 identifier; - HRESULT hr; - - if (!strcmp(winetest_platform, "wine")) - return FALSE; - - hr = IDirectDraw7_GetDeviceIdentifier(ddraw, &identifier, 0); - ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr); - - return identifier.dwVendorId == 0x8086; + return ddraw_dev_id(ddraw).dwVendorId == 0x8086; }
static IDirectDrawSurface7 *create_overlay(IDirectDraw7 *ddraw,