Author: tkreuzer
Date: Sat Oct 6 12:16:06 2012
New Revision: 57494
URL:
http://svn.reactos.org/svn/reactos?rev=57494&view=rev
Log:
[WIN23K]
- Make LFONTs (for some incomprehensible reason called TEXTOBJ in ros) shared objects, as
they are supposed to be. Since that conflicts with our totally broken font code that
happily messes with the LFONT's contents, an additional push lock is aquired to get
exclusive ownership.
Modified:
trunk/reactos/win32ss/gdi/ntgdi/font.c
trunk/reactos/win32ss/gdi/ntgdi/freetype.c
trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c
trunk/reactos/win32ss/gdi/ntgdi/text.h
Modified: trunk/reactos/win32ss/gdi/ntgdi/font.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/font.c?r…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/font.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/font.c [iso-8859-1] Sat Oct 6 12:16:06 2012
@@ -1056,7 +1056,7 @@
{
ENUMLOGFONTEXDVW SafeLogfont;
HFONT hNewFont;
- PTEXTOBJ TextObj;
+ PLFONT plfont;
NTSTATUS Status = STATUS_SUCCESS;
/* Silence GCC warnings */
@@ -1084,25 +1084,26 @@
return NULL;
}
- TextObj = TEXTOBJ_AllocTextWithHandle();
- if (!TextObj)
+ plfont = LFONT_AllocFontWithHandle();
+ if (!plfont)
{
return NULL;
}
- hNewFont = TextObj->BaseObject.hHmgr;
-
- TextObj->lft = lft;
- TextObj->fl = fl;
- RtlCopyMemory (&TextObj->logfont, &SafeLogfont, sizeof(ENUMLOGFONTEXDVW));
+ 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 */
- TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfOrientation =
- TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfEscapement;
- }
- TEXTOBJ_UnlockText(TextObj);
+ plfont->logfont.elfEnumLogfontEx.elfLogFont.lfOrientation =
+ plfont->logfont.elfEnumLogfontEx.elfLogFont.lfEscapement;
+ }
+ LFONT_UnlockFont(plfont);
if (pvCliData && hNewFont)
{
Modified: trunk/reactos/win32ss/gdi/ntgdi/freetype.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/freetype…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/freetype.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/freetype.c [iso-8859-1] Sat Oct 6 12:16:06 2012
@@ -447,23 +447,24 @@
NTSTATUS FASTCALL
TextIntCreateFontIndirect(CONST LPLOGFONTW lf, HFONT *NewFont)
{
- PTEXTOBJ TextObj;
-
- TextObj = TEXTOBJ_AllocTextWithHandle();
- if (!TextObj)
+ PLFONT plfont;
+
+ plfont = LFONT_AllocFontWithHandle();
+ if (!plfont)
{
return STATUS_NO_MEMORY;
}
- *NewFont = TextObj->BaseObject.hHmgr;
- RtlCopyMemory(&TextObj->logfont.elfEnumLogfontEx.elfLogFont, lf,
sizeof(LOGFONTW));
+ ExInitializePushLock(&plfont->lock);
+ *NewFont = plfont->BaseObject.hHmgr;
+ RtlCopyMemory(&plfont->logfont.elfEnumLogfontEx.elfLogFont, lf,
sizeof(LOGFONTW));
if (lf->lfEscapement != lf->lfOrientation)
{
/* This should really depend on whether GM_ADVANCED is set */
- TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfOrientation =
- TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfEscapement;
- }
- TEXTOBJ_UnlockText(TextObj);
+ plfont->logfont.elfEnumLogfontEx.elfLogFont.lfOrientation =
+ plfont->logfont.elfEnumLogfontEx.elfLogFont.lfEscapement;
+ }
+ LFONT_UnlockFont(plfont);
return STATUS_SUCCESS;
}
Modified: trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c [iso-8859-1] Sat Oct 6 12:16:06 2012
@@ -51,8 +51,7 @@
(objt) == GDIObjType_BRUSH_TYPE)
#define ASSERT_EXCLUSIVE_OBJECT_TYPE(objt) \
ASSERT((objt) == GDIObjType_DC_TYPE || \
- (objt) == GDIObjType_RGN_TYPE || \
- (objt) == GDIObjType_LFONT_TYPE)
+ (objt) == GDIObjType_RGN_TYPE)
#else
#define DBG_INCREASE_LOCK_COUNT(ppi, hobj)
#define DBG_DECREASE_LOCK_COUNT(x, y)
Modified: trunk/reactos/win32ss/gdi/ntgdi/text.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/text.h?r…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/text.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/text.h [iso-8859-1] Sat Oct 6 12:16:06 2012
@@ -56,7 +56,7 @@
#define TEXTOBJECT_INIT 0x00010000
/* GDI logical font object */
-typedef struct
+typedef struct _LFONT
{
/* Header for all gdi objects in the handle table.
Do not (re)move this. */
@@ -70,16 +70,33 @@
DWORD dwOffsetEndArray;
// Fixed:
ENUMLOGFONTEXDVW logfont;
-} TEXTOBJ, *PTEXTOBJ;
+ EX_PUSH_LOCK lock;
+} TEXTOBJ, *PTEXTOBJ, LFONT, *PLFONT;
/* Internal interface */
-#define TEXTOBJ_AllocText() ((PTEXTOBJ) GDIOBJ_AllocObj(GDIObjType_LFONT_TYPE))
-#define TEXTOBJ_AllocTextWithHandle() ((PTEXTOBJ)
GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_FONT, sizeof(TEXTOBJ)))
-#define TEXTOBJ_FreeText(pBMObj) GDIOBJ_FreeObj((POBJ) pBMObj,
GDILoObjType_LO_FONT_TYPE)
-#define TEXTOBJ_FreeTextByHandle(hBMObj) GDIOBJ_FreeObj((HGDIOBJ) hBMObj,
GDI_OBJECT_TYPE_FONT)
-#define TEXTOBJ_LockText(hBMObj) ((PTEXTOBJ) GDIOBJ_LockObject((HGDIOBJ) hBMObj,
GDIObjType_LFONT_TYPE))
-#define TEXTOBJ_UnlockText(pBMObj) GDIOBJ_vUnlockObject ((POBJ)pBMObj)
+#define LFONT_AllocFontWithHandle()
((PLFONT)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_FONT, sizeof(TEXTOBJ)))
+#define LFONT_ShareLockFont(hfont) (PLFONT)GDIOBJ_ReferenceObjectByHandle(hfont,
GDIObjType_LFONT_TYPE)
+#define LFONT_ShareUnlockFont(plfnt) GDIOBJ_vDereferenceObject((POBJ)plfnt)
+#define LFONT_UnlockFont(plfnt) GDIOBJ_vUnlockObject((POBJ)plfnt)
+
+PTEXTOBJ
+FORCEINLINE
+TEXTOBJ_LockText(HFONT hfont)
+{
+ PLFONT plfnt = LFONT_ShareLockFont(hfont);
+ ExAcquirePushLockExclusive(&plfnt->lock);
+ return plfnt;
+}
+
+VOID
+FORCEINLINE
+TEXTOBJ_UnlockText(PLFONT plfnt)
+{
+ ExReleasePushLockExclusive(&plfnt->lock);
+ LFONT_ShareUnlockFont(plfnt);
+}
+
PTEXTOBJ FASTCALL RealizeFontInit(HFONT);
NTSTATUS FASTCALL TextIntRealizeFont(HFONT,PTEXTOBJ);