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
|
// FIXME Free memmory at exit
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
ZeroMemory(surf, sizeof(DxSurf));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
That->lpVtbl = &DirectDrawSurface7_Vtable;
|
That->lpVtbl = &DirectDrawSurface7_Vtable;
|
||||||
|
|
|
@ -255,32 +255,43 @@ Main_DDrawSurface_GetAttachedSurface(LPDIRECTDRAWSURFACE7 iface,
|
||||||
our_caps.dwCaps3 = 0;
|
our_caps.dwCaps3 = 0;
|
||||||
our_caps.dwCaps4 = 0;
|
our_caps.dwCaps4 = 0;
|
||||||
|
|
||||||
surf = This;
|
//surf = (IDirectDrawSurfaceImpl*)This->Surf->next_complex;
|
||||||
while( (surf = surf->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) &&
|
if (((surf->Surf->mddsdPrimary.ddsCaps.dwCaps & our_caps.dwCaps) == our_caps.dwCaps) &&
|
||||||
((surf->Surf->mddsdPrimary.ddsCaps.dwCaps2 & our_caps.dwCaps2) == our_caps.dwCaps2))
|
((surf->Surf->mddsdPrimary.ddsCaps.dwCaps2 & our_caps.dwCaps2) == our_caps.dwCaps2))
|
||||||
{
|
{
|
||||||
*ppSurface = (LPDIRECTDRAWSURFACE7)surf;
|
*ppSurface = (LPDIRECTDRAWSURFACE7)surf;
|
||||||
Main_DDrawSurface_AddRef(*ppSurface);
|
Main_DDrawSurface_AddRef(*ppSurface);
|
||||||
|
DX_STUB_str("surf->Surf->next_complex ok");
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
|
surf = (IDirectDrawSurfaceImpl*)This->Surf->next_complex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Next, look at the attachment chain */
|
if (This->Surf->next_attached != NULL)
|
||||||
surf = This;
|
{
|
||||||
|
surf = (IDirectDrawSurfaceImpl*)This->Surf->next_attached;
|
||||||
|
|
||||||
while( (surf = surf->Surf->next_attached) )
|
while(surf != NULL)
|
||||||
{
|
{
|
||||||
if (((surf->Surf->mddsdPrimary.ddsCaps.dwCaps & our_caps.dwCaps) == our_caps.dwCaps) &&
|
if (((surf->Surf->mddsdPrimary.ddsCaps.dwCaps & our_caps.dwCaps) == our_caps.dwCaps) &&
|
||||||
((surf->Surf->mddsdPrimary.ddsCaps.dwCaps2 & our_caps.dwCaps2) == our_caps.dwCaps2))
|
((surf->Surf->mddsdPrimary.ddsCaps.dwCaps2 & our_caps.dwCaps2) == our_caps.dwCaps2))
|
||||||
{
|
{
|
||||||
*ppSurface = (LPDIRECTDRAWSURFACE7)surf;
|
*ppSurface = (LPDIRECTDRAWSURFACE7)surf;
|
||||||
Main_DDrawSurface_AddRef(*ppSurface);
|
Main_DDrawSurface_AddRef(*ppSurface);
|
||||||
|
DX_STUB_str("surf->Surf->next_attached ok");
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
|
surf = (IDirectDrawSurfaceImpl*)This->Surf->next_attached;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DX_STUB_str("Fail");
|
||||||
return DDERR_NOTFOUND;
|
return DDERR_NOTFOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,12 +128,12 @@ typedef struct
|
||||||
wine desgin for it
|
wine desgin for it
|
||||||
type IDirectDrawSurfaceImpl;
|
type IDirectDrawSurfaceImpl;
|
||||||
*/
|
*/
|
||||||
LPVOID next_attached;
|
DWORD* next_attached;
|
||||||
LPVOID first_attached;
|
DWORD* first_attached;
|
||||||
LPVOID next_complex;
|
DWORD* next_complex;
|
||||||
LPVOID first_complex;
|
DWORD* first_complex;
|
||||||
LPVOID next;
|
DWORD* next;
|
||||||
LPVOID prev;
|
DWORD* prev;
|
||||||
|
|
||||||
/* Need be delete later */
|
/* Need be delete later */
|
||||||
DDRAWI_DDRAWSURFACE_GBL mSurfGlobal;
|
DDRAWI_DDRAWSURFACE_GBL mSurfGlobal;
|
||||||
|
|
Loading…
Reference in a new issue