Don't crash if pDDSD is NULL on DirectDrawSurface::Lock.

This commit is contained in:
Raphael Junqueira 2005-10-07 15:01:02 +00:00 committed by Alexandre Julliard
parent 12a749984c
commit 9e18b7efa9
2 changed files with 15 additions and 6 deletions

View File

@ -640,14 +640,17 @@ void DDRAW_dump_surface_desc(const DDSURFACEDESC2 *lpddsd)
};
#undef STRUCT
if (lpddsd->dwSize >= sizeof(DDSURFACEDESC2)) {
DDRAW_dump_members(lpddsd->dwFlags, lpddsd, members_caps2, 1);
if (NULL == lpddsd) {
DPRINTF("(null)\n");
} else {
DDRAW_dump_members(lpddsd->dwFlags, lpddsd, members_caps, 1);
if (lpddsd->dwSize >= sizeof(DDSURFACEDESC2)) {
DDRAW_dump_members(lpddsd->dwFlags, lpddsd, members_caps2, 1);
} else {
DDRAW_dump_members(lpddsd->dwFlags, lpddsd, members_caps, 1);
}
DDRAW_dump_members(lpddsd->dwFlags, lpddsd, members,
sizeof(members)/sizeof(members[0]));
}
DDRAW_dump_members(lpddsd->dwFlags, lpddsd, members,
sizeof(members)/sizeof(members[0]));
}
void DDRAW_dump_cooperativelevel(DWORD cooplevel)

View File

@ -1093,6 +1093,12 @@ Main_DirectDrawSurface_Lock(LPDIRECTDRAWSURFACE7 iface, LPRECT prect,
WARN(" - unsupported locking flag : "); DDRAW_dump_lockflag(flags & ~(DDLOCK_WAIT|DDLOCK_READONLY|DDLOCK_WRITEONLY));
}
}
if (NULL != h) {
return DDERR_INVALIDPARAMS;
}
if (NULL == pDDSD) {
return DDERR_INVALIDPARAMS; /** really ? */
}
/* If the surface is already locked, return busy */
if (This->locked) {