Commit 3cc9e40c authored by Ivan Leo Puoti's avatar Ivan Leo Puoti Committed by Alexandre Julliard

ddraw: Fix DirectDrawSurface::QueryInterface crash.

parent 8827bcfd
......@@ -160,6 +160,9 @@ Main_DirectDrawSurface_QueryInterface(LPDIRECTDRAWSURFACE7 iface, REFIID riid,
*ppObj = NULL;
if(!riid)
return DDERR_INVALIDPARAMS;
if (IsEqualGUID(&IID_IUnknown, riid)
|| IsEqualGUID(&IID_IDirectDrawSurface7, riid)
|| IsEqualGUID(&IID_IDirectDrawSurface4, riid))
......
......@@ -3,6 +3,7 @@
*
* Copyright (C) 2005 Antoine Chavasse (a.chavasse@gmail.com)
* Copyright (C) 2005 Christian Costa
* Copyright 2005 Ivan Leo Puoti
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -220,11 +221,38 @@ static void SrcColorKey32BlitTest(void)
IDirectDrawSurface_Release(lpDst);
}
static void QueryInterface(void)
{
LPDIRECTDRAWSURFACE dsurface;
DDSURFACEDESC surface;
LPVOID object;
HRESULT ret;
/* Create a surface */
ZeroMemory(&surface, sizeof(surface));
surface.dwSize = sizeof(surface);
surface.dwFlags = DDSD_WIDTH | DDSD_HEIGHT;
surface.dwHeight = 10;
surface.dwWidth = 10;
ret = IDirectDraw_CreateSurface(lpDD, &surface, &dsurface, NULL);
if(ret != DD_OK)
{
ok(FALSE, "IDirectDraw::CreateSurface failed with error %lx\n", ret);
return;
}
/* Call IUnkown::QueryInterface */
ret = IDirectDrawSurface_QueryInterface(dsurface, 0, &object);
ok(ret == DDERR_INVALIDPARAMS, "IDirectDrawSurface::QueryInterface returned %lx\n", ret);
IDirectDrawSurface_Release(dsurface);
}
START_TEST(dsurface)
{
CreateDirectDraw();
MipMapCreationTest();
SrcColorKey32BlitTest();
QueryInterface();
ReleaseDirectDraw();
}
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