Commit a4bf8108 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

ddraw/tests: Build refcount.c without -DWINE_NO_LONG_TYPES.

parent cc7eae0c
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#define WINE_NO_LONG_TYPES
#define COBJMACROS #define COBJMACROS
#include "wine/test.h" #include "wine/test.h"
...@@ -57,7 +56,7 @@ static void test_ddraw_objects(void) ...@@ -57,7 +56,7 @@ static void test_ddraw_objects(void)
DDSURFACEDESC2 ddsd; DDSURFACEDESC2 ddsd;
hr = pDirectDrawCreateEx(NULL, (void **) &DDraw7, &IID_IDirectDraw7, NULL); hr = pDirectDrawCreateEx(NULL, (void **) &DDraw7, &IID_IDirectDraw7, NULL);
ok(hr == DD_OK || hr==DDERR_NODIRECTDRAWSUPPORT, "DirectDrawCreateEx returned: %x\n", hr); ok(hr == DD_OK || hr == DDERR_NODIRECTDRAWSUPPORT, "Got hr %#lx.\n", hr);
if(!DDraw7) if(!DDraw7)
{ {
trace("Couldn't create DDraw interface, skipping tests\n"); trace("Couldn't create DDraw interface, skipping tests\n");
...@@ -65,25 +64,25 @@ static void test_ddraw_objects(void) ...@@ -65,25 +64,25 @@ static void test_ddraw_objects(void)
} }
hr = IDirectDraw7_QueryInterface(DDraw7, &IID_IDirectDraw4, (void **) &DDraw4); hr = IDirectDraw7_QueryInterface(DDraw7, &IID_IDirectDraw4, (void **) &DDraw4);
ok(hr == DD_OK, "IDirectDraw7_QueryInterface returned %08x\n", hr); ok(hr == DD_OK, "Got hr %#lx.\n", hr);
hr = IDirectDraw7_QueryInterface(DDraw7, &IID_IDirectDraw2, (void **) &DDraw2); hr = IDirectDraw7_QueryInterface(DDraw7, &IID_IDirectDraw2, (void **) &DDraw2);
ok(hr == DD_OK, "IDirectDraw7_QueryInterface returned %08x\n", hr); ok(hr == DD_OK, "Got hr %#lx.\n", hr);
hr = IDirectDraw7_QueryInterface(DDraw7, &IID_IDirectDraw, (void **) &DDraw1); hr = IDirectDraw7_QueryInterface(DDraw7, &IID_IDirectDraw, (void **) &DDraw1);
ok(hr == DD_OK, "IDirectDraw7_QueryInterface returned %08x\n", hr); ok(hr == DD_OK, "Got hr %#lx.\n", hr);
ref = getRefcount( (IUnknown *) DDraw7); ref = getRefcount( (IUnknown *) DDraw7);
ok(ref == 1, "Got refcount %d, expected 1\n", ref); ok(ref == 1, "Got refcount %ld, expected 1\n", ref);
/* Fails without a cooplevel */ /* Fails without a cooplevel */
hr = IDirectDraw7_CreatePalette(DDraw7, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, Table, &palette, NULL); hr = IDirectDraw7_CreatePalette(DDraw7, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, Table, &palette, NULL);
ok(hr == DDERR_NOCOOPERATIVELEVELSET, "CreatePalette returned %08x\n", hr); ok(hr == DDERR_NOCOOPERATIVELEVELSET, "Got hr %#lx.\n", hr);
/* This check is before the cooplevel check */ /* This check is before the cooplevel check */
hr = IDirectDraw7_CreatePalette(DDraw7, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, Table, &palette, (void *) 0xdeadbeef); hr = IDirectDraw7_CreatePalette(DDraw7, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, Table, &palette, (void *) 0xdeadbeef);
ok(hr == CLASS_E_NOAGGREGATION, "CreatePalette returned %08x\n", hr); ok(hr == CLASS_E_NOAGGREGATION, "Got hr %#lx.\n", hr);
hr = IDirectDraw7_SetCooperativeLevel(DDraw7, 0, DDSCL_NORMAL); hr = IDirectDraw7_SetCooperativeLevel(DDraw7, 0, DDSCL_NORMAL);
ok(hr == DD_OK, "SetCooperativeLevel failed with %08x\n", hr); ok(hr == DD_OK, "Got hr %#lx.\n", hr);
memset(&ddsd, 0, sizeof(ddsd)); memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd); ddsd.dwSize = sizeof(ddsd);
...@@ -98,98 +97,98 @@ static void test_ddraw_objects(void) ...@@ -98,98 +97,98 @@ static void test_ddraw_objects(void)
hr = IDirectDraw7_CreateSurface(DDraw7, &ddsd, &surface, NULL); hr = IDirectDraw7_CreateSurface(DDraw7, &ddsd, &surface, NULL);
if (!surface) if (!surface)
{ {
win_skip("Could not create surface : %08x\n", hr); win_skip("Could not create surface : %#lx\n", hr);
IDirectDraw_Release(DDraw1); IDirectDraw_Release(DDraw1);
IDirectDraw2_Release(DDraw2); IDirectDraw2_Release(DDraw2);
IDirectDraw4_Release(DDraw4); IDirectDraw4_Release(DDraw4);
IDirectDraw7_Release(DDraw7); IDirectDraw7_Release(DDraw7);
return; return;
} }
ok(hr == DD_OK, "CreateSurface failed with %08x\n", hr); ok(hr == DD_OK, "Got hr %#lx.\n", hr);
/* DDraw refcount increased by 1 */ /* DDraw refcount increased by 1 */
ref = getRefcount( (IUnknown *) DDraw7); ref = getRefcount( (IUnknown *) DDraw7);
ok(ref == 2, "Got refcount %d, expected 2\n", ref); ok(ref == 2, "Got refcount %ld, expected 2\n", ref);
/* Surface refcount starts with 1 */ /* Surface refcount starts with 1 */
ref = getRefcount( (IUnknown *) surface); ref = getRefcount( (IUnknown *) surface);
ok(ref == 1, "Got refcount %d, expected 1\n", ref); ok(ref == 1, "Got refcount %ld, expected 1\n", ref);
hr = IDirectDraw7_CreatePalette(DDraw7, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, Table, &palette, NULL); hr = IDirectDraw7_CreatePalette(DDraw7, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, Table, &palette, NULL);
ok(hr == DD_OK, "CreatePalette returned %08x\n", hr); ok(hr == DD_OK, "Got hr %#lx.\n", hr);
/* DDraw refcount increased by 1 */ /* DDraw refcount increased by 1 */
ref = getRefcount( (IUnknown *) DDraw7); ref = getRefcount( (IUnknown *) DDraw7);
ok(ref == 3, "Got refcount %d, expected 3\n", ref); ok(ref == 3, "Got refcount %ld, expected 3\n", ref);
/* Palette starts with 1 */ /* Palette starts with 1 */
ref = getRefcount( (IUnknown *) palette); ref = getRefcount( (IUnknown *) palette);
ok(ref == 1, "Got refcount %d, expected 1\n", ref); ok(ref == 1, "Got refcount %ld, expected 1\n", ref);
/* Test attaching a palette to a surface */ /* Test attaching a palette to a surface */
hr = IDirectDrawSurface7_SetPalette(surface, palette); hr = IDirectDrawSurface7_SetPalette(surface, palette);
ok(hr == DD_OK, "IDirectDrawSurface_SetPalette failed with %08x\n", hr); ok(hr == DD_OK, "Got hr %#lx.\n", hr);
/* Palette refcount increased, surface stays the same */ /* Palette refcount increased, surface stays the same */
ref = getRefcount( (IUnknown *) palette); ref = getRefcount( (IUnknown *) palette);
ok(ref == 2, "Got refcount %d, expected 2\n", ref); ok(ref == 2, "Got refcount %ld, expected 2\n", ref);
ref = getRefcount( (IUnknown *) surface); ref = getRefcount( (IUnknown *) surface);
ok(ref == 1, "Got refcount %d, expected 1\n", ref); ok(ref == 1, "Got refcount %ld, expected 1\n", ref);
IDirectDrawSurface7_Release(surface); IDirectDrawSurface7_Release(surface);
/* Increased before - decrease now */ /* Increased before - decrease now */
ref = getRefcount( (IUnknown *) DDraw7); ref = getRefcount( (IUnknown *) DDraw7);
ok(ref == 2, "Got refcount %d, expected 2\n", ref); ok(ref == 2, "Got refcount %ld, expected 2\n", ref);
/* Releasing the surface detaches the palette */ /* Releasing the surface detaches the palette */
ref = getRefcount( (IUnknown *) palette); ref = getRefcount( (IUnknown *) palette);
ok(ref == 1, "Got refcount %d, expected 1\n", ref); ok(ref == 1, "Got refcount %ld, expected 1\n", ref);
IDirectDrawPalette_Release(palette); IDirectDrawPalette_Release(palette);
/* Increased before - decrease now */ /* Increased before - decrease now */
ref = getRefcount( (IUnknown *) DDraw7); ref = getRefcount( (IUnknown *) DDraw7);
ok(ref == 1, "Got refcount %d, expected 1\n", ref); ok(ref == 1, "Got refcount %ld, expected 1\n", ref);
/* Not all interfaces are AddRefed when a palette is created */ /* Not all interfaces are AddRefed when a palette is created */
hr = IDirectDraw4_CreatePalette(DDraw4, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, Table, &palette, NULL); hr = IDirectDraw4_CreatePalette(DDraw4, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, Table, &palette, NULL);
ok(hr == DD_OK, "CreatePalette returned %08x\n", hr); ok(hr == DD_OK, "Got hr %#lx.\n", hr);
ref = getRefcount( (IUnknown *) DDraw4); ref = getRefcount( (IUnknown *) DDraw4);
ok(ref == 2, "Got refcount %d, expected 2\n", ref); ok(ref == 2, "Got refcount %ld, expected 2\n", ref);
IDirectDrawPalette_Release(palette); IDirectDrawPalette_Release(palette);
/* No addref here */ /* No addref here */
hr = IDirectDraw2_CreatePalette(DDraw2, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, Table, &palette, NULL); hr = IDirectDraw2_CreatePalette(DDraw2, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, Table, &palette, NULL);
ok(hr == DD_OK, "CreatePalette returned %08x\n", hr); ok(hr == DD_OK, "Got hr %#lx.\n", hr);
ref = getRefcount( (IUnknown *) DDraw2); ref = getRefcount( (IUnknown *) DDraw2);
ok(ref == 1, "Got refcount %d, expected 1\n", ref); ok(ref == 1, "Got refcount %ld, expected 1\n", ref);
IDirectDrawPalette_Release(palette); IDirectDrawPalette_Release(palette);
/* No addref here */ /* No addref here */
hr = IDirectDraw_CreatePalette(DDraw1, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, Table, &palette, NULL); hr = IDirectDraw_CreatePalette(DDraw1, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, Table, &palette, NULL);
ok(hr == DD_OK, "CreatePalette returned %08x\n", hr); ok(hr == DD_OK, "Got hr %#lx.\n", hr);
ref = getRefcount( (IUnknown *) DDraw1); ref = getRefcount( (IUnknown *) DDraw1);
ok(ref == 1, "Got refcount %d, expected 1\n", ref); ok(ref == 1, "Got refcount %ld, expected 1\n", ref);
IDirectDrawPalette_Release(palette); IDirectDrawPalette_Release(palette);
/* Similar for surfaces */ /* Similar for surfaces */
hr = IDirectDraw4_CreateSurface(DDraw4, &ddsd, &surface4, NULL); hr = IDirectDraw4_CreateSurface(DDraw4, &ddsd, &surface4, NULL);
ok(hr == DD_OK, "CreateSurface returned %08x\n", hr); ok(hr == DD_OK, "Got hr %#lx.\n", hr);
ref = getRefcount( (IUnknown *) DDraw4); ref = getRefcount( (IUnknown *) DDraw4);
ok(ref == 2, "Got refcount %d, expected 2\n", ref); ok(ref == 2, "Got refcount %ld, expected 2\n", ref);
IDirectDrawSurface4_Release(surface4); IDirectDrawSurface4_Release(surface4);
ddsd.dwSize = sizeof(DDSURFACEDESC); ddsd.dwSize = sizeof(DDSURFACEDESC);
hr = IDirectDraw2_CreateSurface(DDraw2, (DDSURFACEDESC *) &ddsd, &surface1, NULL); hr = IDirectDraw2_CreateSurface(DDraw2, (DDSURFACEDESC *) &ddsd, &surface1, NULL);
ok(hr == DD_OK, "CreateSurface returned %08x\n", hr); ok(hr == DD_OK, "Got hr %#lx.\n", hr);
ref = getRefcount( (IUnknown *) DDraw2); ref = getRefcount( (IUnknown *) DDraw2);
ok(ref == 1, "Got refcount %d, expected 1\n", ref); ok(ref == 1, "Got refcount %ld, expected 1\n", ref);
IDirectDrawSurface_Release(surface1); IDirectDrawSurface_Release(surface1);
hr = IDirectDraw_CreateSurface(DDraw1, (DDSURFACEDESC *) &ddsd, &surface1, NULL); hr = IDirectDraw_CreateSurface(DDraw1, (DDSURFACEDESC *) &ddsd, &surface1, NULL);
ok(hr == DD_OK, "CreateSurface returned %08x\n", hr); ok(hr == DD_OK, "Got hr %#lx.\n", hr);
ref = getRefcount( (IUnknown *) DDraw1); ref = getRefcount( (IUnknown *) DDraw1);
ok(ref == 1, "Got refcount %d, expected 1\n", ref); ok(ref == 1, "Got refcount %ld, expected 1\n", ref);
IDirectDrawSurface_Release(surface1); IDirectDrawSurface_Release(surface1);
IDirectDraw7_Release(DDraw7); IDirectDraw7_Release(DDraw7);
...@@ -212,7 +211,7 @@ static void test_iface_refcnt(void) ...@@ -212,7 +211,7 @@ static void test_iface_refcnt(void)
long ref; long ref;
hr = pDirectDrawCreateEx(NULL, (void **) &DDraw7, &IID_IDirectDraw7, NULL); hr = pDirectDrawCreateEx(NULL, (void **) &DDraw7, &IID_IDirectDraw7, NULL);
ok(hr == DD_OK || hr==DDERR_NODIRECTDRAWSUPPORT, "DirectDrawCreateEx returned: %x\n", hr); ok(hr == DD_OK || hr == DDERR_NODIRECTDRAWSUPPORT, "Got hr %#lx.\n", hr);
if(!DDraw7) if(!DDraw7)
{ {
trace("Couldn't create DDraw interface, skipping tests\n"); trace("Couldn't create DDraw interface, skipping tests\n");
...@@ -223,11 +222,11 @@ static void test_iface_refcnt(void) ...@@ -223,11 +222,11 @@ static void test_iface_refcnt(void)
ok(ref == 1, "Initial IDirectDraw7 reference count is %ld\n", ref); ok(ref == 1, "Initial IDirectDraw7 reference count is %ld\n", ref);
hr = IDirectDraw7_QueryInterface(DDraw7, &IID_IDirectDraw4, (void **) &DDraw4); hr = IDirectDraw7_QueryInterface(DDraw7, &IID_IDirectDraw4, (void **) &DDraw4);
ok(hr == DD_OK, "IDirectDraw7_QueryInterface returned %08x\n", hr); ok(hr == DD_OK, "Got hr %#lx.\n", hr);
hr = IDirectDraw7_QueryInterface(DDraw7, &IID_IDirectDraw2, (void **) &DDraw2); hr = IDirectDraw7_QueryInterface(DDraw7, &IID_IDirectDraw2, (void **) &DDraw2);
ok(hr == DD_OK, "IDirectDraw7_QueryInterf&ace returned %08x\n", hr); ok(hr == DD_OK, "Got hr %#lx.\n", hr);
hr = IDirectDraw7_QueryInterface(DDraw7, &IID_IDirectDraw, (void **) &DDraw1); hr = IDirectDraw7_QueryInterface(DDraw7, &IID_IDirectDraw, (void **) &DDraw1);
ok(hr == DD_OK, "IDirectDraw7_QueryInterface returned %08x\n", hr); ok(hr == DD_OK, "Got hr %#lx.\n", hr);
/* All interfaces now have refcount 1! */ /* All interfaces now have refcount 1! */
ref = getRefcount( (IUnknown *) DDraw7); ref = getRefcount( (IUnknown *) DDraw7);
...@@ -243,7 +242,7 @@ static void test_iface_refcnt(void) ...@@ -243,7 +242,7 @@ static void test_iface_refcnt(void)
hr = IDirectDraw7_QueryInterface(DDraw7, &IID_IDirect3D7, (void **) &D3D7); hr = IDirectDraw7_QueryInterface(DDraw7, &IID_IDirect3D7, (void **) &D3D7);
ok(hr == DD_OK || hr == E_NOINTERFACE, /* win64 */ ok(hr == DD_OK || hr == E_NOINTERFACE, /* win64 */
"IDirectDraw7_QueryInterface returned %08x\n", hr); "IDirectDraw7_QueryInterface returned %#lx\n", hr);
if (FAILED(hr)) if (FAILED(hr))
{ {
IDirectDraw7_Release(DDraw7); IDirectDraw7_Release(DDraw7);
...@@ -274,31 +273,31 @@ static void test_iface_refcnt(void) ...@@ -274,31 +273,31 @@ static void test_iface_refcnt(void)
/* Can't get older d3d interfaces. WHY????? */ /* Can't get older d3d interfaces. WHY????? */
hr = IDirectDraw7_QueryInterface(DDraw7, &IID_IDirect3D3, (void **) &D3D3); hr = IDirectDraw7_QueryInterface(DDraw7, &IID_IDirect3D3, (void **) &D3D3);
todo_wine ok(hr == E_NOINTERFACE, "IDirectDraw7_QueryInterface returned %08x\n", hr); todo_wine ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
if(hr == DD_OK && D3D3) IDirect3D3_Release(D3D3); if(hr == DD_OK && D3D3) IDirect3D3_Release(D3D3);
hr = IDirectDraw4_QueryInterface(DDraw4, &IID_IDirect3D3, (void **) &D3D3); hr = IDirectDraw4_QueryInterface(DDraw4, &IID_IDirect3D3, (void **) &D3D3);
todo_wine ok(hr == E_NOINTERFACE, "IDirectDraw4_QueryInterface returned %08x\n", hr); todo_wine ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
if(hr == DD_OK && D3D3) IDirect3D3_Release(D3D3); if(hr == DD_OK && D3D3) IDirect3D3_Release(D3D3);
hr = IDirectDraw7_QueryInterface(DDraw7, &IID_IDirect3D2, (void **) &D3D2); hr = IDirectDraw7_QueryInterface(DDraw7, &IID_IDirect3D2, (void **) &D3D2);
todo_wine ok(hr == E_NOINTERFACE, "IDirectDraw7_QueryInterface returned %08x\n", hr); todo_wine ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
if(hr == DD_OK && D3D2) IDirect3D2_Release(D3D2); if(hr == DD_OK && D3D2) IDirect3D2_Release(D3D2);
hr = IDirectDraw2_QueryInterface(DDraw2, &IID_IDirect3D2, (void **) &D3D2); hr = IDirectDraw2_QueryInterface(DDraw2, &IID_IDirect3D2, (void **) &D3D2);
todo_wine ok(hr == E_NOINTERFACE, "IDirectDraw2_QueryInterface returned %08x\n", hr); todo_wine ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
if(hr == DD_OK && D3D2) IDirect3D2_Release(D3D2); if(hr == DD_OK && D3D2) IDirect3D2_Release(D3D2);
hr = IDirectDraw7_QueryInterface(DDraw7, &IID_IDirect3D, (void **) &D3D1); hr = IDirectDraw7_QueryInterface(DDraw7, &IID_IDirect3D, (void **) &D3D1);
todo_wine ok(hr == E_NOINTERFACE, "IDirectDraw7_QueryInterface returned %08x\n", hr); todo_wine ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
if(hr == DD_OK && D3D1) IDirect3D_Release(D3D1); if(hr == DD_OK && D3D1) IDirect3D_Release(D3D1);
hr = IDirectDraw_QueryInterface(DDraw1, &IID_IDirect3D, (void **) &D3D1); hr = IDirectDraw_QueryInterface(DDraw1, &IID_IDirect3D, (void **) &D3D1);
todo_wine ok(hr == E_NOINTERFACE, "IDirectDraw_QueryInterface returned %08x\n", hr); todo_wine ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
if(hr == DD_OK && D3D1) IDirect3D_Release(D3D1); if(hr == DD_OK && D3D1) IDirect3D_Release(D3D1);
hr = IDirect3D7_QueryInterface(D3D7, &IID_IDirect3D, (void **) &D3D1); hr = IDirect3D7_QueryInterface(D3D7, &IID_IDirect3D, (void **) &D3D1);
todo_wine ok(hr == E_NOINTERFACE, "IDirect3D7_QueryInterface returned %08x\n", hr); todo_wine ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
if(hr == DD_OK && D3D1) IDirect3D_Release(D3D1); if(hr == DD_OK && D3D1) IDirect3D_Release(D3D1);
/* Try an AddRef, it only affects the AddRefed interface */ /* Try an AddRef, it only affects the AddRefed interface */
...@@ -317,10 +316,10 @@ static void test_iface_refcnt(void) ...@@ -317,10 +316,10 @@ static void test_iface_refcnt(void)
/* Make sure that they are one object, not different ones */ /* Make sure that they are one object, not different ones */
hr = IDirectDraw4_SetCooperativeLevel(DDraw4, GetDesktopWindow(), DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); hr = IDirectDraw4_SetCooperativeLevel(DDraw4, GetDesktopWindow(), DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "IDirectDraw4::SetCooperativeLevel returned %08x\n", hr); ok(hr == DD_OK, "Got hr %#lx.\n", hr);
/* After an window has been set, DDSCL_SETFOCUSWINDOW should return DDERR_HWNDALREADYSET, see the mode test */ /* After an window has been set, DDSCL_SETFOCUSWINDOW should return DDERR_HWNDALREADYSET, see the mode test */
hr = IDirectDraw7_SetCooperativeLevel(DDraw7, NULL, DDSCL_SETFOCUSWINDOW); hr = IDirectDraw7_SetCooperativeLevel(DDraw7, NULL, DDSCL_SETFOCUSWINDOW);
ok(hr == DDERR_HWNDALREADYSET, "IDirectDraw7::SetCooperativeLevel returned %08x\n", hr); ok(hr == DDERR_HWNDALREADYSET, "Got hr %#lx.\n", hr);
/* All done, release all interfaces */ /* All done, release all interfaces */
IDirectDraw7_Release(DDraw7); IDirectDraw7_Release(DDraw7);
...@@ -343,17 +342,17 @@ static void test_d3d_ifaces(void) ...@@ -343,17 +342,17 @@ static void test_d3d_ifaces(void)
long ref; long ref;
hr = DirectDrawCreate(NULL, &DDraw1, NULL); hr = DirectDrawCreate(NULL, &DDraw1, NULL);
ok(hr == DD_OK || hr==DDERR_NODIRECTDRAWSUPPORT, "DirectDrawCreateEx returned: %x\n", hr); ok(hr == DD_OK || hr == DDERR_NODIRECTDRAWSUPPORT, "Got hr %#lx.\n", hr);
if(!DDraw1) if(!DDraw1)
{ {
trace("DirectDrawCreate failed with %08x\n", hr); trace("DirectDrawCreate failed with %#lx\n", hr);
return; return;
} }
hr = IDirectDraw_QueryInterface(DDraw1, &IID_IDirectDraw2, (void **) &DDraw2); hr = IDirectDraw_QueryInterface(DDraw1, &IID_IDirectDraw2, (void **) &DDraw2);
ok(hr == DD_OK, "IDirectDraw_QueryInterface returned %08x\n", hr); ok(hr == DD_OK, "Got hr %#lx.\n", hr);
hr = IDirectDraw_QueryInterface(DDraw1, &IID_IDirectDraw4, (void **) &DDraw4); hr = IDirectDraw_QueryInterface(DDraw1, &IID_IDirectDraw4, (void **) &DDraw4);
ok(hr == DD_OK, "IDirectDraw_QueryInterface returned %08x\n", hr); ok(hr == DD_OK, "Got hr %#lx.\n", hr);
ref = getRefcount( (IUnknown *) DDraw4); ref = getRefcount( (IUnknown *) DDraw4);
ok(ref == 1, "IDirectDraw4 reference count is %ld\n", ref); ok(ref == 1, "IDirectDraw4 reference count is %ld\n", ref);
...@@ -374,7 +373,7 @@ static void test_d3d_ifaces(void) ...@@ -374,7 +373,7 @@ static void test_d3d_ifaces(void)
skip( "no IDirect3D support\n" ); skip( "no IDirect3D support\n" );
return; return;
} }
ok(hr == DD_OK, "IDirectDraw_QueryInterface returned %08x\n", hr); ok(hr == DD_OK, "Got hr %#lx.\n", hr);
ref = getRefcount( (IUnknown *) DDraw4); ref = getRefcount( (IUnknown *) DDraw4);
ok(ref == 1, "IDirectDraw4 reference count is %ld\n", ref); ok(ref == 1, "IDirectDraw4 reference count is %ld\n", ref);
ref = getRefcount( (IUnknown *) DDraw2); ref = getRefcount( (IUnknown *) DDraw2);
...@@ -384,7 +383,7 @@ static void test_d3d_ifaces(void) ...@@ -384,7 +383,7 @@ static void test_d3d_ifaces(void)
IDirect3D_Release(D3D1); IDirect3D_Release(D3D1);
hr = IDirectDraw2_QueryInterface(DDraw2, &IID_IDirect3D2, (void **) &D3D2); hr = IDirectDraw2_QueryInterface(DDraw2, &IID_IDirect3D2, (void **) &D3D2);
ok(hr == DD_OK, "IDirectDraw2_QueryInterface returned %08x\n", hr); ok(hr == DD_OK, "Got hr %#lx.\n", hr);
ref = getRefcount( (IUnknown *) DDraw4); ref = getRefcount( (IUnknown *) DDraw4);
ok(ref == 1, "IDirectDraw4 reference count is %ld\n", ref); ok(ref == 1, "IDirectDraw4 reference count is %ld\n", ref);
ref = getRefcount( (IUnknown *) DDraw2); ref = getRefcount( (IUnknown *) DDraw2);
...@@ -394,7 +393,7 @@ static void test_d3d_ifaces(void) ...@@ -394,7 +393,7 @@ static void test_d3d_ifaces(void)
IDirect3D2_Release(D3D2); IDirect3D2_Release(D3D2);
hr = IDirectDraw4_QueryInterface(DDraw4, &IID_IDirect3D3, (void **) &D3D3); hr = IDirectDraw4_QueryInterface(DDraw4, &IID_IDirect3D3, (void **) &D3D3);
ok(hr == DD_OK, "IDirectDraw4_QueryInterface returned %08x\n", hr); ok(hr == DD_OK, "Got hr %#lx.\n", hr);
ref = getRefcount( (IUnknown *) DDraw4); ref = getRefcount( (IUnknown *) DDraw4);
ok(ref == 1, "IDirectDraw4 reference count is %ld\n", ref); ok(ref == 1, "IDirectDraw4 reference count is %ld\n", ref);
ref = getRefcount( (IUnknown *) DDraw2); ref = getRefcount( (IUnknown *) DDraw2);
...@@ -424,35 +423,35 @@ static void test_d3d_ifaces(void) ...@@ -424,35 +423,35 @@ static void test_d3d_ifaces(void)
* Except IDirect3D7, it can only be returned by IDirectDraw7(which can't return older ifaces) * Except IDirect3D7, it can only be returned by IDirectDraw7(which can't return older ifaces)
*/ */
hr = IDirectDraw2_QueryInterface(DDraw2, &IID_IDirect3D, (void **) &D3D1); hr = IDirectDraw2_QueryInterface(DDraw2, &IID_IDirect3D, (void **) &D3D1);
ok(hr == DD_OK, "IDirectDraw2_QueryInterface returned %08x\n", hr); ok(hr == DD_OK, "Got hr %#lx.\n", hr);
IDirect3D_Release(D3D1); IDirect3D_Release(D3D1);
hr = IDirectDraw4_QueryInterface(DDraw4, &IID_IDirect3D, (void **) &D3D1); hr = IDirectDraw4_QueryInterface(DDraw4, &IID_IDirect3D, (void **) &D3D1);
ok(hr == DD_OK, "IDirectDraw4_QueryInterface returned %08x\n", hr); ok(hr == DD_OK, "Got hr %#lx.\n", hr);
IDirect3D_Release(D3D1); IDirect3D_Release(D3D1);
hr = IDirectDraw_QueryInterface(DDraw1, &IID_IDirect3D2, (void **) &D3D2); hr = IDirectDraw_QueryInterface(DDraw1, &IID_IDirect3D2, (void **) &D3D2);
ok(hr == DD_OK, "IDirectDraw_QueryInterface returned %08x\n", hr); ok(hr == DD_OK, "Got hr %#lx.\n", hr);
IDirect3D_Release(D3D2); IDirect3D_Release(D3D2);
hr = IDirectDraw4_QueryInterface(DDraw4, &IID_IDirect3D2, (void **) &D3D2); hr = IDirectDraw4_QueryInterface(DDraw4, &IID_IDirect3D2, (void **) &D3D2);
ok(hr == DD_OK, "IDirectDraw4_QueryInterface returned %08x\n", hr); ok(hr == DD_OK, "Got hr %#lx.\n", hr);
IDirect3D_Release(D3D2); IDirect3D_Release(D3D2);
hr = IDirectDraw_QueryInterface(DDraw1, &IID_IDirect3D3, (void **) &D3D3); hr = IDirectDraw_QueryInterface(DDraw1, &IID_IDirect3D3, (void **) &D3D3);
ok(hr == DD_OK, "IDirectDraw_QueryInterface returned %08x\n", hr); ok(hr == DD_OK, "Got hr %#lx.\n", hr);
IDirect3D_Release(D3D3); IDirect3D_Release(D3D3);
hr = IDirectDraw2_QueryInterface(DDraw2, &IID_IDirect3D3, (void **) &D3D3); hr = IDirectDraw2_QueryInterface(DDraw2, &IID_IDirect3D3, (void **) &D3D3);
ok(hr == DD_OK, "IDirectDraw2_QueryInterface returned %08x\n", hr); ok(hr == DD_OK, "Got hr %#lx.\n", hr);
IDirect3D_Release(D3D3); IDirect3D_Release(D3D3);
/* This does NOT work */ /* This does NOT work */
hr = IDirectDraw_QueryInterface(DDraw1, &IID_IDirect3D7, (void **) &D3D7); hr = IDirectDraw_QueryInterface(DDraw1, &IID_IDirect3D7, (void **) &D3D7);
todo_wine ok(hr == E_NOINTERFACE, "IDirectDraw_QueryInterface returned %08x\n", hr); todo_wine ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
if(D3D7) IDirect3D_Release(D3D7); if(D3D7) IDirect3D_Release(D3D7);
hr = IDirectDraw2_QueryInterface(DDraw2, &IID_IDirect3D7, (void **) &D3D7); hr = IDirectDraw2_QueryInterface(DDraw2, &IID_IDirect3D7, (void **) &D3D7);
todo_wine ok(hr == E_NOINTERFACE, "IDirectDraw2_QueryInterface returned %08x\n", hr); todo_wine ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
if(D3D7) IDirect3D_Release(D3D7); if(D3D7) IDirect3D_Release(D3D7);
hr = IDirectDraw4_QueryInterface(DDraw4, &IID_IDirect3D7, (void **) &D3D7); hr = IDirectDraw4_QueryInterface(DDraw4, &IID_IDirect3D7, (void **) &D3D7);
todo_wine ok(hr == E_NOINTERFACE, "IDirectDraw4_QueryInterface returned %08x\n", hr); todo_wine ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
if(D3D7) IDirect3D_Release(D3D7); if(D3D7) IDirect3D_Release(D3D7);
/* Release the interfaces */ /* Release the interfaces */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment