mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 01:39:30 +00:00
fixing bsod in GetAttachSurface when pointer is NULL
svn path=/trunk/; revision=23286
This commit is contained in:
parent
2e4a553ff9
commit
0b21a745a5
3 changed files with 43 additions and 30 deletions
|
@ -297,6 +297,8 @@ HRESULT WINAPI Main_DirectDraw_CreateSurface (LPDIRECTDRAW7 iface, LPDDSURFACEDE
|
|||
// FIXME Free memmory at exit
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
ZeroMemory(surf, sizeof(DxSurf));
|
||||
|
||||
|
||||
|
||||
That->lpVtbl = &DirectDrawSurface7_Vtable;
|
||||
|
|
|
@ -235,7 +235,7 @@ Main_DDrawSurface_GetAttachedSurface(LPDIRECTDRAWSURFACE7 iface,
|
|||
LPDIRECTDRAWSURFACE7* ppSurface)
|
||||
{
|
||||
IDirectDrawSurfaceImpl* This = (IDirectDrawSurfaceImpl*)iface;
|
||||
IDirectDrawSurfaceImpl *surf;
|
||||
IDirectDrawSurfaceImpl *surf;
|
||||
DDSCAPS2 our_caps;
|
||||
|
||||
DX_WINDBG_trace();
|
||||
|
@ -246,7 +246,7 @@ Main_DDrawSurface_GetAttachedSurface(LPDIRECTDRAWSURFACE7 iface,
|
|||
*/
|
||||
|
||||
our_caps = *pCaps;
|
||||
|
||||
|
||||
/*
|
||||
FIXME adding version check
|
||||
Earlier dx apps put garbage into these members, clear them
|
||||
|
@ -255,32 +255,43 @@ Main_DDrawSurface_GetAttachedSurface(LPDIRECTDRAWSURFACE7 iface,
|
|||
our_caps.dwCaps3 = 0;
|
||||
our_caps.dwCaps4 = 0;
|
||||
|
||||
surf = This;
|
||||
while( (surf = surf->Surf->next_complex) )
|
||||
{
|
||||
if (((surf->Surf->mddsdPrimary.ddsCaps.dwCaps & our_caps.dwCaps) == our_caps.dwCaps) &&
|
||||
((surf->Surf->mddsdPrimary.ddsCaps.dwCaps2 & our_caps.dwCaps2) == our_caps.dwCaps2))
|
||||
{
|
||||
*ppSurface = (LPDIRECTDRAWSURFACE7)surf;
|
||||
Main_DDrawSurface_AddRef(*ppSurface);
|
||||
return DD_OK;
|
||||
}
|
||||
//surf = (IDirectDrawSurfaceImpl*)This->Surf->next_complex;
|
||||
if (This->Surf->next_complex != NULL)
|
||||
{
|
||||
surf = (IDirectDrawSurfaceImpl*)This->Surf->next_complex;
|
||||
while( surf != NULL )
|
||||
{
|
||||
if (((surf->Surf->mddsdPrimary.ddsCaps.dwCaps & our_caps.dwCaps) == our_caps.dwCaps) &&
|
||||
((surf->Surf->mddsdPrimary.ddsCaps.dwCaps2 & our_caps.dwCaps2) == our_caps.dwCaps2))
|
||||
{
|
||||
*ppSurface = (LPDIRECTDRAWSURFACE7)surf;
|
||||
Main_DDrawSurface_AddRef(*ppSurface);
|
||||
DX_STUB_str("surf->Surf->next_complex ok");
|
||||
return DD_OK;
|
||||
}
|
||||
surf = (IDirectDrawSurfaceImpl*)This->Surf->next_complex;
|
||||
}
|
||||
}
|
||||
|
||||
/* Next, look at the attachment chain */
|
||||
surf = This;
|
||||
if (This->Surf->next_attached != NULL)
|
||||
{
|
||||
surf = (IDirectDrawSurfaceImpl*)This->Surf->next_attached;
|
||||
|
||||
while( (surf = surf->Surf->next_attached) )
|
||||
{
|
||||
if (((surf->Surf->mddsdPrimary.ddsCaps.dwCaps & our_caps.dwCaps) == our_caps.dwCaps) &&
|
||||
((surf->Surf->mddsdPrimary.ddsCaps.dwCaps2 & our_caps.dwCaps2) == our_caps.dwCaps2))
|
||||
{
|
||||
*ppSurface = (LPDIRECTDRAWSURFACE7)surf;
|
||||
Main_DDrawSurface_AddRef(*ppSurface);
|
||||
return DD_OK;
|
||||
}
|
||||
}
|
||||
while(surf != NULL)
|
||||
{
|
||||
if (((surf->Surf->mddsdPrimary.ddsCaps.dwCaps & our_caps.dwCaps) == our_caps.dwCaps) &&
|
||||
((surf->Surf->mddsdPrimary.ddsCaps.dwCaps2 & our_caps.dwCaps2) == our_caps.dwCaps2))
|
||||
{
|
||||
*ppSurface = (LPDIRECTDRAWSURFACE7)surf;
|
||||
Main_DDrawSurface_AddRef(*ppSurface);
|
||||
DX_STUB_str("surf->Surf->next_attached ok");
|
||||
return DD_OK;
|
||||
}
|
||||
surf = (IDirectDrawSurfaceImpl*)This->Surf->next_attached;
|
||||
}
|
||||
}
|
||||
|
||||
DX_STUB_str("Fail");
|
||||
return DDERR_NOTFOUND;
|
||||
}
|
||||
|
||||
|
|
|
@ -128,12 +128,12 @@ typedef struct
|
|||
wine desgin for it
|
||||
type IDirectDrawSurfaceImpl;
|
||||
*/
|
||||
LPVOID next_attached;
|
||||
LPVOID first_attached;
|
||||
LPVOID next_complex;
|
||||
LPVOID first_complex;
|
||||
LPVOID next;
|
||||
LPVOID prev;
|
||||
DWORD* next_attached;
|
||||
DWORD* first_attached;
|
||||
DWORD* next_complex;
|
||||
DWORD* first_complex;
|
||||
DWORD* next;
|
||||
DWORD* prev;
|
||||
|
||||
/* Need be delete later */
|
||||
DDRAWI_DDRAWSURFACE_GBL mSurfGlobal;
|
||||
|
|
Loading…
Reference in a new issue