- Separate NtGdiHfontCreate to allow calling it direct without SEH.

svn path=/trunk/; revision=60389
This commit is contained in:
James Tabor 2013-09-26 23:59:19 +00:00
parent bbf5eb22bd
commit 4490e12ecd

View file

@ -1003,6 +1003,61 @@ NtGdiGetRealizationInfo(
return Ret; return Ret;
} }
HFONT
APIENTRY
HfontCreate(
IN PENUMLOGFONTEXDVW pelfw,
IN ULONG cjElfw,
IN LFTYPE lft,
IN FLONG fl,
IN PVOID pvCliData )
{
HFONT hNewFont;
PLFONT plfont;
if (!pelfw)
{
return NULL;
}
plfont = LFONT_AllocFontWithHandle();
if (!plfont)
{
return NULL;
}
hNewFont = plfont->BaseObject.hHmgr;
plfont->lft = lft;
plfont->fl = fl;
RtlCopyMemory (&plfont->logfont, pelfw, sizeof(ENUMLOGFONTEXDVW));
ExInitializePushLock(&plfont->lock);
if (pelfw->elfEnumLogfontEx.elfLogFont.lfEscapement !=
pelfw->elfEnumLogfontEx.elfLogFont.lfOrientation)
{
/* This should really depend on whether GM_ADVANCED is set */
plfont->logfont.elfEnumLogfontEx.elfLogFont.lfOrientation =
plfont->logfont.elfEnumLogfontEx.elfLogFont.lfEscapement;
}
LFONT_UnlockFont(plfont);
if (pvCliData && hNewFont)
{
// FIXME: Use GDIOBJ_InsertUserData
KeEnterCriticalRegion();
{
INT Index = GDI_HANDLE_GET_INDEX((HGDIOBJ)hNewFont);
PGDI_TABLE_ENTRY Entry = &GdiHandleTable->Entries[Index];
Entry->UserData = pvCliData;
}
KeLeaveCriticalRegion();
}
return hNewFont;
}
HFONT HFONT
APIENTRY APIENTRY
NtGdiHfontCreate( NtGdiHfontCreate(
@ -1013,8 +1068,6 @@ NtGdiHfontCreate(
IN PVOID pvCliData ) IN PVOID pvCliData )
{ {
ENUMLOGFONTEXDVW SafeLogfont; ENUMLOGFONTEXDVW SafeLogfont;
HFONT hNewFont;
PLFONT plfont;
NTSTATUS Status = STATUS_SUCCESS; NTSTATUS Status = STATUS_SUCCESS;
/* Silence GCC warnings */ /* Silence GCC warnings */
@ -1042,40 +1095,7 @@ NtGdiHfontCreate(
return NULL; return NULL;
} }
plfont = LFONT_AllocFontWithHandle(); return HfontCreate(&SafeLogfont, cjElfw, lft, fl, pvCliData);
if (!plfont)
{
return NULL;
}
hNewFont = plfont->BaseObject.hHmgr;
plfont->lft = lft;
plfont->fl = fl;
RtlCopyMemory (&plfont->logfont, &SafeLogfont, sizeof(ENUMLOGFONTEXDVW));
ExInitializePushLock(&plfont->lock);
if (SafeLogfont.elfEnumLogfontEx.elfLogFont.lfEscapement !=
SafeLogfont.elfEnumLogfontEx.elfLogFont.lfOrientation)
{
/* This should really depend on whether GM_ADVANCED is set */
plfont->logfont.elfEnumLogfontEx.elfLogFont.lfOrientation =
plfont->logfont.elfEnumLogfontEx.elfLogFont.lfEscapement;
}
LFONT_UnlockFont(plfont);
if (pvCliData && hNewFont)
{
// FIXME: Use GDIOBJ_InsertUserData
KeEnterCriticalRegion();
{
INT Index = GDI_HANDLE_GET_INDEX((HGDIOBJ)hNewFont);
PGDI_TABLE_ENTRY Entry = &GdiHandleTable->Entries[Index];
Entry->UserData = pvCliData;
}
KeLeaveCriticalRegion();
}
return hNewFont;
} }