Author: tkreuzer Date: Sat Dec 20 20:27:44 2008 New Revision: 38215
URL: http://svn.reactos.org/svn/reactos?rev=38215&view=rev Log: revert 38201 and 38203 due to regressions
Modified: trunk/reactos/subsystems/win32/win32k/objects/freetype.c
Modified: trunk/reactos/subsystems/win32/win32k/objects/freetype.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/freetype.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/freetype.c [iso-8859-1] Sat Dec 20 20:27:44 2008 @@ -3135,8 +3135,6 @@ BOOL DoBreak = FALSE; LPCWSTR String, SafeString = NULL; HPALETTE hDestPalette; - PVOID TmpBuffer = NULL; - ULONG TmpBufSize, StringSize, DxSize = 0;
// TODO: Write test-cases to exactly match real Windows in different // bad parameters (e.g. does Windows check the DC or the RECT first?). @@ -3162,70 +3160,41 @@ SetLastWin32Error(ERROR_INVALID_PARAMETER); goto fail; } - - Status = STATUS_SUCCESS; if (Count > 0) { - TmpBufSize = StringSize = Count * sizeof(WCHAR); - if (UnsafeDx) - { - /* 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); + SafeString = ExAllocatePoolWithTag(PagedPool, Count * sizeof(WCHAR), TAG_GDITEXT); + if (!SafeString) + { goto fail; } - - /* 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 + Status = MmCopyFromCaller(SafeString, UnsafeString, Count * sizeof(WCHAR)); + if (! NT_SUCCESS(Status)) + { + goto fail; + } + } + String = SafeString; + + if (NULL != UnsafeDx && Count > 0) + { + Dx = ExAllocatePoolWithTag(PagedPool, Count * sizeof(INT), TAG_GDITEXT); + if (NULL == Dx) + { + goto fail; + } + Status = MmCopyFromCaller(Dx, UnsafeDx, Count * sizeof(INT)); if (!NT_SUCCESS(Status)) { goto fail; } } - String = SafeString;
if (lprc) { - _SEH2_TRY - { - ProbeForRead(lprc, sizeof(RECT), 1); - memcpy(&SpecifiedDestRect, lprc, sizeof(RECT)); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Status = _SEH2_GetExceptionCode(); - } - _SEH2_END + Status = MmCopyFromCaller(&SpecifiedDestRect, lprc, sizeof(RECT)); if (!NT_SUCCESS(Status)) { + SetLastWin32Error(ERROR_INVALID_PARAMETER); goto fail; } } @@ -3669,14 +3638,7 @@ } 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); } previous = glyph_index; @@ -3730,9 +3692,13 @@ BRUSHOBJ_UnlockBrush(BrushFg); NtGdiDeleteObject(hBrushFg); } - if (TmpBuffer) - { - ExFreePoolWithTag(TmpBuffer, TAG_GDITEXT); + if (NULL != SafeString) + { + ExFreePoolWithTag((void*)SafeString, TAG_GDITEXT); + } + if (NULL != Dx) + { + ExFreePoolWithTag(Dx, TAG_GDITEXT); } DC_UnlockDc(dc);