adding NULL pointer check for ppdev, pHalInfo, pdwNumHeaps, pdwNumFourCCCodes

fill in more info for DDHALINFO it is not complete yet.

svn path=/trunk/; revision=23134
This commit is contained in:
Magnus Olsen 2006-07-18 08:54:32 +00:00
parent 6cf95d5263
commit 380d90d8a1

View file

@ -136,19 +136,41 @@ DrvGetDirectDrawInfo(
{ {
PPDEV ppdev = (PPDEV)dhpdev; PPDEV ppdev = (PPDEV)dhpdev;
if (ppdev == NULL)
return FALSE;
/* check so pHalInfo, pdwNumHeaps, pdwNumFourCCCodes is not NULL
pdwFourCC and pvmList can be null
*/
if (pHalInfo == NULL)
return FALSE;
if (pdwNumHeaps == NULL)
return FALSE;
if (pdwNumFourCCCodes == NULL)
return FALSE;
/* rest some data */ /* rest some data */
*pdwNumFourCCCodes = 0; *pdwNumFourCCCodes = 0;
*pdwNumHeaps = 0; *pdwNumHeaps = 0;
/* /*
check see if pvmList and pdwFourCC are second call check see if pvmList and pdwFourCC are frist call
or frist. Secon call we fill in pHalInfo info or frist. Secon call we fill in pHalInfo info
*/ */
if(!(pvmList && pdwFourCC)) if(!(pvmList && pdwFourCC))
{ {
RtlZeroMemory(pHalInfo, sizeof(DDHALINFO));
pHalInfo->dwSize = sizeof(DDHALINFO);
pHalInfo->ddCaps.dwCaps = DDCAPS_BLT | DDCAPS_BLTQUEUE | DDCAPS_BLTCOLORFILL | DDCAPS_READSCANLINE |
DDCAPS_BLTSTRETCH | DDCAPS_COLORKEY | DDCAPS_CANBLTSYSMEM;
pHalInfo->ddCaps.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP;
/* Calc how much memmory is left on the video cards memmory */ /* Calc how much memmory is left on the video cards memmory */
pHalInfo->ddCaps.dwVidMemTotal = (ppdev->MemHeight - ppdev->ScreenHeight) * ppdev->ScreenDelta; pHalInfo->ddCaps.dwVidMemTotal = (ppdev->MemHeight - ppdev->ScreenHeight) * ppdev->ScreenDelta;
@ -172,12 +194,7 @@ DrvGetDirectDrawInfo(
if ( ppdev->BitsPerPixel == 8 ) if ( ppdev->BitsPerPixel == 8 )
{ {
pHalInfo->vmiData.ddpfDisplay.dwFlags |= DDPF_PALETTEINDEXED8; pHalInfo->vmiData.ddpfDisplay.dwFlags |= DDPF_PALETTEINDEXED8;
} }
} }
return TRUE; return TRUE;