ddraw: Fix DirectDrawSurface::QueryInterface crash.
This commit is contained in:
parent
8827bcfd74
commit
3cc9e40c3b
|
@ -160,6 +160,9 @@ Main_DirectDrawSurface_QueryInterface(LPDIRECTDRAWSURFACE7 iface, REFIID riid,
|
||||||
|
|
||||||
*ppObj = NULL;
|
*ppObj = NULL;
|
||||||
|
|
||||||
|
if(!riid)
|
||||||
|
return DDERR_INVALIDPARAMS;
|
||||||
|
|
||||||
if (IsEqualGUID(&IID_IUnknown, riid)
|
if (IsEqualGUID(&IID_IUnknown, riid)
|
||||||
|| IsEqualGUID(&IID_IDirectDrawSurface7, riid)
|
|| IsEqualGUID(&IID_IDirectDrawSurface7, riid)
|
||||||
|| IsEqualGUID(&IID_IDirectDrawSurface4, riid))
|
|| IsEqualGUID(&IID_IDirectDrawSurface4, riid))
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005 Antoine Chavasse (a.chavasse@gmail.com)
|
* Copyright (C) 2005 Antoine Chavasse (a.chavasse@gmail.com)
|
||||||
* Copyright (C) 2005 Christian Costa
|
* Copyright (C) 2005 Christian Costa
|
||||||
|
* Copyright 2005 Ivan Leo Puoti
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -220,11 +221,38 @@ static void SrcColorKey32BlitTest(void)
|
||||||
IDirectDrawSurface_Release(lpDst);
|
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)
|
START_TEST(dsurface)
|
||||||
{
|
{
|
||||||
CreateDirectDraw();
|
CreateDirectDraw();
|
||||||
MipMapCreationTest();
|
MipMapCreationTest();
|
||||||
SrcColorKey32BlitTest();
|
SrcColorKey32BlitTest();
|
||||||
|
QueryInterface();
|
||||||
ReleaseDirectDraw();
|
ReleaseDirectDraw();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue