- Separate NtGdiHfontCreate to allow calling it direct without SEH.
authorJames Tabor <james.tabor@reactos.org>
Thu, 26 Sep 2013 23:59:19 +0000 (23:59 +0000)
committerJames Tabor <james.tabor@reactos.org>
Thu, 26 Sep 2013 23:59:19 +0000 (23:59 +0000)
svn path=/trunk/; revision=60389

reactos/win32ss/gdi/ntgdi/font.c

index 10bd73b..74dd207 100644 (file)
@@ -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 */