- 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

svn path=/trunk/; revision=28026
This commit is contained in:
Timo Kreuzer 2007-07-30 01:10:35 +00:00
parent 380e7f70eb
commit 984be48dd5
4 changed files with 48 additions and 24 deletions

View file

@ -86,14 +86,14 @@ GetTextMetricsA(
LPTEXTMETRICA lptm LPTEXTMETRICA lptm
) )
{ {
TEXTMETRICW tmw; TMW_INTERNAL tmwi;
if (! NtGdiGetTextMetrics(hdc, &tmw)) if (! NtGdiGetTextMetricsW(hdc, &tmwi, sizeof(TMW_INTERNAL)))
{ {
return FALSE; return FALSE;
} }
return TextMetricW2A(lptm, &tmw); return TextMetricW2A(lptm, &tmwi.TextMetric);
} }
@ -107,7 +107,15 @@ GetTextMetricsW(
LPTEXTMETRICW lptm LPTEXTMETRICW lptm
) )
{ {
return NtGdiGetTextMetrics(hdc, lptm); TMW_INTERNAL tmwi;
if (! NtGdiGetTextMetricsW(hdc, &tmwi, sizeof(TMW_INTERNAL)))
{
return FALSE;
}
*lptm = tmwi.TextMetric;
return TRUE;
} }

View file

@ -605,12 +605,6 @@ NtGdiGetTextCharset(HDC hDC);
/* Needs to be done in user-mode, using shared GDI Object Attributes. */ /* Needs to be done in user-mode, using shared GDI Object Attributes. */
COLORREF STDCALL NtGdiGetTextColor(HDC hDC); COLORREF STDCALL NtGdiGetTextColor(HDC hDC);
/* Use NtGdiGetTextMetricsW with 0 at the end */
BOOL
STDCALL
NtGdiGetTextMetrics(HDC hDC,
LPTEXTMETRICW tm);
/* Use NtGdiGetDCPoint with GdiGetViewPortExt */ /* Use NtGdiGetDCPoint with GdiGetViewPortExt */
BOOL STDCALL NtGdiGetViewportExtEx(HDC hDC, LPSIZE viewportExt); BOOL STDCALL NtGdiGetViewportExtEx(HDC hDC, LPSIZE viewportExt);

View file

@ -3688,27 +3688,33 @@ NtGdiGetTextFaceW(
return Count; return Count;
} }
W32KAPI
BOOL BOOL
STDCALL APIENTRY
NtGdiGetTextMetrics(HDC hDC, NtGdiGetTextMetricsW(
LPTEXTMETRICW tm) IN HDC hDC,
OUT TMW_INTERNAL * pUnsafeTmwi,
IN ULONG cj
)
{ {
PDC dc; PDC dc;
PTEXTOBJ TextObj; PTEXTOBJ TextObj;
PFONTGDI FontGDI; PFONTGDI FontGDI;
NTSTATUS Status = STATUS_SUCCESS; NTSTATUS Status = STATUS_SUCCESS;
TEXTMETRICW SafeTm; TMW_INTERNAL tmwi;
FT_Face Face; FT_Face Face;
TT_OS2 *pOS2; TT_OS2 *pOS2;
TT_HoriHeader *pHori; TT_HoriHeader *pHori;
ULONG Error; ULONG Error;
if (NULL == tm) if (NULL == pUnsafeTmwi)
{ {
SetLastWin32Error(STATUS_INVALID_PARAMETER); SetLastWin32Error(STATUS_INVALID_PARAMETER);
return FALSE; return FALSE;
} }
/* FIXME: check cj ? */
if(!(dc = DC_LockDc(hDC))) if(!(dc = DC_LockDc(hDC)))
{ {
SetLastWin32Error(ERROR_INVALID_HANDLE); SetLastWin32Error(ERROR_INVALID_HANDLE);
@ -3736,7 +3742,9 @@ NtGdiGetTextMetrics(HDC hDC,
} }
else 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; Status = STATUS_SUCCESS;
IntLockFreeType; IntLockFreeType;
@ -3757,10 +3765,24 @@ NtGdiGetTextMetrics(HDC hDC,
IntUnLockFreeType; IntUnLockFreeType;
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
FillTM(&SafeTm, FontGDI->face, pOS2, pHori); FillTM(&tmwi.TextMetric, FontGDI->face, pOS2, pHori);
Status = MmCopyToCaller(tm, &SafeTm, sizeof(TEXTMETRICW));
} 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); TEXTOBJ_UnlockText(TextObj);
} }

View file

@ -153,7 +153,7 @@ NtGdiGetTextExtentExW 8
NtGdiGetTextExtent 5 NtGdiGetTextExtent 5
NtGdiGetTextExtentPoint32 4 NtGdiGetTextExtentPoint32 4
NtGdiGetTextFaceW 4 NtGdiGetTextFaceW 4
NtGdiGetTextMetrics 2 NtGdiGetTextMetricsW 3
NtGdiGetViewportExtEx 2 NtGdiGetViewportExtEx 2
NtGdiGetViewportOrgEx 2 NtGdiGetViewportOrgEx 2
NtGdiGetWinMetaFileBits 5 NtGdiGetWinMetaFileBits 5