*
* $Id$
*/
+
#include <w32k.h>
+#define NDEBUG
+#include <debug.h>
+
static const USHORT HatchBrushes[NB_HATCH_STYLES][8] =
{
{0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00}, /* HS_HORIZONTAL */
Result = IntEngCreateXlate(0, 0, Dc->w.hPalette, Pattern->hDIBPalette);
}
- BITMAPOBJ_UnlockBitmap(BrushObj->hbmPattern);
+ BITMAPOBJ_UnlockBitmap(Pattern);
*Failed = FALSE;
}
BitmapObject = BITMAPOBJ_LockBitmap(hPattern);
ASSERT(BitmapObject != NULL);
BitmapObject->hDIBPalette = BuildDIBPalette(BitmapInfo, &PaletteType);
- BITMAPOBJ_UnlockBitmap(hPattern);
+ BITMAPOBJ_UnlockBitmap(BitmapObject);
hBrush = BRUSHOBJ_AllocBrush();
if (hBrush == NULL)
GDIOBJ_SetOwnership(hPattern, NULL);
- BRUSHOBJ_UnlockBrush(hBrush);
+ BRUSHOBJ_UnlockBrush(BrushObject);
return hBrush;
}
return 0;
}
- hPattern = NtGdiCreateBitmap(8, 8, 1, 1, HatchBrushes[Style]);
+ hPattern = NtGdiCreateBitmap(8, 8, 1, 1, (LPBYTE)HatchBrushes[Style]);
if (hPattern == NULL)
{
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
GDIOBJ_SetOwnership(hPattern, NULL);
- BRUSHOBJ_UnlockBrush(hBrush);
+ BRUSHOBJ_UnlockBrush(BrushObject);
return hBrush;
}
GDIOBJ_SetOwnership(hPattern, NULL);
- BRUSHOBJ_UnlockBrush(hBrush);
+ BRUSHOBJ_UnlockBrush(BrushObject);
return hBrush;
}
BrushObject->BrushAttr.lbColor = Color & 0xFFFFFF;
/* FIXME: Fill in the rest of fields!!! */
- BRUSHOBJ_UnlockBrush(hBrush);
+ BRUSHOBJ_UnlockBrush(BrushObject);
return hBrush;
}
BrushObject = BRUSHOBJ_LockBrush(hBrush);
ASSERT(BrushObject != NULL);
BrushObject->flAttrs |= GDIBRUSH_IS_NULL;
- BRUSHOBJ_UnlockBrush(hBrush);
+ BRUSHOBJ_UnlockBrush(BrushObject);
return hBrush;
}
DestRect.bottom = YLeft + dc->w.DCOrgY + 1;
}
+ IntLPtoDP(dc, (LPPOINT)&DestRect, 2);
+
BrushOrigin.x = BrushObj->ptOrigin.x + dc->w.DCOrgX;
BrushOrigin.y = BrushObj->ptOrigin.y + dc->w.DCOrgY;
IntGdiInitBrushInstance(&BrushInst, BrushObj, dc->XlateBrush);
ret = IntEngBitBlt(
- BitmapObj,
+ &BitmapObj->SurfObj,
NULL,
NULL,
dc->CombinedClip,
ROP3_TO_ROP4(ROP));
}
- BITMAPOBJ_UnlockBitmap(dc->w.hBitmap);
+ BITMAPOBJ_UnlockBitmap(BitmapObj);
return ret;
}
}
if (dc->IsIC)
{
- DC_UnlockDc(hDC);
+ DC_UnlockDc(dc);
/* Yes, Windows really returns TRUE in this case */
return TRUE;
}
r->r.bottom,
dwRop,
BrushObj);
- BRUSHOBJ_UnlockBrush(r->hBrush);
+ BRUSHOBJ_UnlockBrush(BrushObj);
}
r++;
}
- DC_UnlockDc( hDC );
+ DC_UnlockDc(dc);
return TRUE;
}
HBRUSH STDCALL
NtGdiCreateDIBBrush(
- CONST BITMAPINFO *BitmapInfoAndData,
- UINT ColorSpec,
- UINT BitmapInfoSize,
- CONST VOID *PackedDIB)
+ IN PVOID BitmapInfoAndData,
+ IN FLONG ColorSpec,
+ IN UINT BitmapInfoSize,
+ IN BOOL b8X8,
+ IN BOOL bPen,
+ IN PVOID PackedDIB)
{
BITMAPINFO *SafeBitmapInfoAndData;
- NTSTATUS Status;
+ NTSTATUS Status = STATUS_SUCCESS;
HBRUSH hBrush;
SafeBitmapInfoAndData = EngAllocMem(0, BitmapInfoSize, 0);
return NULL;
}
- Status = MmCopyFromCaller(SafeBitmapInfoAndData, BitmapInfoAndData,
- BitmapInfoSize);
+ _SEH_TRY
+ {
+ ProbeForRead(BitmapInfoAndData,
+ BitmapInfoSize,
+ 1);
+ RtlCopyMemory(SafeBitmapInfoAndData,
+ BitmapInfoAndData,
+ BitmapInfoSize);
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
+
if (!NT_SUCCESS(Status))
{
+ EngFreeMem(SafeBitmapInfoAndData);
SetLastNtError(Status);
return 0;
}
}
HBRUSH STDCALL
-NtGdiCreateSolidBrush(COLORREF Color)
+NtGdiCreateSolidBrush(COLORREF Color,
+ IN OPTIONAL HBRUSH hbr)
{
return IntGdiCreateSolidBrush(Color);
}
if (Point != NULL)
{
- NTSTATUS Status;
+ NTSTATUS Status = STATUS_SUCCESS;
POINT SafePoint;
SafePoint.x = dc->w.brushOrgX;
SafePoint.y = dc->w.brushOrgY;
- Status = MmCopyToCaller(Point, &SafePoint, sizeof(POINT));
+ _SEH_TRY
+ {
+ ProbeForWrite(Point,
+ sizeof(POINT),
+ 1);
+ *Point = SafePoint;
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
+
if(!NT_SUCCESS(Status))
{
- DC_UnlockDc(hDC);
+ DC_UnlockDc(dc);
SetLastNtError(Status);
return FALSE;
}
dc->w.brushOrgX = XOrg;
dc->w.brushOrgY = YOrg;
- DC_UnlockDc(hDC);
+ DC_UnlockDc(dc);
return TRUE;
}
NtGdiPolyPatBlt(
HDC hDC,
DWORD dwRop,
- PPATRECT pRects,
- INT cRects,
- ULONG Reserved)
+ IN PPOLYPATBLT pRects,
+ IN DWORD cRects,
+ IN DWORD Mode)
{
PPATRECT rb = NULL;
- NTSTATUS Status;
+ NTSTATUS Status = STATUS_SUCCESS;
BOOL Ret;
if (cRects > 0)
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
- Status = MmCopyFromCaller(rb, pRects, sizeof(PATRECT) * cRects);
+ _SEH_TRY
+ {
+ ProbeForRead(pRects,
+ cRects * sizeof(PATRECT),
+ 1);
+ RtlCopyMemory(rb,
+ pRects,
+ cRects * sizeof(PATRECT));
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
+
if (!NT_SUCCESS(Status))
{
ExFreePool(rb);
}
}
- Ret = IntGdiPolyPatBlt(hDC, dwRop, pRects, cRects, Reserved);
+ Ret = IntGdiPolyPatBlt(hDC, dwRop, (PPATRECT)pRects, cRects, Mode);
if (cRects > 0)
ExFreePool(rb);
}
if (dc->IsIC)
{
- DC_UnlockDc(hDC);
+ DC_UnlockDc(dc);
/* Yes, Windows really returns TRUE in this case */
return TRUE;
}
if (BrushObj == NULL)
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
- DC_UnlockDc(hDC);
+ DC_UnlockDc(dc);
return FALSE;
}
ROP,
BrushObj);
- BRUSHOBJ_UnlockBrush(dc->w.hBrush);
- DC_UnlockDc(hDC);
+ BRUSHOBJ_UnlockBrush(BrushObj);
+ DC_UnlockDc(dc);
return ret;
}