[FORMATTING]

- apply ansi style formatting with an indentation of 4 spaces
- Add 2 FIXME comments, regarding MmSecureVirtualmemory
- no code change

svn path=/trunk/; revision=40073
This commit is contained in:
Timo Kreuzer 2009-03-17 06:34:09 +00:00
parent 0f06669f19
commit cf3d6a794f

View file

@ -42,6 +42,7 @@ IntGdiCreateBitmap(
HBITMAP hBitmap;
SIZEL Size;
LONG WidthBytes;
PSURFACE psurfBmp;
/* NOTE: Windows also doesn't store nr. of planes separately! */
BitsPixel = BITMAP_GetRealBitsPixel(BitsPixel * Planes);
@ -49,7 +50,8 @@ IntGdiCreateBitmap(
/* Check parameters */
if (BitsPixel == 0 || Width <= 0 || Width >= 0x8000000 || Height == 0)
{
DPRINT1("Width = %d, Height = %d BitsPixel = %d\n", Width, Height, BitsPixel);
DPRINT1("Width = %d, Height = %d BitsPixel = %d\n",
Width, Height, BitsPixel);
SetLastWin32Error(ERROR_INVALID_PARAMETER);
return 0;
}
@ -62,7 +64,8 @@ IntGdiCreateBitmap(
/* Make sure that cjBits will not overflow */
if ((ULONGLONG)WidthBytes * Size.cy >= 0x100000000ULL)
{
DPRINT1("Width = %d, Height = %d BitsPixel = %d\n", Width, Height, BitsPixel);
DPRINT1("Width = %d, Height = %d BitsPixel = %d\n",
Width, Height, BitsPixel);
SetLastWin32Error(ERROR_INVALID_PARAMETER);
return 0;
}
@ -78,7 +81,7 @@ IntGdiCreateBitmap(
return 0;
}
PSURFACE psurfBmp = SURFACE_LockSurface(hBitmap);
psurfBmp = SURFACE_LockSurface(hBitmap);
if (psurfBmp == NULL)
{
NtGdiDeleteObject(hBitmap);
@ -115,6 +118,7 @@ NtGdiCreateBitmap(
BOOL Hit = FALSE;
UINT cjBits = BITMAP_GetWidthBytes(Width, BitsPixel) * abs(Height);
// FIXME: Use MmSecureVirtualMemory
_SEH2_TRY
{
ProbeForRead(pUnsafeBits, cjBits, 1);
@ -165,7 +169,6 @@ IntCreateCompatibleBitmap(
{
if (Count == sizeof(BITMAP))
{
/* We have a bitmap bug!!! W/O the HACK, we have white icons.
MSDN Note: When a memory device context is created, it initially
@ -186,7 +189,6 @@ IntCreateCompatibleBitmap(
NULL);
}
else
{
/* A DIB section is selected in the DC */
BITMAPINFO *bi;
@ -196,7 +198,10 @@ IntCreateCompatibleBitmap(
color table. The maximum number of colors in a color table
is 256 which corresponds to a bitmap with depth 8.
Bitmaps with higher depths don't have color tables. */
bi = ExAllocatePoolWithTag(PagedPool, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD), TAG_TEMP);
bi = ExAllocatePoolWithTag(PagedPool,
sizeof(BITMAPINFOHEADER) +
256 * sizeof(RGBQUAD),
TAG_TEMP);
if (bi)
{
@ -283,7 +288,8 @@ NtGdiCreateCompatibleBitmap(
Dc = DC_LockDc(hDC);
DPRINT("NtGdiCreateCompatibleBitmap(%04x,%d,%d, bpp:%d) = \n", hDC, Width, Height, ((PGDIDEVICE)Dc->pPDev)->GDIInfo.cBitsPixel);
DPRINT("NtGdiCreateCompatibleBitmap(%04x,%d,%d, bpp:%d) = \n",
hDC, Width, Height, ((PGDIDEVICE)Dc->pPDev)->GDIInfo.cBitsPixel);
if (NULL == Dc)
{
@ -351,11 +357,13 @@ NtGdiGetPixel(HDC hDC, INT XPos, INT YPos)
SetLastWin32Error(ERROR_INVALID_HANDLE);
return Result;
}
if (dc->DC_Type == DC_TYPE_INFO)
{
DC_UnlockDc(dc);
return Result;
}
XPos += dc->ptlDCOrig.x;
YPos += dc->ptlDCOrig.y;
if (IN_RECT(dc->CombinedClip->rclBounds,XPos,YPos))
@ -458,7 +466,10 @@ IntGetBitmapBits(
DPRINT("Calling device specific BitmapBits\n");
if (psurf->DDBitmap->funcs->pBitmapBits)
{
ret = psurf->DDBitmap->funcs->pBitmapBits(hbitmap, bits, count, DDB_GET);
ret = psurf->DDBitmap->funcs->pBitmapBits(hbitmap,
bits,
count,
DDB_GET);
}
else
{
@ -476,7 +487,8 @@ IntGetBitmapBits(
}
LONG APIENTRY
NtGdiGetBitmapBits(HBITMAP hBitmap,
NtGdiGetBitmapBits(
HBITMAP hBitmap,
ULONG Bytes,
OUT OPTIONAL PBYTE pUnsafeBits)
{
@ -506,6 +518,7 @@ NtGdiGetBitmapBits(HBITMAP hBitmap,
/* Don't copy more bytes than the buffer has */
Bytes = min(Bytes, psurf->SurfObj.cjBits);
// FIXME: use MmSecureVirtualMemory
_SEH2_TRY
{
ProbeForWrite(pUnsafeBits, Bytes, 1);
@ -541,7 +554,10 @@ IntSetBitmapBits(
DPRINT("Calling device specific BitmapBits\n");
if (psurf->DDBitmap->funcs->pBitmapBits)
{
ret = psurf->DDBitmap->funcs->pBitmapBits(hBitmap, (void *) Bits, Bytes, DDB_SET);
ret = psurf->DDBitmap->funcs->pBitmapBits(hBitmap,
(void *)Bits,
Bytes,
DDB_SET);
}
else
{
@ -652,15 +668,18 @@ GdiSetPixelV(
if (NewBrush == NULL)
return(FALSE);
OldBrush = NtGdiSelectBrush(hDC, NewBrush);
if (OldBrush == NULL)
{
NtGdiDeleteObject(NewBrush);
return(FALSE);
}
NtGdiPatBlt(hDC, X, Y, 1, 1, PATCOPY);
NtGdiSelectBrush(hDC, OldBrush);
NtGdiDeleteObject(NewBrush);
return TRUE;
}
@ -680,7 +699,7 @@ NtGdiSetPixel(
return Color;
}
Color = ((COLORREF) CLR_INVALID);
Color = (COLORREF)CLR_INVALID;
DPRINT("2 NtGdiSetPixel X %ld Y %ld C %ld\n", X, Y, Color);
return Color;
}
@ -780,7 +799,9 @@ BITMAP_CopyBitmap(HBITMAP hBitmap)
resBitmap = GDIOBJ_LockObj(res, GDI_OBJECT_TYPE_BITMAP);
if (resBitmap)
{
buf = ExAllocatePoolWithTag (PagedPool, bm.bmWidthBytes * abs(bm.bmHeight), TAG_BITMAP);
buf = ExAllocatePoolWithTag(PagedPool,
bm.bmWidthBytes * abs(bm.bmHeight),
TAG_BITMAP);
if (buf == NULL)
{
GDIOBJ_UnlockObjByPtr((POBJ)resBitmap);
@ -856,7 +877,8 @@ BITMAP_GetObject(SURFACE *psurf, INT Count, LPVOID buffer)
}
else
{
pBitmap->bmBits = NULL; /* not set according to wine test, confirmed in win2k */
/* not set according to wine test, confirmed in win2k */
pBitmap->bmBits = NULL;
}
return sizeof(BITMAP);
@ -930,7 +952,8 @@ NtGdiSelectBitmap(
pDC->DcLevel.pSurface = psurfBmp;
psurfBmp->hDC = hDC;
// if we're working with a DIB, get the palette [fixme: only create if the selected palette is null]
// if we're working with a DIB, get the palette
// [fixme: only create if the selected palette is null]
if (psurfBmp->hSecure)
{
// pDC->w.bitsPerPixel = psurfBmp->dib->dsBmih.biBitCount; ???
@ -941,7 +964,10 @@ NtGdiSelectBitmap(
pDC->w.bitsPerPixel = BitsPerFormat(psurfBmp->SurfObj.iBitmapFormat);
}
hVisRgn = NtGdiCreateRectRgn(0, 0, psurfBmp->SurfObj.sizlBitmap.cx, psurfBmp->SurfObj.sizlBitmap.cy);
hVisRgn = NtGdiCreateRectRgn(0,
0,
psurfBmp->SurfObj.sizlBitmap.cx,
psurfBmp->SurfObj.sizlBitmap.cy);
SURFACE_UnlockSurface(psurfBmp);
/* Regenerate the XLATEOBJs. */