Author: tkreuzer Date: Mon Jul 30 05:10:35 2007 New Revision: 28026
URL: http://svn.reactos.org/svn/reactos?rev=28026&view=rev Log: - rename NtGdiGetTextMetrics to NtGdigetTextMetricsW and add cj parameter - GetTextMetricsAW: call NtGdigetTextMetricW with cj set to sizeof(TMW_INTERNAL), use TextMetric member - update w32ksvc.db - update ntgdibad.h
Modified: trunk/reactos/dll/win32/gdi32/objects/text.c trunk/reactos/include/reactos/win32k/ntgdibad.h trunk/reactos/subsystems/win32/win32k/objects/text.c trunk/reactos/tools/nci/w32ksvc.db
Modified: trunk/reactos/dll/win32/gdi32/objects/text.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/tex... ============================================================================== --- trunk/reactos/dll/win32/gdi32/objects/text.c (original) +++ trunk/reactos/dll/win32/gdi32/objects/text.c Mon Jul 30 05:10:35 2007 @@ -86,14 +86,14 @@ LPTEXTMETRICA lptm ) { - TEXTMETRICW tmw; - - if (! NtGdiGetTextMetrics(hdc, &tmw)) - { - return FALSE; - } - - return TextMetricW2A(lptm, &tmw); + TMW_INTERNAL tmwi; + + if (! NtGdiGetTextMetricsW(hdc, &tmwi, sizeof(TMW_INTERNAL))) + { + return FALSE; + } + + return TextMetricW2A(lptm, &tmwi.TextMetric); }
@@ -107,7 +107,15 @@ LPTEXTMETRICW lptm ) { - return NtGdiGetTextMetrics(hdc, lptm); + TMW_INTERNAL tmwi; + + if (! NtGdiGetTextMetricsW(hdc, &tmwi, sizeof(TMW_INTERNAL))) + { + return FALSE; + } + + *lptm = tmwi.TextMetric; + return TRUE; }
Modified: trunk/reactos/include/reactos/win32k/ntgdibad.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntgd... ============================================================================== --- trunk/reactos/include/reactos/win32k/ntgdibad.h (original) +++ trunk/reactos/include/reactos/win32k/ntgdibad.h Mon Jul 30 05:10:35 2007 @@ -605,12 +605,6 @@ /* Needs to be done in user-mode, using shared GDI Object Attributes. */ COLORREF STDCALL NtGdiGetTextColor(HDC hDC);
-/* Use NtGdiGetTextMetricsW with 0 at the end */ -BOOL -STDCALL -NtGdiGetTextMetrics(HDC hDC, - LPTEXTMETRICW tm); - /* Use NtGdiGetDCPoint with GdiGetViewPortExt */ BOOL STDCALL NtGdiGetViewportExtEx(HDC hDC, LPSIZE viewportExt);
Modified: trunk/reactos/subsystems/win32/win32k/objects/text.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/text.c (original) +++ trunk/reactos/subsystems/win32/win32k/objects/text.c Mon Jul 30 05:10:35 2007 @@ -3688,26 +3688,32 @@ return Count; }
+W32KAPI BOOL -STDCALL -NtGdiGetTextMetrics(HDC hDC, - LPTEXTMETRICW tm) +APIENTRY +NtGdiGetTextMetricsW( + IN HDC hDC, + OUT TMW_INTERNAL * pUnsafeTmwi, + IN ULONG cj +) { PDC dc; PTEXTOBJ TextObj; PFONTGDI FontGDI; NTSTATUS Status = STATUS_SUCCESS; - TEXTMETRICW SafeTm; + TMW_INTERNAL tmwi; FT_Face Face; TT_OS2 *pOS2; TT_HoriHeader *pHori; ULONG Error;
- if (NULL == tm) + if (NULL == pUnsafeTmwi) { SetLastWin32Error(STATUS_INVALID_PARAMETER); return FALSE; } + + /* FIXME: check cj ? */
if(!(dc = DC_LockDc(hDC))) { @@ -3736,7 +3742,9 @@ } else { - memcpy(&SafeTm, &FontGDI->TextMetric, sizeof(TEXTMETRICW)); + memcpy(&tmwi.TextMetric, &FontGDI->TextMetric, sizeof(TEXTMETRICW)); + /* FIXME: Fill Diff member */ + RtlZeroMemory(&tmwi.Diff, sizeof(tmwi.Diff));
Status = STATUS_SUCCESS; IntLockFreeType; @@ -3757,10 +3765,24 @@ IntUnLockFreeType;
if (NT_SUCCESS(Status)) - { - FillTM(&SafeTm, FontGDI->face, pOS2, pHori); - Status = MmCopyToCaller(tm, &SafeTm, sizeof(TEXTMETRICW)); - } + { + FillTM(&tmwi.TextMetric, FontGDI->face, pOS2, pHori); + + if (cj > sizeof(TMW_INTERNAL)) + cj = sizeof(TMW_INTERNAL); + + Status = STATUS_SUCCESS; + _SEH_TRY + { + ProbeForWrite(pUnsafeTmwi, cj, 1); + RtlCopyMemory(pUnsafeTmwi,&tmwi,cj); + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END + } } TEXTOBJ_UnlockText(TextObj); }
Modified: trunk/reactos/tools/nci/w32ksvc.db URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/nci/w32ksvc.db?rev=28... ============================================================================== --- trunk/reactos/tools/nci/w32ksvc.db (original) +++ trunk/reactos/tools/nci/w32ksvc.db Mon Jul 30 05:10:35 2007 @@ -153,7 +153,7 @@ NtGdiGetTextExtent 5 NtGdiGetTextExtentPoint32 4 NtGdiGetTextFaceW 4 -NtGdiGetTextMetrics 2 +NtGdiGetTextMetricsW 3 NtGdiGetViewportExtEx 2 NtGdiGetViewportOrgEx 2 NtGdiGetWinMetaFileBits 5