ReactOS 0.4.16-dev-1225-g1286711
font.c File Reference
#include <win32k.h>
#include <debug.h>
Include dependency graph for font.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

HFONT APIENTRY HfontCreate (_In_ const ENUMLOGFONTEXDVW *pelfw, _In_ ULONG cjElfw, _In_ LFTYPE lft, _In_ FLONG fl, _In_opt_ PVOID pvCliData)
 
HFONT FASTCALL GreCreateFontIndirectW (_In_ const LOGFONTW *lplf)
 
DWORD FASTCALL GreGetKerningPairs (_In_ HDC hDC, _In_ ULONG NumPairs, _Out_writes_(NumPairs) LPKERNINGPAIR krnpair)
 
ULONG FASTCALL FontGetObject (_Inout_ PTEXTOBJ plfont, _In_ ULONG cjBuffer, _Out_ PVOID pvBuffer)
 
DWORD FASTCALL IntGetCharDimensions (_In_ HDC hdc, _Out_opt_ PTEXTMETRICW ptm, _Out_opt_ PDWORD height)
 
DWORD FASTCALL IntGetFontLanguageInfo (_In_ PDC Dc)
 
PTEXTOBJ FASTCALL RealizeFontInit (_In_ HFONT hFont)
 
static BOOL IntCheckFontPathNames (_In_reads_(cwc) PCWCH pwcFiles, _In_ ULONG cFiles, _In_ ULONG cwc)
 
INT APIENTRY NtGdiAddFontResourceW (_In_reads_(cwc) PCWCH pwcFiles, _In_ ULONG cwc, _In_ ULONG cFiles, _In_ FLONG fl, _In_ DWORD dwPidTid, _In_opt_ const DESIGNVECTOR *pdv)
 
BOOL APIENTRY NtGdiRemoveFontResourceW (_In_reads_(cwc) PCWCH pwszFiles, _In_ ULONG cwc, _In_ ULONG cFiles, _In_ ULONG fl, _In_ DWORD dwPidTid, _In_opt_ const DESIGNVECTOR *pdv)
 
HANDLE APIENTRY NtGdiAddFontMemResourceEx (_In_reads_bytes_(cjBuffer) const VOID *pvBuffer, _In_ DWORD cjBuffer, _In_reads_bytes_opt_(cjDV) const DESIGNVECTOR *pdv, _In_ ULONG cjDV, _Out_ PDWORD pNumFonts)
 
BOOL APIENTRY NtGdiRemoveFontMemResourceEx (_In_ HANDLE hMMFont)
 
DWORD APIENTRY NtGdiGetCharacterPlacementW (_In_ HDC hdc, _In_reads_(nCount) PCWCH pwsz, _In_ INT nCount, _In_ INT nMaxExtent, _Inout_opt_ LPGCP_RESULTSW pgcpw, _In_ DWORD dwFlags)
 
DWORD APIENTRY NtGdiGetFontData (_In_ HDC hDC, _In_ DWORD Table, _In_ DWORD Offset, _Out_writes_bytes_(Size) PVOID Buffer, _In_ DWORD Size)
 
DWORD APIENTRY NtGdiGetFontUnicodeRanges (_In_ HDC hdc, _Out_opt_ LPGLYPHSET pgs)
 
ULONG APIENTRY NtGdiGetGlyphOutline (_In_ HDC hdc, _In_ WCHAR wch, _In_ UINT iFormat, _Out_ LPGLYPHMETRICS pgm, _In_ ULONG cjBuf, _Out_writes_bytes_opt_(cjBuf) PVOID UnsafeBuf, _In_opt_ const MAT2 *pmat2, _In_ BOOL bIgnoreRotation)
 
DWORD APIENTRY NtGdiGetKerningPairs (_In_ HDC hDC, _In_ ULONG NumPairs, _Out_writes_(NumPairs) LPKERNINGPAIR krnpair)
 
ULONG APIENTRY NtGdiGetOutlineTextMetricsInternalW (_In_ HDC hDC, _In_ ULONG Data, _Out_opt_ POUTLINETEXTMETRICW otm, _In_ PTMDIFF Tmd)
 
W32KAPI BOOL APIENTRY NtGdiGetFontResourceInfoInternalW (_In_reads_(cwc) PCWCH pwszFiles, _In_ ULONG cwc, _In_ ULONG cFiles, _In_ UINT cjIn, _Inout_ PDWORD pdwBytes, _Out_writes_bytes_(*pdwBytes) PVOID pvBuf, _In_ DWORD dwType)
 
BOOL APIENTRY NtGdiGetRealizationInfo (_In_ HDC hdc, _Out_ PREALIZATION_INFO pri, _In_ HFONT hf)
 
HFONT APIENTRY HfontCreate (const ENUMLOGFONTEXDVW *pelfw, _In_ ULONG cjElfw, _In_ LFTYPE lft, _In_ FLONG fl, _In_opt_ PVOID pvCliData)
 
HFONT APIENTRY NtGdiHfontCreate (_In_reads_bytes_(cjElfw) const ENUMLOGFONTEXDVW *pelfw, _In_ ULONG cjElfw, _In_ LFTYPE lft, _In_ FLONG fl, _In_opt_ PVOID pvCliData)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Includes

Definition at line 14 of file font.c.

Function Documentation

◆ FontGetObject()

ULONG FASTCALL FontGetObject ( _Inout_ PTEXTOBJ  plfont,
_In_ ULONG  cjBuffer,
_Out_ PVOID  pvBuffer 
)

Definition at line 296 of file font.c.

300{
301 ULONG cjMaxSize;
302 ENUMLOGFONTEXDVW *plf;
303
304 ASSERT(plfont);
305 plf = &plfont->logfont;
306
307 if (!(plfont->fl & TEXTOBJECT_INIT))
308 {
310 DPRINT("FontGetObject font not initialized!\n");
311
312 Status = TextIntRealizeFont(plfont->BaseObject.hHmgr, plfont);
313 if (!NT_SUCCESS(Status))
314 {
315 DPRINT1("FontGetObject(TextIntRealizeFont) Status = 0x%lx\n", Status);
316 }
317 }
318
319 /* If buffer is NULL, only the size is requested */
320 if (pvBuffer == NULL) return sizeof(LOGFONTW);
321
322 /* Calculate the maximum size according to number of axes */
323 cjMaxSize = FIELD_OFFSET(ENUMLOGFONTEXDVW,
324 elfDesignVector.dvValues[plf->elfDesignVector.dvNumAxes]);
325
326 if (cjBuffer > cjMaxSize) cjBuffer = cjMaxSize;
327
328 RtlCopyMemory(pvBuffer, plf, cjBuffer);
329
330 return cjBuffer;
331}
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
NTSTATUS FASTCALL TextIntRealizeFont(HFONT FontHandle, PTEXTOBJ pTextObj)
Definition: freetype.c:6104
Status
Definition: gdiplustypes.h:25
#define ASSERT(a)
Definition: mode.c:44
_In_ ULONG cjBuffer
Definition: ntgdi.h:2860
#define DPRINT
Definition: sndvol32.h:73
DWORD dvNumAxes
Definition: wingdi.h:2769
DESIGNVECTOR elfDesignVector
Definition: wingdi.h:2780
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG
Definition: typedefs.h:59
#define TEXTOBJECT_INIT
Definition: text.h:56

Referenced by GreGetObject().

◆ GreCreateFontIndirectW()

HFONT FASTCALL GreCreateFontIndirectW ( _In_ const LOGFONTW lplf)

Internal

Definition at line 28 of file font.c.

29{
30 if (lplf)
31 {
32 ENUMLOGFONTEXDVW Logfont;
33
34 RtlCopyMemory( &Logfont.elfEnumLogfontEx.elfLogFont, lplf, sizeof(LOGFONTW));
36 sizeof(Logfont.elfEnumLogfontEx.elfFullName));
38 sizeof(Logfont.elfEnumLogfontEx.elfStyle));
40 sizeof(Logfont.elfEnumLogfontEx.elfScript));
41
42 Logfont.elfDesignVector.dvNumAxes = 0;
43
44 RtlZeroMemory( &Logfont.elfDesignVector, sizeof(DESIGNVECTOR));
45
46 return HfontCreate(&Logfont, 0, 0, 0, NULL);
47 }
48 else return NULL;
49}
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2779
WCHAR elfStyle[LF_FACESIZE]
Definition: wingdi.h:2704
LOGFONTW elfLogFont
Definition: wingdi.h:2702
WCHAR elfFullName[LF_FULLFACESIZE]
Definition: wingdi.h:2703
WCHAR elfScript[LF_FACESIZE]
Definition: wingdi.h:2705
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
HFONT APIENTRY HfontCreate(_In_ const ENUMLOGFONTEXDVW *pelfw, _In_ ULONG cjElfw, _In_ LFTYPE lft, _In_ FLONG fl, _In_opt_ PVOID pvCliData)

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

◆ GreGetKerningPairs()

DWORD FASTCALL GreGetKerningPairs ( _In_ HDC  hDC,
_In_ ULONG  NumPairs,
_Out_writes_(NumPairs) LPKERNINGPAIR  krnpair 
)

Definition at line 53 of file font.c.

57{
58 PDC dc;
59 PDC_ATTR pdcattr;
60 PTEXTOBJ TextObj;
61 PFONTGDI FontGDI;
63 KERNINGPAIR *pKP;
64
65 dc = DC_LockDc(hDC);
66 if (!dc)
67 {
69 return 0;
70 }
71
72 pdcattr = dc->pdcattr;
73 TextObj = RealizeFontInit(pdcattr->hlfntNew);
75
76 if (!TextObj)
77 {
79 return 0;
80 }
81
82 FontGDI = ObjToGDI(TextObj->Font, FONT);
83 TEXTOBJ_UnlockText(TextObj);
84
85 Count = ftGdiGetKerningPairs(FontGDI,0,NULL);
86
87 if ( Count && krnpair )
88 {
89 if (Count > NumPairs)
90 {
92 return 0;
93 }
95 if (!pKP)
96 {
98 return 0;
99 }
100 ftGdiGetKerningPairs(FontGDI,Count,pKP);
101
102 RtlCopyMemory(krnpair, pKP, Count * sizeof(KERNINGPAIR));
103
105 }
106 return Count;
107}
static HDC hDC
Definition: 3dtext.c:33
HDC dc
Definition: cylfrac.c:34
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:238
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:220
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
#define ObjToGDI(ClipObj, Type)
Definition: engobjects.h:184
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PagedPool
Definition: env_spec_w32.h:308
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD FASTCALL ftGdiGetKerningPairs(PFONTGDI Font, DWORD cPairs, LPKERNINGPAIR pKerningPair)
Definition: freetype.c:6581
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
int Count
Definition: noreturn.cpp:7
Definition: polytest.cpp:41
HANDLE hlfntNew
Definition: ntgdihdl.h:330
Definition: text.h:60
FONTOBJ * Font
Definition: text.h:66
PTEXTOBJ FASTCALL RealizeFontInit(_In_ HFONT hFont)
Definition: font.c:431
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
#define GDITAG_TEXT
Definition: tags.h:172
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:22

◆ HfontCreate() [1/2]

HFONT APIENTRY HfontCreate ( _In_ const ENUMLOGFONTEXDVW pelfw,
_In_ ULONG  cjElfw,
_In_ LFTYPE  lft,
_In_ FLONG  fl,
_In_opt_ PVOID  pvCliData 
)

◆ HfontCreate() [2/2]

HFONT APIENTRY HfontCreate ( const ENUMLOGFONTEXDVW pelfw,
_In_ ULONG  cjElfw,
_In_ LFTYPE  lft,
_In_ FLONG  fl,
_In_opt_ PVOID  pvCliData 
)

Definition at line 1221 of file font.c.

1227{
1228 HFONT hNewFont;
1229 PLFONT plfont;
1230
1231 if (!pelfw)
1232 {
1233 return NULL;
1234 }
1235
1236 plfont = LFONT_AllocFontWithHandle();
1237 if (!plfont)
1238 {
1239 return NULL;
1240 }
1241 hNewFont = plfont->BaseObject.hHmgr;
1242
1243 plfont->lft = lft;
1244 plfont->fl = fl;
1245 RtlCopyMemory (&plfont->logfont, pelfw, sizeof(ENUMLOGFONTEXDVW));
1246 ExInitializePushLock(&plfont->lock);
1247
1250 {
1251 /* This should really depend on whether GM_ADVANCED is set */
1254 }
1255 LFONT_UnlockFont(plfont);
1256
1257 if (pvCliData && hNewFont)
1258 {
1259 // FIXME: Use GDIOBJ_InsertUserData
1261 {
1264 Entry->UserData = pvCliData;
1265 }
1267 }
1268
1269 return hNewFont;
1270}
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
#define ExInitializePushLock
Definition: ex.h:1016
#define GDI_HANDLE_GET_INDEX(h)
Definition: gdi.h:28
#define KeLeaveCriticalRegion()
Definition: ke_x.h:119
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
base of all file and directory entries
Definition: entries.h:83
Definition: gdi.h:2
LFTYPE lft
Definition: text.h:64
BASEOBJECT BaseObject
Definition: text.h:63
FLONG fl
Definition: text.h:65
ENUMLOGFONTEXDVW logfont
Definition: text.h:70
EX_PUSH_LOCK lock
Definition: text.h:71
LONG lfOrientation
Definition: wingdi.h:1900
LONG lfEscapement
Definition: wingdi.h:1899
int32_t INT
Definition: typedefs.h:58
_In_ WDFCOLLECTION _In_ ULONG Index
#define GdiHandleTable
Definition: win32nt.h:37
#define LFONT_UnlockFont(plfnt)
Definition: text.h:79
#define LFONT_AllocFontWithHandle()
Definition: text.h:76
_In_ FLONG fl
Definition: winddi.h:1279

◆ IntCheckFontPathNames()

static BOOL IntCheckFontPathNames ( _In_reads_(cwc) PCWCH  pwcFiles,
_In_ ULONG  cFiles,
_In_ ULONG  cwc 
)
static

Definition at line 451 of file font.c.

455{
456 ULONG ich, cRealFiles;
457
458 if (pwcFiles[cwc - 1] != UNICODE_NULL)
459 return FALSE;
460
461 for (ich = cRealFiles = 0; ich < cwc; ++ich)
462 {
463 if (!pwcFiles[ich])
464 ++cRealFiles;
465 }
466
467 return cRealFiles >= cFiles;
468}
#define FALSE
Definition: types.h:117
#define UNICODE_NULL

Referenced by NtGdiAddFontResourceW(), and NtGdiRemoveFontResourceW().

◆ IntGetCharDimensions()

DWORD FASTCALL IntGetCharDimensions ( _In_ HDC  hdc,
_Out_opt_ PTEXTMETRICW  ptm,
_Out_opt_ PDWORD  height 
)

Definition at line 335 of file font.c.

339{
340 PDC pdc;
341 PDC_ATTR pdcattr;
342 PTEXTOBJ TextObj;
343 SIZE sz;
344 TMW_INTERNAL tmwi;
345 BOOL Good;
346
347 static const WCHAR alphabet[] = {
348 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q',
349 'r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H',
350 'I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',0};
351
352 if(!ftGdiGetTextMetricsW(hdc, &tmwi)) return 0;
353
354 pdc = DC_LockDc(hdc);
355
356 if (!pdc) return 0;
357
358 pdcattr = pdc->pdcattr;
359
360 TextObj = RealizeFontInit(pdcattr->hlfntNew);
361 if ( !TextObj )
362 {
363 DC_UnlockDc(pdc);
364 return 0;
365 }
366 Good = TextIntGetTextExtentPoint(pdc, TextObj, alphabet, 52, 0, NULL, NULL, &sz, 0);
367 TEXTOBJ_UnlockText(TextObj);
368 DC_UnlockDc(pdc);
369
370 if (!Good) return 0;
371 if (ptm) *ptm = tmwi.TextMetric;
372 if (height) *height = tmwi.TextMetric.tmHeight;
373
374 return (sz.cx / 26 + 1) / 2;
375}
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL FASTCALL TextIntGetTextExtentPoint(_In_ PDC dc, _In_ PTEXTOBJ TextObj, _In_reads_(Count) PCWCH String, _In_ INT Count, _In_ ULONG MaxExtent, _Out_ PINT Fit, _Out_writes_to_opt_(Count, *Fit) PINT Dx, _Out_ PSIZE Size, _In_ FLONG fl)
Definition: freetype.c:5154
BOOL FASTCALL ftGdiGetTextMetricsW(HDC hDC, PTMW_INTERNAL ptmwi)
Definition: freetype.c:5464
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
HDC hdc
Definition: main.c:9
LONG cx
Definition: kdterminal.h:27
TEXTMETRICW TextMetric
Definition: ntgdityp.h:370
LONG tmHeight
Definition: wingdi.h:2383
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by co_IntInitializeDesktopGraphics(), IntGetDialogBaseUnits(), MENU_CalcItemSize(), and UserChangeDisplaySettings().

◆ IntGetFontLanguageInfo()

DWORD FASTCALL IntGetFontLanguageInfo ( _In_ PDC  Dc)

Definition at line 380 of file font.c.

381{
382 PDC_ATTR pdcattr;
383 FONTSIGNATURE fontsig;
384 static const DWORD GCP_DBCS_MASK=0x003F0000,
385 GCP_DIACRITIC_MASK=0x00000000,
386 FLI_GLYPHS_MASK=0x00000000,
387 GCP_GLYPHSHAPE_MASK=0x00000040,
388 GCP_KASHIDA_MASK=0x00000000,
389 GCP_LIGATE_MASK=0x00000000,
390 GCP_USEKERNING_MASK=0x00000000,
391 GCP_REORDER_MASK=0x00000060;
392
393 DWORD result=0;
394
395 ftGdiGetTextCharsetInfo( Dc, &fontsig, 0 );
396
397 /* We detect each flag we return using a bitmask on the Codepage Bitfields */
398 if( (fontsig.fsCsb[0]&GCP_DBCS_MASK)!=0 )
400
401 if( (fontsig.fsCsb[0]&GCP_DIACRITIC_MASK)!=0 )
403
404 if( (fontsig.fsCsb[0]&FLI_GLYPHS_MASK)!=0 )
406
407 if( (fontsig.fsCsb[0]&GCP_GLYPHSHAPE_MASK)!=0 )
409
410 if( (fontsig.fsCsb[0]&GCP_KASHIDA_MASK)!=0 )
412
413 if( (fontsig.fsCsb[0]&GCP_LIGATE_MASK)!=0 )
415
416 if( (fontsig.fsCsb[0]&GCP_USEKERNING_MASK)!=0 )
418
419 pdcattr = Dc->pdcattr;
420
421 /* This might need a test for a HEBREW- or ARABIC_CHARSET as well */
422 if ( pdcattr->flTextAlign & TA_RTLREADING )
423 if( (fontsig.fsCsb[0]&GCP_REORDER_MASK)!=0 )
425
426 return result;
427}
INT FASTCALL ftGdiGetTextCharsetInfo(PDC Dc, LPFONTSIGNATURE lpSig, DWORD dwFlags)
Definition: freetype.c:5277
GLuint64EXT * result
Definition: glext.h:11304
FLONG flTextAlign
Definition: ntgdihdl.h:324
DWORD fsCsb[2]
Definition: wingdi.h:1543
#define GCP_GLYPHSHAPE
Definition: wingdi.h:833
#define GCP_DIACRITIC
Definition: wingdi.h:831
#define GCP_LIGATE
Definition: wingdi.h:837
#define GCP_USEKERNING
Definition: wingdi.h:845
#define GCP_KASHIDA
Definition: wingdi.h:836
#define FLI_GLYPHS
Definition: wingdi.h:846
#define TA_RTLREADING
Definition: wingdi.h:934
#define GCP_REORDER
Definition: wingdi.h:843
#define GCP_DBCS
Definition: wingdi.h:828

Referenced by NtGdiGetDCDword().

◆ NtGdiAddFontMemResourceEx()

HANDLE APIENTRY NtGdiAddFontMemResourceEx ( _In_reads_bytes_(cjBuffer) const VOID pvBuffer,
_In_ DWORD  cjBuffer,
_In_reads_bytes_opt_(cjDV) const DESIGNVECTOR pdv,
_In_ ULONG  cjDV,
_Out_ PDWORD  pNumFonts 
)

Definition at line 582 of file font.c.

588{
590 HANDLE Ret;
591 DWORD NumFonts = 0;
592
593 DPRINT("NtGdiAddFontMemResourceEx\n");
596
597 if (!pvBuffer || !cjBuffer)
598 return NULL;
599
601 {
602 ProbeForRead(pvBuffer, cjBuffer, sizeof(BYTE));
604 RtlCopyMemory(Buffer, pvBuffer, cjBuffer);
605 }
607 {
608 if (Buffer != NULL)
609 {
611 }
612 _SEH2_YIELD(return NULL);
613 }
614 _SEH2_END;
615
616 Ret = IntGdiAddFontMemResource(Buffer, cjBuffer, &NumFonts);
618
620 {
621 ProbeForWrite(pNumFonts, sizeof(NumFonts), 1);
622 *pNumFonts = NumFonts;
623 }
625 {
626 /* Leak it? */
627 _SEH2_YIELD(return NULL);
628 }
629 _SEH2_END;
630
631
632 return Ret;
633}
Definition: bufpool.h:45
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
HANDLE FASTCALL IntGdiAddFontMemResource(PVOID Buffer, DWORD dwSize, PDWORD pNumAdded)
Definition: freetype.c:2651
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define DBG_UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:330
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:82
#define _SEH2_VOLATILE
Definition: pseh2_64.h:185
#define _SEH2_END
Definition: pseh2_64.h:171
#define _SEH2_TRY
Definition: pseh2_64.h:71
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:184
#define TAG_FONT
Definition: tags.h:12
_In_ ULONG_PTR _In_opt_ DESIGNVECTOR * pdv
Definition: winddi.h:3723
#define ExAllocatePoolWithQuotaTag(a, b, c)
Definition: exfuncs.h:530
unsigned char BYTE
Definition: xxhash.c:193

Referenced by AddFontMemResourceEx().

◆ NtGdiAddFontResourceW()

INT APIENTRY NtGdiAddFontResourceW ( _In_reads_(cwc) PCWCH  pwcFiles,
_In_ ULONG  cwc,
_In_ ULONG  cFiles,
_In_ FLONG  fl,
_In_ DWORD  dwPidTid,
_In_opt_ const DESIGNVECTOR pdv 
)

Functions

Definition at line 474 of file font.c.

481{
482 UNICODE_STRING SafeFileName;
483 INT Ret;
484
487
488 DPRINT("NtGdiAddFontResourceW\n");
489
490 /* cwc = Length + trailing zero. */
491 if ((cwc <= 1) || (cwc > UNICODE_STRING_MAX_CHARS))
492 return 0;
493
494 SafeFileName.Length = (USHORT)((cwc - 1) * sizeof(WCHAR));
495 SafeFileName.MaximumLength = SafeFileName.Length + sizeof(UNICODE_NULL);
497 SafeFileName.MaximumLength,
498 TAG_STRING);
499 if (!SafeFileName.Buffer)
500 return 0;
501
503 {
504 ProbeForRead(pwcFiles, cwc * sizeof(WCHAR), sizeof(WCHAR));
505
506 if (!IntCheckFontPathNames(pwcFiles, cFiles, cwc))
507 return 0;
508
509 RtlCopyMemory(SafeFileName.Buffer, pwcFiles, SafeFileName.Length);
510 }
512 {
513 ExFreePoolWithTag(SafeFileName.Buffer, TAG_STRING);
514 _SEH2_YIELD(return 0);
515 }
516 _SEH2_END;
517
518 SafeFileName.Buffer[SafeFileName.Length / sizeof(WCHAR)] = UNICODE_NULL;
519
520 Ret = IntGdiAddFontResourceEx(&SafeFileName, cFiles, fl, 0);
521
522 ExFreePoolWithTag(SafeFileName.Buffer, TAG_STRING);
523 return Ret;
524}
INT FASTCALL IntGdiAddFontResourceEx(_In_ PCUNICODE_STRING FileName, _In_ DWORD cFiles, _In_ DWORD Characteristics, _In_ DWORD dwFlags)
Definition: freetype.c:2292
#define UNICODE_STRING_MAX_CHARS
#define TAG_STRING
Definition: oslist.h:22
unsigned short USHORT
Definition: pedump.c:61
USHORT MaximumLength
Definition: env_spec_w32.h:370
static BOOL IntCheckFontPathNames(_In_reads_(cwc) PCWCH pwcFiles, _In_ ULONG cFiles, _In_ ULONG cwc)
Definition: font.c:451

◆ NtGdiGetCharacterPlacementW()

DWORD APIENTRY NtGdiGetCharacterPlacementW ( _In_ HDC  hdc,
_In_reads_(nCount) PCWCH  pwsz,
_In_ INT  nCount,
_In_ INT  nMaxExtent,
_Inout_opt_ LPGCP_RESULTSW  pgcpw,
_In_ DWORD  dwFlags 
)

Definition at line 650 of file font.c.

657{
659 return 0;
660#if 0
661 return GreGetCharacterPlacementW( hdc,
662 pwsz,
663 nCount,
664 nMaxExtent,
665 pgcpw,
666 dwFlags);
667#endif
668}
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

Referenced by NewGetCharacterPlacementW().

◆ NtGdiGetFontData()

DWORD APIENTRY NtGdiGetFontData ( _In_ HDC  hDC,
_In_ DWORD  Table,
_In_ DWORD  Offset,
_Out_writes_bytes_(Size) PVOID  Buffer,
_In_ DWORD  Size 
)

Definition at line 672 of file font.c.

678{
679 PDC Dc;
680 PDC_ATTR pdcattr;
681 HFONT hFont;
682 PTEXTOBJ TextObj;
683 PFONTGDI FontGdi;
686
687 if (Buffer && Size)
688 {
690 {
692 }
694 {
696 }
698 }
699
700 if (!NT_SUCCESS(Status)) return Result;
701
702 Dc = DC_LockDc(hDC);
703 if (Dc == NULL)
704 {
706 return GDI_ERROR;
707 }
708 pdcattr = Dc->pdcattr;
709
710 hFont = pdcattr->hlfntNew;
711 TextObj = RealizeFontInit(hFont);
712 DC_UnlockDc(Dc);
713
714 if (TextObj == NULL)
715 {
717 return GDI_ERROR;
718 }
719
720 FontGdi = ObjToGDI(TextObj->Font, FONT);
721
723
724 TEXTOBJ_UnlockText(TextObj);
725
726 return Result;
727}
HFONT hFont
Definition: main.c:53
DWORD FASTCALL ftGdiGetFontData(PFONTGDI FontGdi, DWORD Table, DWORD Offset, PVOID Buffer, DWORD Size)
Definition: freetype.c:5562
ASMGENDATA Table[]
Definition: genincdata.c:61
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:181
#define STATUS_SUCCESS
Definition: shellext.h:65
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
#define GDI_ERROR
Definition: wingdi.h:1309
_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:409

Referenced by GetFontData().

◆ NtGdiGetFontResourceInfoInternalW()

W32KAPI BOOL APIENTRY NtGdiGetFontResourceInfoInternalW ( _In_reads_(cwc) PCWCH  pwszFiles,
_In_ ULONG  cwc,
_In_ ULONG  cFiles,
_In_ UINT  cjIn,
_Inout_ PDWORD  pdwBytes,
_Out_writes_bytes_ *pdwBytes PVOID  pvBuf,
_In_ DWORD  dwType 
)

Definition at line 1041 of file font.c.

1049{
1051 DWORD dwBytes, dwBytesRequested;
1052 UNICODE_STRING SafeFileNames;
1053 BOOL bRet = FALSE;
1054 ULONG cbStringSize;
1055 LPVOID Buffer;
1056
1057 /* FIXME: Handle cFiles > 0 */
1058
1059 /* Check for valid dwType values */
1060 if (dwType > 5)
1061 {
1063 return FALSE;
1064 }
1065
1066 /* Allocate a safe unicode string buffer */
1067 cbStringSize = cwc * sizeof(WCHAR);
1068 SafeFileNames.MaximumLength = SafeFileNames.Length = (USHORT)cbStringSize - sizeof(WCHAR);
1069 SafeFileNames.Buffer = ExAllocatePoolWithTag(PagedPool,
1070 cbStringSize,
1071 TAG_USTR);
1072 if (!SafeFileNames.Buffer)
1073 {
1075 return FALSE;
1076 }
1077 RtlZeroMemory(SafeFileNames.Buffer, SafeFileNames.MaximumLength);
1078
1079 /* Check buffers and copy pwszFiles to safe unicode string */
1080 _SEH2_TRY
1081 {
1082 ProbeForRead(pwszFiles, cbStringSize, 1);
1083 ProbeForWrite(pdwBytes, sizeof(DWORD), 1);
1084 if (pvBuf)
1085 ProbeForWrite(pvBuf, cjIn, 1);
1086
1087 dwBytes = *pdwBytes;
1088 dwBytesRequested = dwBytes;
1089
1090 RtlCopyMemory(SafeFileNames.Buffer, pwszFiles, cbStringSize);
1091 if (dwBytes > 0)
1092 {
1094 }
1095 else
1096 {
1098 }
1099 }
1101 {
1103 }
1104 _SEH2_END
1105
1106 if(!NT_SUCCESS(Status))
1107 {
1109 /* Free the string buffer for the safe filename */
1110 ExFreePoolWithTag(SafeFileNames.Buffer, TAG_USTR);
1111 return FALSE;
1112 }
1113
1114 /* Do the actual call */
1115 bRet = IntGdiGetFontResourceInfo(&SafeFileNames,
1116 (pvBuf ? Buffer : NULL),
1117 &dwBytes, dwType);
1118
1119 /* Check if succeeded */
1120 if (bRet)
1121 {
1122 /* Copy the data back to caller */
1123 _SEH2_TRY
1124 {
1125 /* Buffers are already probed */
1126 if (pvBuf && dwBytesRequested > 0)
1127 RtlCopyMemory(pvBuf, Buffer, min(dwBytesRequested, dwBytes));
1128 *pdwBytes = dwBytes;
1129 }
1131 {
1133 }
1134 _SEH2_END
1135
1136 if(!NT_SUCCESS(Status))
1137 {
1139 bRet = FALSE;
1140 }
1141 }
1142
1144 /* Free the string for the safe filenames */
1145 ExFreePoolWithTag(SafeFileNames.Buffer, TAG_USTR);
1146
1147 return bRet;
1148}
#define TAG_USTR
Definition: libsupp.c:997
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
BOOL FASTCALL IntGdiGetFontResourceInfo(PUNICODE_STRING FileName, PVOID pBuffer, DWORD *pdwBytes, DWORD dwType)
Definition: freetype.c:6294
static PWSTR PDWORD pdwBytes
Definition: layerapi.c:35
#define min(a, b)
Definition: monoChain.cc:55
VOID FASTCALL SetLastNtError(_In_ NTSTATUS Status)
Definition: error.c:31
#define TAG_FINF
Definition: text.h:3
_In_ ULONG _In_ CLIPOBJ _In_ RECTL _In_ ULONG cjIn
Definition: winddi.h:3532

◆ NtGdiGetFontUnicodeRanges()

DWORD APIENTRY NtGdiGetFontUnicodeRanges ( _In_ HDC  hdc,
_Out_opt_ LPGLYPHSET  pgs 
)

Definition at line 732 of file font.c.

735{
736 PDC pDc;
737 PDC_ATTR pdcattr;
738 HFONT hFont;
739 PTEXTOBJ TextObj;
740 PFONTGDI FontGdi;
741 DWORD Size = 0;
742 PGLYPHSET pgsSafe;
744
745 pDc = DC_LockDc(hdc);
746 if (!pDc)
747 {
749 return 0;
750 }
751
752 pdcattr = pDc->pdcattr;
753
754 hFont = pdcattr->hlfntNew;
755 TextObj = RealizeFontInit(hFont);
756
757 if ( TextObj == NULL)
758 {
760 goto Exit;
761 }
762 FontGdi = ObjToGDI(TextObj->Font, FONT);
763
764 Size = ftGetFontUnicodeRanges( FontGdi, NULL);
765
766 if (Size && pgs)
767 {
769 if (!pgsSafe)
770 {
772 Size = 0;
773 goto Exit;
774 }
775
776 Size = ftGetFontUnicodeRanges( FontGdi, pgsSafe);
777
778 if (Size)
779 {
781 {
782 ProbeForWrite(pgs, Size, 1);
783 RtlCopyMemory(pgs, pgsSafe, Size);
784 }
786 {
788 }
790
791 if (!NT_SUCCESS(Status)) Size = 0;
792 }
794 }
795Exit:
796 TEXTOBJ_UnlockText(TextObj);
797 DC_UnlockDc(pDc);
798 return Size;
799}
DWORD FASTCALL ftGetFontUnicodeRanges(PFONTGDI Font, PGLYPHSET glyphset)
Definition: freetype.c:5390
static void Exit(void)
Definition: sock.c:1330

◆ NtGdiGetGlyphOutline()

ULONG APIENTRY NtGdiGetGlyphOutline ( _In_ HDC  hdc,
_In_ WCHAR  wch,
_In_ UINT  iFormat,
_Out_ LPGLYPHMETRICS  pgm,
_In_ ULONG  cjBuf,
_Out_writes_bytes_opt_(cjBuf) PVOID  UnsafeBuf,
_In_opt_ const MAT2 pmat2,
_In_ BOOL  bIgnoreRotation 
)

Definition at line 803 of file font.c.

812{
813 ULONG Ret = GDI_ERROR;
814 PDC dc;
815 PVOID pvBuf = NULL;
816 GLYPHMETRICS gm;
818
819 dc = DC_LockDc(hdc);
820 if (!dc)
821 {
823 return GDI_ERROR;
824 }
825
826 if (UnsafeBuf && cjBuf)
827 {
829 if (!pvBuf)
830 {
832 goto Exit;
833 }
834 }
835
837 wch,
838 iFormat,
839 pgm ? &gm : NULL,
840 cjBuf,
841 pvBuf,
842 pmat2,
843 bIgnoreRotation);
844
845 if (pvBuf)
846 {
848 {
849 ProbeForWrite(UnsafeBuf, cjBuf, 1);
850 RtlCopyMemory(UnsafeBuf, pvBuf, cjBuf);
851 }
853 {
855 }
857
859 }
860
861 if (pgm)
862 {
864 {
865 ProbeForWrite(pgm, sizeof(GLYPHMETRICS), 1);
866 RtlCopyMemory(pgm, &gm, sizeof(GLYPHMETRICS));
867 }
869 {
871 }
873 }
874
875 if (! NT_SUCCESS(Status))
876 {
878 Ret = GDI_ERROR;
879 }
880
881Exit:
883 return Ret;
884}
ULONG FASTCALL ftGdiGetGlyphOutline(PDC dc, WCHAR wch, UINT iFormat, LPGLYPHMETRICS pgm, ULONG cjBuf, PVOID pvBuf, const MAT2 *pmat2, BOOL bIgnoreRotation)
Definition: freetype.c:4626
FORCEINLINE PVOID ExAllocatePoolZero(ULONG PoolType, SIZE_T NumberOfBytes, ULONG Tag)
Definition: precomp.h:45
_In_ DWORD cjBuf
Definition: winddi.h:3827
_In_ SIZEL _In_ ULONG iFormat
Definition: winddi.h:3468

◆ NtGdiGetKerningPairs()

DWORD APIENTRY NtGdiGetKerningPairs ( _In_ HDC  hDC,
_In_ ULONG  NumPairs,
_Out_writes_(NumPairs) LPKERNINGPAIR  krnpair 
)

Definition at line 888 of file font.c.

892{
893 PDC dc;
894 PDC_ATTR pdcattr;
895 PTEXTOBJ TextObj;
896 PFONTGDI FontGDI;
897 DWORD Count;
898 KERNINGPAIR *pKP;
900
901 dc = DC_LockDc(hDC);
902 if (!dc)
903 {
905 return 0;
906 }
907
908 pdcattr = dc->pdcattr;
909 TextObj = RealizeFontInit(pdcattr->hlfntNew);
911
912 if (!TextObj)
913 {
915 return 0;
916 }
917
918 FontGDI = ObjToGDI(TextObj->Font, FONT);
919 TEXTOBJ_UnlockText(TextObj);
920
921 Count = ftGdiGetKerningPairs(FontGDI,0,NULL);
922
923 if ( Count && krnpair )
924 {
925 if (Count > NumPairs)
926 {
928 return 0;
929 }
931 if (!pKP)
932 {
934 return 0;
935 }
936 ftGdiGetKerningPairs(FontGDI,Count,pKP);
938 {
939 ProbeForWrite(krnpair, Count * sizeof(KERNINGPAIR), 1);
940 RtlCopyMemory(krnpair, pKP, Count * sizeof(KERNINGPAIR));
941 }
943 {
945 }
947 if (!NT_SUCCESS(Status))
948 {
950 Count = 0;
951 }
953 }
954 return Count;
955}

◆ NtGdiGetOutlineTextMetricsInternalW()

ULONG APIENTRY NtGdiGetOutlineTextMetricsInternalW ( _In_ HDC  hDC,
_In_ ULONG  Data,
_Out_opt_ POUTLINETEXTMETRICW  otm,
_In_ PTMDIFF  Tmd 
)

Definition at line 963 of file font.c.

968{
969 PDC dc;
970 PDC_ATTR pdcattr;
971 PTEXTOBJ TextObj;
972 PFONTGDI FontGDI;
973 HFONT hFont = 0;
974 ULONG Size;
975 OUTLINETEXTMETRICW *potm;
977
978 dc = DC_LockDc(hDC);
979 if (!dc)
980 {
982 return 0;
983 }
984 pdcattr = dc->pdcattr;
985 hFont = pdcattr->hlfntNew;
986 TextObj = RealizeFontInit(hFont);
988 if (!TextObj)
989 {
991 return 0;
992 }
993 FontGDI = ObjToGDI(TextObj->Font, FONT);
994 if (!(FontGDI->flType & FO_TYPE_TRUETYPE))
995 {
996 TEXTOBJ_UnlockText(TextObj);
997 return 0;
998 }
999 TextIntUpdateSize(dc, TextObj, FontGDI, TRUE);
1000 TEXTOBJ_UnlockText(TextObj);
1001 Size = IntGetOutlineTextMetrics(FontGDI, 0, NULL, FALSE);
1002 if (!otm) return Size;
1003 if (Size > Data)
1004 {
1006 return 0;
1007 }
1009 if (!potm)
1010 {
1012 return 0;
1013 }
1014 RtlZeroMemory(potm, Size);
1015 IntGetOutlineTextMetrics(FontGDI, Size, potm, FALSE);
1016
1017 _SEH2_TRY
1018 {
1019 ProbeForWrite(otm, Size, 1);
1020 RtlCopyMemory(otm, potm, Size);
1021 }
1023 {
1025 }
1026 _SEH2_END
1027
1028 if (!NT_SUCCESS(Status))
1029 {
1031 Size = 0;
1032 }
1033
1035 return Size;
1036}
#define TRUE
Definition: types.h:120
BOOL FASTCALL TextIntUpdateSize(PDC dc, PTEXTOBJ TextObj, PFONTGDI FontGDI, BOOL bDoLock)
Definition: freetype.c:4417
INT FASTCALL IntGetOutlineTextMetrics(PFONTGDI FontGDI, UINT Size, OUTLINETEXTMETRICW *Otm, BOOL bLocked)
Definition: freetype.c:3264
FLONG flType
Definition: engobjects.h:142
#define FO_TYPE_TRUETYPE
Definition: winddi.h:737

◆ NtGdiGetRealizationInfo()

BOOL APIENTRY NtGdiGetRealizationInfo ( _In_ HDC  hdc,
_Out_ PREALIZATION_INFO  pri,
_In_ HFONT  hf 
)

Definition at line 1153 of file font.c.

1157{
1158 PDC pDc;
1159 PTEXTOBJ pTextObj;
1160 PFONTGDI pFontGdi;
1161 PDC_ATTR pdcattr;
1162 BOOL Ret = FALSE;
1163 INT i = 0;
1165
1166 pDc = DC_LockDc(hdc);
1167 if (!pDc)
1168 {
1170 return 0;
1171 }
1172 pdcattr = pDc->pdcattr;
1173 pTextObj = RealizeFontInit(pdcattr->hlfntNew);
1174 ASSERT(pTextObj != NULL);
1175 pFontGdi = ObjToGDI(pTextObj->Font, FONT);
1176 TEXTOBJ_UnlockText(pTextObj);
1177 DC_UnlockDc(pDc);
1178
1179 Ret = ftGdiRealizationInfo(pFontGdi, &ri);
1180 if (Ret)
1181 {
1182 if (pri)
1183 {
1185 _SEH2_TRY
1186 {
1187 ProbeForWrite(pri, sizeof(REALIZATION_INFO), 1);
1188 RtlCopyMemory(pri, &ri, sizeof(REALIZATION_INFO));
1189 }
1191 {
1193 }
1194 _SEH2_END
1195
1196 if(!NT_SUCCESS(Status))
1197 {
1199 return FALSE;
1200 }
1201 }
1202 do
1203 {
1204 if (GdiHandleTable->cfPublic[i].hf == hf)
1205 {
1206 GdiHandleTable->cfPublic[i].iTechnology = ri.iTechnology;
1207 GdiHandleTable->cfPublic[i].iUniq = ri.iUniq;
1208 GdiHandleTable->cfPublic[i].dwUnknown = ri.dwUnknown;
1209 GdiHandleTable->cfPublic[i].dwCFCount = GdiHandleTable->dwCFCount;
1210 GdiHandleTable->cfPublic[i].fl |= CFONT_REALIZATION;
1211 }
1212 i++;
1213 }
1214 while ( i < GDI_CFONT_MAX );
1215 }
1216 return Ret;
1217}
BOOL FASTCALL ftGdiRealizationInfo(PFONTGDI Font, PREALIZATION_INFO Info)
Definition: freetype.c:6562
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define GDI_CFONT_MAX
Definition: ntgdihdl.h:20
#define CFONT_REALIZATION
Definition: ntgdityp.h:430

Referenced by GdiRealizationInfo().

◆ NtGdiHfontCreate()

HFONT APIENTRY NtGdiHfontCreate ( _In_reads_bytes_(cjElfw) const ENUMLOGFONTEXDVW pelfw,
_In_ ULONG  cjElfw,
_In_ LFTYPE  lft,
_In_ FLONG  fl,
_In_opt_ PVOID  pvCliData 
)

Definition at line 1275 of file font.c.

1281{
1282 ENUMLOGFONTEXDVW SafeLogfont;
1284
1285 /* Silence GCC warnings */
1288
1289 if (!pelfw)
1290 {
1291 return NULL;
1292 }
1293
1294 _SEH2_TRY
1295 {
1296 ProbeForRead(pelfw, sizeof(ENUMLOGFONTEXDVW), 1);
1297 RtlCopyMemory(&SafeLogfont, pelfw, sizeof(ENUMLOGFONTEXDVW));
1298 }
1300 {
1302 }
1303 _SEH2_END
1304
1305 if (!NT_SUCCESS(Status))
1306 {
1307 return NULL;
1308 }
1309
1310 return HfontCreate(&SafeLogfont, cjElfw, lft, fl, pvCliData);
1311}

Referenced by CreateFontIndirectExA(), and CreateFontIndirectExW().

◆ NtGdiRemoveFontMemResourceEx()

BOOL APIENTRY NtGdiRemoveFontMemResourceEx ( _In_ HANDLE  hMMFont)

Definition at line 638 of file font.c.

640{
641 return IntGdiRemoveFontMemResource(hMMFont);
642}
BOOL FASTCALL IntGdiRemoveFontMemResource(HANDLE hMMFont)
Definition: freetype.c:2737

Referenced by RemoveFontMemResourceEx().

◆ NtGdiRemoveFontResourceW()

BOOL APIENTRY NtGdiRemoveFontResourceW ( _In_reads_(cwc) PCWCH  pwszFiles,
_In_ ULONG  cwc,
_In_ ULONG  cFiles,
_In_ ULONG  fl,
_In_ DWORD  dwPidTid,
_In_opt_ const DESIGNVECTOR pdv 
)

Definition at line 528 of file font.c.

535{
536 UNICODE_STRING SafeFileName;
537 BOOL Ret;
538
541
542 DPRINT("NtGdiRemoveFontResourceW\n");
543
544 /* cwc = Length + trailing zero. */
545 if ((cwc <= 1) || (cwc > UNICODE_STRING_MAX_CHARS))
546 return FALSE;
547
548 SafeFileName.Length = (USHORT)((cwc - 1) * sizeof(WCHAR));
549 SafeFileName.MaximumLength = SafeFileName.Length + sizeof(UNICODE_NULL);
551 SafeFileName.MaximumLength,
552 TAG_STRING);
553 if (!SafeFileName.Buffer)
554 return FALSE;
555
557 {
558 ProbeForRead(pwszFiles, cwc * sizeof(WCHAR), sizeof(WCHAR));
559
560 if (!IntCheckFontPathNames(pwszFiles, cFiles, cwc))
561 return FALSE;
562
563 RtlCopyMemory(SafeFileName.Buffer, pwszFiles, SafeFileName.Length);
564 }
566 {
567 ExFreePoolWithTag(SafeFileName.Buffer, TAG_STRING);
568 _SEH2_YIELD(return FALSE);
569 }
570 _SEH2_END;
571
572 SafeFileName.Buffer[SafeFileName.Length / sizeof(WCHAR)] = UNICODE_NULL;
573
574 Ret = IntGdiRemoveFontResource(&SafeFileName, cFiles, fl);
575
576 ExFreePoolWithTag(SafeFileName.Buffer, TAG_STRING);
577 return Ret;
578}
BOOL FASTCALL IntGdiRemoveFontResource(_In_ PCUNICODE_STRING FileName, _In_ DWORD cFiles, _In_ DWORD dwFlags)
Definition: freetype.c:2453

Referenced by RemoveFontResourceExW().

◆ RealizeFontInit()