Fix some error checking for DireactDrawCreate and DireactDrawCreateEx, we checking if the param is right or not.

svn path=/trunk/; revision=17206
This commit is contained in:
Magnus Olsen 2005-08-08 15:41:02 +00:00
parent a3abeb83af
commit 079265d1a7

View file

@ -15,10 +15,7 @@
HRESULT WINAPI Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface, HRESULT WINAPI Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface,
IUnknown* pUnkOuter, BOOL ex) IUnknown* pUnkOuter, BOOL ex)
{ {
if (pUnkOuter!=NULL)
return DDERR_INVALIDPARAMS;
IDirectDrawImpl* This = (IDirectDrawImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectDrawImpl)); IDirectDrawImpl* This = (IDirectDrawImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectDrawImpl));
if (This == NULL) if (This == NULL)
@ -32,15 +29,33 @@ HRESULT WINAPI Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface,
} }
HRESULT WINAPI DirectDrawCreate (LPGUID lpGUID, LPDIRECTDRAW* lplpDD, LPUNKNOWN pUnkOuter) HRESULT WINAPI DirectDrawCreate (LPGUID lpGUID, LPDIRECTDRAW* lplpDD, LPUNKNOWN pUnkOuter)
{ {
/* check see if pUnkOuter is null or not */
if (!pUnkOuter)
{
/* we do not use same error code as MS, ms use 0x8004110 */
return DDERR_INVALIDPARAMS;
}
return Create_DirectDraw (lpGUID, lplpDD, pUnkOuter, FALSE); return Create_DirectDraw (lpGUID, lplpDD, pUnkOuter, FALSE);
} }
HRESULT WINAPI DirectDrawCreateEx(LPGUID lpGUID, LPVOID* lplpDD, REFIID iid, LPUNKNOWN pUnkOuter) HRESULT WINAPI DirectDrawCreateEx(LPGUID lpGUID, LPVOID* lplpDD, REFIID iid, LPUNKNOWN pUnkOuter)
{ {
if (!IsEqualGUID(iid, &IID_IDirectDraw7)) /* check see if pUnkOuter is null or not */
return DDERR_INVALIDPARAMS; if (!pUnkOuter)
{
/* we do not use same error code as MS, ms use 0x8004110 */
return DDERR_INVALIDPARAMS;
}
/* Is it a DirectDraw 7 Request or not */
if (!IsEqualGUID(iid, &IID_IDirectDraw7))
{
return DDERR_INVALIDPARAMS;
}
return Create_DirectDraw (lpGUID, (LPDIRECTDRAW*)lplpDD, pUnkOuter, TRUE); return Create_DirectDraw (lpGUID, (LPDIRECTDRAW*)lplpDD, pUnkOuter, TRUE);
} }