From: James Tabor Date: Thu, 26 Sep 2013 23:59:19 +0000 (+0000) Subject: - Separate NtGdiHfontCreate to allow calling it direct without SEH. X-Git-Tag: ReactOS-0.3.16~1161 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=4490e12ecdbf7d4f248a550f2712e8a70d5205d2 - Separate NtGdiHfontCreate to allow calling it direct without SEH. svn path=/trunk/; revision=60389 --- diff --git a/reactos/win32ss/gdi/ntgdi/font.c b/reactos/win32ss/gdi/ntgdi/font.c index 10bd73b1a8e..74dd207eb4b 100644 --- a/reactos/win32ss/gdi/ntgdi/font.c +++ b/reactos/win32ss/gdi/ntgdi/font.c @@ -1003,45 +1003,24 @@ NtGdiGetRealizationInfo( return Ret; } + HFONT APIENTRY -NtGdiHfontCreate( +HfontCreate( IN PENUMLOGFONTEXDVW pelfw, IN ULONG cjElfw, IN LFTYPE lft, IN FLONG fl, IN PVOID pvCliData ) { - ENUMLOGFONTEXDVW SafeLogfont; HFONT hNewFont; PLFONT plfont; - NTSTATUS Status = STATUS_SUCCESS; - - /* Silence GCC warnings */ - SafeLogfont.elfEnumLogfontEx.elfLogFont.lfEscapement = 0; - SafeLogfont.elfEnumLogfontEx.elfLogFont.lfOrientation = 0; if (!pelfw) { return NULL; } - _SEH2_TRY - { - ProbeForRead(pelfw, sizeof(ENUMLOGFONTEXDVW), 1); - RtlCopyMemory(&SafeLogfont, pelfw, sizeof(ENUMLOGFONTEXDVW)); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Status = _SEH2_GetExceptionCode(); - } - _SEH2_END - - if (!NT_SUCCESS(Status)) - { - return NULL; - } - plfont = LFONT_AllocFontWithHandle(); if (!plfont) { @@ -1051,11 +1030,11 @@ NtGdiHfontCreate( plfont->lft = lft; plfont->fl = fl; - RtlCopyMemory (&plfont->logfont, &SafeLogfont, sizeof(ENUMLOGFONTEXDVW)); + RtlCopyMemory (&plfont->logfont, pelfw, sizeof(ENUMLOGFONTEXDVW)); ExInitializePushLock(&plfont->lock); - if (SafeLogfont.elfEnumLogfontEx.elfLogFont.lfEscapement != - SafeLogfont.elfEnumLogfontEx.elfLogFont.lfOrientation) + if (pelfw->elfEnumLogfontEx.elfLogFont.lfEscapement != + pelfw->elfEnumLogfontEx.elfLogFont.lfOrientation) { /* This should really depend on whether GM_ADVANCED is set */ plfont->logfont.elfEnumLogfontEx.elfLogFont.lfOrientation = @@ -1079,4 +1058,45 @@ NtGdiHfontCreate( } +HFONT +APIENTRY +NtGdiHfontCreate( + IN PENUMLOGFONTEXDVW pelfw, + IN ULONG cjElfw, + IN LFTYPE lft, + IN FLONG fl, + IN PVOID pvCliData ) +{ + ENUMLOGFONTEXDVW SafeLogfont; + NTSTATUS Status = STATUS_SUCCESS; + + /* Silence GCC warnings */ + SafeLogfont.elfEnumLogfontEx.elfLogFont.lfEscapement = 0; + SafeLogfont.elfEnumLogfontEx.elfLogFont.lfOrientation = 0; + + if (!pelfw) + { + return NULL; + } + + _SEH2_TRY + { + ProbeForRead(pelfw, sizeof(ENUMLOGFONTEXDVW), 1); + RtlCopyMemory(&SafeLogfont, pelfw, sizeof(ENUMLOGFONTEXDVW)); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END + + if (!NT_SUCCESS(Status)) + { + return NULL; + } + + return HfontCreate(&SafeLogfont, cjElfw, lft, fl, pvCliData); +} + + /* EOF */