ReactOS  0.4.13-dev-73-gcfe54aa
text.c File Reference
#include <win32k.h>
#include <debug.h>
Include dependency graph for text.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

BOOL FASTCALL GreTextOutW (HDC hdc, int nXStart, int nYStart, LPCWSTR lpString, int cchString)
 
BOOL FASTCALL GreGetTextExtentW (HDC hDC, LPCWSTR lpwsz, INT cwc, LPSIZE psize, UINT flOpts)
 
BOOL FASTCALL GreGetTextExtentExW (HDC hDC, LPCWSTR String, ULONG Count, ULONG MaxExtent, PULONG Fit, PULONG Dx, LPSIZE pSize, FLONG fl)
 
BOOL WINAPI GreGetTextMetricsW (_In_ HDC hdc, _Out_ LPTEXTMETRICW lptm)
 
DWORD APIENTRY NtGdiGetCharSet (HDC hDC)
 
BOOL APIENTRY NtGdiGetRasterizerCaps (OUT LPRASTERIZER_STATUS praststat, IN ULONG cjBytes)
 
INT APIENTRY NtGdiGetTextCharsetInfo (IN HDC hdc, OUT OPTIONAL LPFONTSIGNATURE lpSig, IN DWORD dwFlags)
 
W32KAPI BOOL APIENTRY NtGdiGetTextExtentExW (IN HDC hDC, IN OPTIONAL LPWSTR UnsafeString, IN ULONG Count, IN ULONG MaxExtent, OUT OPTIONAL PULONG UnsafeFit, OUT OPTIONAL PULONG UnsafeDx, OUT LPSIZE UnsafeSize, IN FLONG fl)
 
BOOL APIENTRY NtGdiGetTextExtent (HDC hdc, LPWSTR lpwsz, INT cwc, LPSIZE psize, UINT flOpts)
 
BOOL APIENTRY NtGdiSetTextJustification (HDC hDC, int BreakExtra, int BreakCount)
 
W32KAPI INT APIENTRY NtGdiGetTextFaceW (IN HDC hDC, IN INT Count, OUT OPTIONAL LPWSTR FaceName, IN BOOL bAliasName)
 
W32KAPI BOOL APIENTRY NtGdiGetTextMetricsW (IN HDC hDC, OUT TMW_INTERNAL *pUnsafeTmwi, IN ULONG cj)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Includes

Definition at line 13 of file text.c.

Function Documentation

◆ GreGetTextExtentExW()

BOOL FASTCALL GreGetTextExtentExW ( HDC  hDC,
LPCWSTR  String,
ULONG  Count,
ULONG  MaxExtent,
PULONG  Fit,
PULONG  Dx,
LPSIZE  pSize,
FLONG  fl 
)

Definition at line 93 of file text.c.

102 {
103  PDC pdc;
104  PDC_ATTR pdcattr;
105  BOOL Result;
106  PTEXTOBJ TextObj;
107 
108  if ( (!String && Count ) || !pSize )
109  {
111  return FALSE;
112  }
113 
114  if ( !Count )
115  {
116  if ( Fit ) Fit = 0;
117  return TRUE;
118  }
119 
120  pdc = DC_LockDc(hDC);
121  if (NULL == pdc)
122  {
124  return FALSE;
125  }
126  pdcattr = pdc->pdcattr;
127 
128  TextObj = RealizeFontInit(pdcattr->hlfntNew);
129  if ( TextObj )
130  {
132  TextObj,
133  String,
134  Count,
135  MaxExtent,
136  (LPINT)Fit,
137  (LPINT)Dx,
138  pSize,
139  fl);
140  TEXTOBJ_UnlockText(TextObj);
141  }
142  else
143  Result = FALSE;
144 
145  DC_UnlockDc(pdc);
146  return Result;
147 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
static WCHAR String[]
Definition: stringtable.c:55
_In_ FLONG fl
Definition: winddi.h:1279
Definition: text.h:59
unsigned int BOOL
Definition: ntddk_ex.h:94
HANDLE hlfntNew
Definition: ntgdihdl.h:327
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
Definition: polytest.cpp:40
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
PTEXTOBJ FASTCALL RealizeFontInit(HFONT hFont)
Definition: font.c:422
BOOL FASTCALL TextIntGetTextExtentPoint(PDC dc, PTEXTOBJ TextObj, LPCWSTR String, INT Count, ULONG MaxExtent, LPINT Fit, LPINT Dx, LPSIZE Size, FLONG fl)
Definition: freetype.c:3907
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
int * LPINT
Definition: windef.h:178

Referenced by TEXT_Ellipsify(), TEXT_NextLineW(), TEXT_PathEllipsify(), TEXT_WordBreak(), and UserDrawCaptionText().

◆ GreGetTextExtentW()

BOOL FASTCALL GreGetTextExtentW ( HDC  hDC,
LPCWSTR  lpwsz,
INT  cwc,
LPSIZE  psize,
UINT  flOpts 
)

Definition at line 36 of file text.c.

42 {
43  PDC pdc;
44  PDC_ATTR pdcattr;
45  BOOL Result;
46  PTEXTOBJ TextObj;
47 
48  if (!cwc)
49  {
50  psize->cx = 0;
51  psize->cy = 0;
52  return TRUE;
53  }
54 
55  pdc = DC_LockDc(hDC);
56  if (!pdc)
57  {
59  return FALSE;
60  }
61 
62  pdcattr = pdc->pdcattr;
63 
64  TextObj = RealizeFontInit(pdcattr->hlfntNew);
65  if ( TextObj )
66  {
68  TextObj,
69  lpwsz,
70  cwc,
71  0,
72  NULL,
73  0,
74  psize,
75  flOpts);
76  TEXTOBJ_UnlockText(TextObj);
77  }
78  else
79  Result = FALSE;
80 
81  DC_UnlockDc(pdc);
82  return Result;
83 }
#define TRUE
Definition: types.h:120
_Must_inspect_result_ _Out_ LPSIZE psize
Definition: ntgdi.h:1569
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
Definition: text.h:59
unsigned int BOOL
Definition: ntddk_ex.h:94
HANDLE hlfntNew
Definition: ntgdihdl.h:327
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
LONG cx
Definition: windef.h:319
Definition: polytest.cpp:40
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
PTEXTOBJ FASTCALL RealizeFontInit(HFONT hFont)
Definition: font.c:422
BOOL FASTCALL TextIntGetTextExtentPoint(PDC dc, PTEXTOBJ TextObj, LPCWSTR String, INT Count, ULONG MaxExtent, LPINT Fit, LPINT Dx, LPSIZE Size, FLONG fl)
Definition: freetype.c:3907
LONG cy
Definition: windef.h:320
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by DrawTextExWorker(), IntPaintDesktop(), and TEXT_DrawUnderscore().

◆ GreGetTextMetricsW()

BOOL WINAPI GreGetTextMetricsW ( _In_ HDC  hdc,
_Out_ LPTEXTMETRICW  lptm 
)

Definition at line 151 of file text.c.

154 {
155  TMW_INTERNAL tmwi;
156  if (!ftGdiGetTextMetricsW(hdc, &tmwi)) return FALSE;
157  *lptm = tmwi.TextMetric;
158  return TRUE;
159 }
TEXTMETRICW TextMetric
Definition: ntgdityp.h:364
#define TRUE
Definition: types.h:120
HDC hdc
Definition: main.c:9
BOOL FASTCALL ftGdiGetTextMetricsW(HDC hDC, PTMW_INTERNAL ptmwi)
Definition: freetype.c:4228
static LPTEXTMETRICW lptm
Definition: font.c:42

Referenced by DrawTextExWorker().

◆ GreTextOutW()

BOOL FASTCALL GreTextOutW ( HDC  hdc,
int  nXStart,
int  nYStart,
LPCWSTR  lpString,
int  cchString 
)

Functions

Definition at line 19 of file text.c.

25 {
26  return GreExtTextOutW(hdc, nXStart, nYStart, 0, NULL, lpString, cchString, NULL, 0);
27 }
smooth NULL
Definition: ftsmooth.c:416
BOOL APIENTRY GreExtTextOutW(IN HDC hDC, IN INT XStart, IN INT YStart, IN UINT fuOptions, IN OPTIONAL PRECTL lprc, IN LPCWSTR String, IN INT Count, IN OPTIONAL LPINT Dx, IN DWORD dwCodePage)
Definition: freetype.c:6328
HDC hdc
Definition: main.c:9

Referenced by MENU_DrawPopupGlyph(), UITOOLS95_DFC_ButtonCheckRadio(), UITOOLS95_DrawFrameCaption(), UITOOLS95_DrawFrameMenu(), and UITOOLS95_DrawFrameScroll().

◆ NtGdiGetCharSet()

DWORD APIENTRY NtGdiGetCharSet ( HDC  hDC)

Definition at line 163 of file text.c.

164 {
165  PDC Dc;
166  PDC_ATTR pdcattr;
167  DWORD cscp;
168  // If here, update everything!
169  Dc = DC_LockDc(hDC);
170  if (!Dc)
171  {
173  return 0;
174  }
175  cscp = ftGdiGetTextCharsetInfo(Dc, NULL, 0);
176  pdcattr = Dc->pdcattr;
177  pdcattr->iCS_CP = cscp;
178  pdcattr->ulDirty_ &= ~DIRTY_CHARSET;
179  DC_UnlockDc( Dc );
180  return cscp;
181 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define DIRTY_CHARSET
Definition: ntgdihdl.h:149
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
smooth NULL
Definition: ftsmooth.c:416
ULONG ulDirty_
Definition: ntgdihdl.h:291
Definition: polytest.cpp:40
DWORD iCS_CP
Definition: ntgdihdl.h:302
unsigned long DWORD
Definition: ntddk_ex.h:95
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
INT FASTCALL ftGdiGetTextCharsetInfo(PDC Dc, LPFONTSIGNATURE lpSig, DWORD dwFlags)
Definition: freetype.c:4047
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by GdiGetCodePage().

◆ NtGdiGetRasterizerCaps()

BOOL APIENTRY NtGdiGetRasterizerCaps ( OUT LPRASTERIZER_STATUS  praststat,
IN ULONG  cjBytes 
)

Definition at line 185 of file text.c.

188 {
190  RASTERIZER_STATUS rsSafe;
191 
192  if (praststat && cjBytes)
193  {
194  if ( cjBytes >= sizeof(RASTERIZER_STATUS) ) cjBytes = sizeof(RASTERIZER_STATUS);
195  if ( ftGdiGetRasterizerCaps(&rsSafe))
196  {
197  _SEH2_TRY
198  {
199  ProbeForWrite( praststat,
200  sizeof(RASTERIZER_STATUS),
201  1);
202  RtlCopyMemory(praststat, &rsSafe, cjBytes );
203  }
205  {
207  }
208  _SEH2_END;
209 
210  if (!NT_SUCCESS(Status))
211  {
213  return FALSE;
214  }
215 
216  return TRUE;
217  }
218  }
219  return FALSE;
220 }
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
LONG NTSTATUS
Definition: precomp.h:26
struct _RASTERIZER_STATUS RASTERIZER_STATUS
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
_SEH2_TRY
Definition: create.c:4250
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
BOOL FASTCALL ftGdiGetRasterizerCaps(LPRASTERIZER_STATUS lprs)
Definition: freetype.c:2832
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
Status
Definition: gdiplustypes.h:24
_SEH2_END
Definition: create.c:4424
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:2725

◆ NtGdiGetTextCharsetInfo()

INT APIENTRY NtGdiGetTextCharsetInfo ( IN HDC  hdc,
OUT OPTIONAL LPFONTSIGNATURE  lpSig,
IN DWORD  dwFlags 
)

Definition at line 224 of file text.c.

228 {
229  PDC Dc;
230  INT Ret;
231  FONTSIGNATURE fsSafe;
232  PFONTSIGNATURE pfsSafe = &fsSafe;
234 
235  Dc = DC_LockDc(hdc);
236  if (!Dc)
237  {
239  return DEFAULT_CHARSET;
240  }
241 
242  if (!lpSig) pfsSafe = NULL;
243 
244  Ret = HIWORD(ftGdiGetTextCharsetInfo( Dc, pfsSafe, dwFlags));
245 
246  if (lpSig)
247  {
248  if (Ret == DEFAULT_CHARSET)
249  RtlZeroMemory(pfsSafe, sizeof(FONTSIGNATURE));
250 
251  _SEH2_TRY
252  {
253  ProbeForWrite( lpSig,
254  sizeof(FONTSIGNATURE),
255  1);
256  RtlCopyMemory(lpSig, pfsSafe, sizeof(FONTSIGNATURE));
257  }
259  {
261  }
262  _SEH2_END;
263 
264  if (!NT_SUCCESS(Status))
265  {
267  return DEFAULT_CHARSET;
268  }
269  }
270  DC_UnlockDc(Dc);
271  return Ret;
272 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
LONG NTSTATUS
Definition: precomp.h:26
#define DEFAULT_CHARSET
Definition: wingdi.h:383
int32_t INT
Definition: typedefs.h:56
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
_SEH2_TRY
Definition: create.c:4250
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
Definition: polytest.cpp:40
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
HDC hdc
Definition: main.c:9
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
Status
Definition: gdiplustypes.h:24
_SEH2_END
Definition: create.c:4424
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define HIWORD(l)
Definition: typedefs.h:246
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:2725
INT FASTCALL ftGdiGetTextCharsetInfo(PDC Dc, LPFONTSIGNATURE lpSig, DWORD dwFlags)
Definition: freetype.c:4047
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by GetTextCharset().

◆ NtGdiGetTextExtent()

BOOL APIENTRY NtGdiGetTextExtent ( HDC  hdc,
LPWSTR  lpwsz,
INT  cwc,
LPSIZE  psize,
UINT  flOpts 
)

Definition at line 449 of file text.c.

454 {
455  return NtGdiGetTextExtentExW(hdc, lpwsz, cwc, 0, NULL, NULL, psize, flOpts);
456 }
_Must_inspect_result_ _Out_ LPSIZE psize
Definition: ntgdi.h:1569
smooth NULL
Definition: ftsmooth.c:416
HDC hdc
Definition: main.c:9
W32KAPI BOOL APIENTRY NtGdiGetTextExtentExW(IN HDC hDC, IN OPTIONAL LPWSTR UnsafeString, IN ULONG Count, IN ULONG MaxExtent, OUT OPTIONAL PULONG UnsafeFit, OUT OPTIONAL PULONG UnsafeDx, OUT LPSIZE UnsafeSize, IN FLONG fl)
Definition: text.c:283

Referenced by GetTextExtentPoint32W(), GetTextExtentPointI(), and GetTextExtentPointW().

◆ NtGdiGetTextExtentExW()

W32KAPI BOOL APIENTRY NtGdiGetTextExtentExW ( IN HDC  hDC,
IN OPTIONAL LPWSTR  UnsafeString,
IN ULONG  Count,
IN ULONG  MaxExtent,
OUT OPTIONAL PULONG  UnsafeFit,
OUT OPTIONAL PULONG  UnsafeDx,
OUT LPSIZE  UnsafeSize,
IN FLONG  fl 
)

Definition at line 283 of file text.c.

293 {
294  PDC dc;
295  PDC_ATTR pdcattr;
296  LPWSTR String;
297  SIZE Size;
299  BOOLEAN Result;
300  INT Fit;
301  LPINT Dx;
302  PTEXTOBJ TextObj;
303 
304  if ((LONG)Count < 0)
305  {
307  return FALSE;
308  }
309 
310  /* FIXME: Handle fl */
311 
312  if (0 == Count)
313  {
314  Size.cx = 0;
315  Size.cy = 0;
316  Status = MmCopyToCaller(UnsafeSize, &Size, sizeof(SIZE));
317  if (! NT_SUCCESS(Status))
318  {
320  return FALSE;
321  }
322  return TRUE;
323  }
324 
326  if (NULL == String)
327  {
329  return FALSE;
330  }
331 
332  if (NULL != UnsafeDx)
333  {
335  if (NULL == Dx)
336  {
339  return FALSE;
340  }
341  }
342  else
343  {
344  Dx = NULL;
345  }
346 
347  Status = MmCopyFromCaller(String, UnsafeString, Count * sizeof(WCHAR));
348  if (! NT_SUCCESS(Status))
349  {
350  if (NULL != Dx)
351  {
353  }
356  return FALSE;
357  }
358 
359  dc = DC_LockDc(hDC);
360  if (NULL == dc)
361  {
362  if (NULL != Dx)
363  {
365  }
368  return FALSE;
369  }
370  pdcattr = dc->pdcattr;
371  TextObj = RealizeFontInit(pdcattr->hlfntNew);
372  if ( TextObj )
373  {
375  TextObj,
376  String,
377  Count,
378  MaxExtent,
379  NULL == UnsafeFit ? NULL : &Fit,
380  Dx,
381  &Size,
382  fl);
383  TEXTOBJ_UnlockText(TextObj);
384  }
385  else
386  Result = FALSE;
387  DC_UnlockDc(dc);
388 
390  if (! Result)
391  {
392  if (NULL != Dx)
393  {
395  }
396  return FALSE;
397  }
398 
399  if (NULL != UnsafeFit)
400  {
401  Status = MmCopyToCaller(UnsafeFit, &Fit, sizeof(INT));
402  if (! NT_SUCCESS(Status))
403  {
404  if (NULL != Dx)
405  {
407  }
409  return FALSE;
410  }
411  }
412 
413  if (NULL != UnsafeDx)
414  {
415  Status = MmCopyToCaller(UnsafeDx, Dx, Count * sizeof(INT));
416  if (! NT_SUCCESS(Status))
417  {
418  if (NULL != Dx)
419  {
421  }
423  return FALSE;
424  }
425  }
426  if (NULL != Dx)
427  {
429  }
430 
431  Status = MmCopyToCaller(UnsafeSize, &Size, sizeof(SIZE));
432  if (! NT_SUCCESS(Status))
433  {
435  return FALSE;
436  }
437 
438  return TRUE;
439 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
LONG NTSTATUS
Definition: precomp.h:26
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
#define MmCopyFromCaller
Definition: polytest.cpp:29
HDC dc
Definition: cylfrac.c:34
#define MmCopyToCaller(x, y, z)
Definition: mmcopy.h:19
static WCHAR String[]
Definition: stringtable.c:55
int32_t INT
Definition: typedefs.h:56
_In_ FLONG fl
Definition: winddi.h:1279
Definition: text.h:59
long LONG
Definition: pedump.c:60
HANDLE hlfntNew
Definition: ntgdihdl.h:327
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
Definition: polytest.cpp:40
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
Status
Definition: gdiplustypes.h:24
static HDC hDC
Definition: 3dtext.c:33
#define GDITAG_TEXT
Definition: tags.h:171
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
PTEXTOBJ FASTCALL RealizeFontInit(HFONT hFont)
Definition: font.c:422
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
WCHAR * LPWSTR
Definition: xmlstorage.h:184
BOOL FASTCALL TextIntGetTextExtentPoint(PDC dc, PTEXTOBJ TextObj, LPCWSTR String, INT Count, ULONG MaxExtent, LPINT Fit, LPINT Dx, LPSIZE Size, FLONG fl)
Definition: freetype.c:3907
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
int * LPINT
Definition: windef.h:178

Referenced by GetTextExtentExPointA(), GetTextExtentExPointI(), GetTextExtentExPointW(), GetTextExtentExPointWPri(), and NtGdiGetTextExtent().

◆ NtGdiGetTextFaceW()

W32KAPI INT APIENTRY NtGdiGetTextFaceW ( IN HDC  hDC,
IN INT  Count,
OUT OPTIONAL LPWSTR  FaceName,
IN BOOL  bAliasName 
)

Definition at line 487 of file text.c.

493 {
494  PDC Dc;
495  PDC_ATTR pdcattr;
496  HFONT hFont;
497  PTEXTOBJ TextObj;
499  SIZE_T fLen;
500  INT ret;
501 
502  /* FIXME: Handle bAliasName */
503 
504  Dc = DC_LockDc(hDC);
505  if (Dc == NULL)
506  {
508  return FALSE;
509  }
510  pdcattr = Dc->pdcattr;
511  hFont = pdcattr->hlfntNew;
512  DC_UnlockDc(Dc);
513 
514  TextObj = RealizeFontInit(hFont);
515  ASSERT(TextObj != NULL);
516  fLen = wcslen(TextObj->TextFace) + 1;
517 
518  if (FaceName != NULL)
519  {
520  Count = min(Count, fLen);
521  Status = MmCopyToCaller(FaceName, TextObj->TextFace, Count * sizeof(WCHAR));
522  if (!NT_SUCCESS(Status))
523  {
524  TEXTOBJ_UnlockText(TextObj);
526  return 0;
527  }
528  /* Terminate if we copied only part of the font name */
529  if (Count > 0 && Count < fLen)
530  {
531  FaceName[Count - 1] = '\0';
532  }
533  ret = Count;
534  }
535  else
536  {
537  ret = fLen;
538  }
539 
540  TEXTOBJ_UnlockText(TextObj);
541  return ret;
542 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
LONG NTSTATUS
Definition: precomp.h:26
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
#define MmCopyToCaller(x, y, z)
Definition: mmcopy.h:19
int32_t INT
Definition: typedefs.h:56
HFONT hFont
Definition: main.c:53
Definition: text.h:59
HANDLE hlfntNew
Definition: ntgdihdl.h:327
smooth NULL
Definition: ftsmooth.c:416
Definition: polytest.cpp:40
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
int ret
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
Status
Definition: gdiplustypes.h:24
static HDC hDC
Definition: 3dtext.c:33
ULONG_PTR SIZE_T
Definition: typedefs.h:78
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
PTEXTOBJ FASTCALL RealizeFontInit(HFONT hFont)
Definition: font.c:422
WCHAR TextFace[LF_FACESIZE]
Definition: text.h:67
#define min(a, b)
Definition: monoChain.cc:55
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by GetTextFaceAliasW(), and GetTextFaceW().

◆ NtGdiGetTextMetricsW()

W32KAPI BOOL APIENTRY NtGdiGetTextMetricsW ( IN HDC  hDC,
OUT TMW_INTERNAL pUnsafeTmwi,
IN ULONG  cj 
)

Definition at line 547 of file text.c.

551 {
552  TMW_INTERNAL Tmwi;
553 
554  if ( cj <= sizeof(TMW_INTERNAL) )
555  {
556  if (ftGdiGetTextMetricsW(hDC, &Tmwi))
557  {
558  _SEH2_TRY
559  {
560  ProbeForWrite(pUnsafeTmwi, cj, 1);
561  RtlCopyMemory(pUnsafeTmwi, &Tmwi, cj);
562  }
564  {
566  _SEH2_YIELD(return FALSE);
567  }
568  _SEH2_END
569 
570  return TRUE;
571  }
572  }
573  return FALSE;
574 }
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
_In_ ULONG cj
Definition: winddi.h:3540
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
_SEH2_TRY
Definition: create.c:4250
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
BOOL FASTCALL ftGdiGetTextMetricsW(HDC hDC, PTMW_INTERNAL ptmwi)
Definition: freetype.c:4228
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
static HDC hDC
Definition: 3dtext.c:33
_SEH2_END
Definition: create.c:4424
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12

Referenced by GetTextMetricsA(), and GetTextMetricsW().

◆ NtGdiSetTextJustification()

BOOL APIENTRY NtGdiSetTextJustification ( HDC  hDC,
int  BreakExtra,
int  BreakCount 
)

Definition at line 460 of file text.c.

463 {
464  PDC pDc;
465  PDC_ATTR pdcattr;
466 
467  pDc = DC_LockDc(hDC);
468  if (!pDc)
469  {
471  return FALSE;
472  }
473 
474  pdcattr = pDc->pdcattr;
475 
476  pdcattr->lBreakExtra = BreakExtra;
477  pdcattr->cBreak = BreakCount;
478 
479  DC_UnlockDc(pDc);
480  return TRUE;
481 }
#define TRUE
Definition: types.h:120
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
LONG lBreakExtra
Definition: ntgdihdl.h:325
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
Definition: polytest.cpp:40
LONG cBreak
Definition: ntgdihdl.h:326
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27