revert 38201 and 38203 due to regressions

svn path=/trunk/; revision=38215
This commit is contained in:
Timo Kreuzer 2008-12-21 02:27:44 +00:00
parent 9432c31eba
commit 9f0e740e7a

View file

@ -3135,8 +3135,6 @@ NtGdiExtTextOutW(
BOOL DoBreak = FALSE; BOOL DoBreak = FALSE;
LPCWSTR String, SafeString = NULL; LPCWSTR String, SafeString = NULL;
HPALETTE hDestPalette; HPALETTE hDestPalette;
PVOID TmpBuffer = NULL;
ULONG TmpBufSize, StringSize, DxSize = 0;
// TODO: Write test-cases to exactly match real Windows in different // TODO: Write test-cases to exactly match real Windows in different
// bad parameters (e.g. does Windows check the DC or the RECT first?). // bad parameters (e.g. does Windows check the DC or the RECT first?).
@ -3162,49 +3160,14 @@ NtGdiExtTextOutW(
SetLastWin32Error(ERROR_INVALID_PARAMETER); SetLastWin32Error(ERROR_INVALID_PARAMETER);
goto fail; goto fail;
} }
Status = STATUS_SUCCESS;
if (Count > 0) if (Count > 0)
{ {
TmpBufSize = StringSize = Count * sizeof(WCHAR); SafeString = ExAllocatePoolWithTag(PagedPool, Count * sizeof(WCHAR), TAG_GDITEXT);
if (UnsafeDx) if (!SafeString)
{ {
/* If ETO_PDY is specified, we have pairs of INTs */
DxSize = Count * sizeof(INT) * (fuOptions & ETO_PDY ? 2 : 1);
TmpBufSize += DxSize;
}
/* Allocate a temp buffer for the string and the Dx values */
TmpBuffer = ExAllocatePoolWithTag(PagedPool, TmpBufSize, TAG_GDITEXT);
SafeString = TmpBuffer;
if (!TmpBuffer)
{
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
goto fail; goto fail;
} }
Status = MmCopyFromCaller(SafeString, UnsafeString, Count * sizeof(WCHAR));
/* Probe and copy user mode data to the temp buffer */
_SEH2_TRY
{
if (UnsafeString)
{
ProbeForRead(UnsafeString, StringSize, 1);
memcpy((PVOID)SafeString, UnsafeString, StringSize);
}
if (UnsafeDx)
{
ProbeForRead(UnsafeDx, DxSize, 1);
Dx = (INT*)((ULONG_PTR)TmpBuffer + StringSize);
memcpy(Dx, UnsafeString, DxSize);
}
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
Status = _SEH2_GetExceptionCode();
}
_SEH2_END
if (! NT_SUCCESS(Status)) if (! NT_SUCCESS(Status))
{ {
goto fail; goto fail;
@ -3212,24 +3175,30 @@ NtGdiExtTextOutW(
} }
String = SafeString; String = SafeString;
if (lprc) if (NULL != UnsafeDx && Count > 0)
{ {
_SEH2_TRY Dx = ExAllocatePoolWithTag(PagedPool, Count * sizeof(INT), TAG_GDITEXT);
if (NULL == Dx)
{ {
ProbeForRead(lprc, sizeof(RECT), 1); goto fail;
memcpy(&SpecifiedDestRect, lprc, sizeof(RECT));
} }
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) Status = MmCopyFromCaller(Dx, UnsafeDx, Count * sizeof(INT));
{
Status = _SEH2_GetExceptionCode();
}
_SEH2_END
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
goto fail; goto fail;
} }
} }
if (lprc)
{
Status = MmCopyFromCaller(&SpecifiedDestRect, lprc, sizeof(RECT));
if (!NT_SUCCESS(Status))
{
SetLastWin32Error(ERROR_INVALID_PARAMETER);
goto fail;
}
}
if (PATH_IsPathOpen(dc->DcLevel)) if (PATH_IsPathOpen(dc->DcLevel))
{ {
if (!PATH_ExtTextOut( dc, if (!PATH_ExtTextOut( dc,
@ -3668,15 +3637,8 @@ NtGdiExtTextOutW(
// DbgPrint("new TextLeft: %d\n", TextLeft); // DbgPrint("new TextLeft: %d\n", TextLeft);
} }
else else
{
if (fuOptions & ETO_PDY)
{
TextLeft += Dx[i*2] << 6;
}
else
{ {
TextLeft += Dx[i] << 6; TextLeft += Dx[i] << 6;
}
// DbgPrint("new TextLeft2: %d\n", TextLeft); // DbgPrint("new TextLeft2: %d\n", TextLeft);
} }
previous = glyph_index; previous = glyph_index;
@ -3730,9 +3692,13 @@ fail:
BRUSHOBJ_UnlockBrush(BrushFg); BRUSHOBJ_UnlockBrush(BrushFg);
NtGdiDeleteObject(hBrushFg); NtGdiDeleteObject(hBrushFg);
} }
if (TmpBuffer) if (NULL != SafeString)
{ {
ExFreePoolWithTag(TmpBuffer, TAG_GDITEXT); ExFreePoolWithTag((void*)SafeString, TAG_GDITEXT);
}
if (NULL != Dx)
{
ExFreePoolWithTag(Dx, TAG_GDITEXT);
} }
DC_UnlockDc(dc); DC_UnlockDc(dc);