- Allocate memory from PagedPool instead of NonPagedPool where possible.
authorFilip Navara <filip.navara@gmail.com>
Sun, 20 Jun 2004 00:45:37 +0000 (00:45 +0000)
committerFilip Navara <filip.navara@gmail.com>
Sun, 20 Jun 2004 00:45:37 +0000 (00:45 +0000)
- Backported font initialization code with fixed memory leaks from my unfinished font handling rewrite patch.

svn path=/trunk/; revision=9734

19 files changed:
reactos/subsys/win32k/misc/driver.c
reactos/subsys/win32k/misc/object.c
reactos/subsys/win32k/ntuser/class.c
reactos/subsys/win32k/ntuser/clipboard.c
reactos/subsys/win32k/ntuser/misc.c
reactos/subsys/win32k/ntuser/window.c
reactos/subsys/win32k/ntuser/winpos.c
reactos/subsys/win32k/ntuser/winsta.c
reactos/subsys/win32k/objects/bezier.c
reactos/subsys/win32k/objects/bitmaps.c
reactos/subsys/win32k/objects/dc.c
reactos/subsys/win32k/objects/dib.c
reactos/subsys/win32k/objects/fillshap.c
reactos/subsys/win32k/objects/gdiobj.c
reactos/subsys/win32k/objects/line.c
reactos/subsys/win32k/objects/palette.c
reactos/subsys/win32k/objects/path.c
reactos/subsys/win32k/objects/print.c
reactos/subsys/win32k/objects/text.c

index 8821d90..e40d62d 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: driver.c,v 1.39 2004/04/09 20:39:10 navaraf Exp $
+/* $Id: driver.c,v 1.40 2004/06/20 00:45:36 navaraf Exp $
  * 
  * GDI Driver support routines
  * (mostly swiped from Wine)
@@ -52,7 +52,7 @@ static PGRAPHICS_DRIVER  GenericDriver = 0;
 
 BOOL DRIVER_RegisterDriver(LPCWSTR  Name, PGD_ENABLEDRIVER  EnableDriver)
 {
-  PGRAPHICS_DRIVER  Driver = ExAllocatePoolWithTag(NonPagedPool, sizeof(*Driver), TAG_DRIVER);
+  PGRAPHICS_DRIVER  Driver = ExAllocatePoolWithTag(PagedPool, sizeof(*Driver), TAG_DRIVER);
   DPRINT( "DRIVER_RegisterDriver( Name: %S )\n", Name );
   if (!Driver)  return  FALSE;
   Driver->ReferenceCount = 0;
index 7e52116..9105fb1 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: object.c,v 1.11 2004/02/26 22:23:54 weiden Exp $
+/* $Id: object.c,v 1.12 2004/06/20 00:45:36 navaraf Exp $
  *
  * COPYRIGHT:      See COPYING in the top level directory
  * PROJECT:        ReactOS kernel
@@ -325,7 +325,7 @@ ObmCreateObject(PUSER_HANDLE_TABLE HandleTable,
   PVOID ObjectBody;
   DWORD Status;
   
-  ObjectHeader = (PUSER_OBJECT_HEADER)ExAllocatePool(NonPagedPool, 
+  ObjectHeader = (PUSER_OBJECT_HEADER)ExAllocatePool(PagedPool, 
                                     ObjectSize + sizeof(USER_OBJECT_HEADER));
   if (!ObjectHeader)
     {
@@ -404,7 +404,7 @@ ObmCreateHandle(PUSER_HANDLE_TABLE HandleTable,
   /*
    * Add a new Handle block to the end of the list
    */
-  NewBlock = (PUSER_HANDLE_BLOCK)ExAllocatePool(NonPagedPool, 
+  NewBlock = (PUSER_HANDLE_BLOCK)ExAllocatePool(PagedPool, 
                                                sizeof(USER_HANDLE_BLOCK));
   if (!NewBlock)
     {
@@ -505,7 +505,7 @@ ObmCreateHandleTable(VOID)
 {
   PUSER_HANDLE_TABLE HandleTable;
 
-  HandleTable = (PUSER_HANDLE_TABLE)ExAllocatePool(NonPagedPool, 
+  HandleTable = (PUSER_HANDLE_TABLE)ExAllocatePool(PagedPool, 
                                                   sizeof(USER_HANDLE_TABLE));
   if (!HandleTable)
     {
index c38f3f6..6683da6 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: class.c,v 1.57 2004/05/27 11:47:42 weiden Exp $
+/* $Id: class.c,v 1.58 2004/06/20 00:45:36 navaraf Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -216,7 +216,7 @@ IntGetClassName(struct _WINDOW_OBJECT *WindowObject, LPWSTR lpClassName,
    Length = 0;
    Status = RtlQueryAtomInAtomTable(WinStaObject->AtomTable,
       WindowObject->Class->Atom, NULL, NULL, NULL, &Length);
-   Name = ExAllocatePoolWithTag(NonPagedPool, Length + sizeof(UNICODE_NULL), TAG_STRING);
+   Name = ExAllocatePoolWithTag(PagedPool, Length + sizeof(UNICODE_NULL), TAG_STRING);
    Status = RtlQueryAtomInAtomTable(WinStaObject->AtomTable,
       WindowObject->Class->Atom, NULL, NULL, Name, &Length);
    if (!NT_SUCCESS(Status))
index 2944d95..04176de 100644 (file)
@@ -165,7 +165,7 @@ NtUserGetClipboardFormatName(UINT format, PUNICODE_STRING FormatName,
   }
 
   /* Allocate memory for the string */
-  Buf = ExAllocatePoolWithTag(NonPagedPool, cchMaxCount * sizeof(WCHAR), TAG_STRING);
+  Buf = ExAllocatePoolWithTag(PagedPool, cchMaxCount * sizeof(WCHAR), TAG_STRING);
   if(!Buf)
   {
     SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
index 0e06f30..7bf91eb 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: misc.c,v 1.78 2004/06/16 06:09:40 gvg Exp $
+/* $Id: misc.c,v 1.79 2004/06/20 00:45:36 navaraf Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -1139,7 +1139,7 @@ IntSafeCopyUnicodeString(PUNICODE_STRING Dest,
   if(Dest->Length > 0 && Src)
   {
     Dest->MaximumLength = Dest->Length;
-    Dest->Buffer = ExAllocatePoolWithTag(NonPagedPool, Dest->MaximumLength, TAG_STRING);
+    Dest->Buffer = ExAllocatePoolWithTag(PagedPool, Dest->MaximumLength, TAG_STRING);
     if(!Dest->Buffer)
     {
       return STATUS_NO_MEMORY;
@@ -1185,7 +1185,7 @@ IntSafeCopyUnicodeStringTerminateNULL(PUNICODE_STRING Dest,
   if(Dest->Length > 0 && Src)
   {
     Dest->MaximumLength = Dest->Length + sizeof(WCHAR);
-    Dest->Buffer = ExAllocatePoolWithTag(NonPagedPool, Dest->MaximumLength, TAG_STRING);
+    Dest->Buffer = ExAllocatePoolWithTag(PagedPool, Dest->MaximumLength, TAG_STRING);
     if(!Dest->Buffer)
     {
       return STATUS_NO_MEMORY;
index b2e7b08..9ab8fbb 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: window.c,v 1.238 2004/06/19 20:18:09 navaraf Exp $
+/* $Id: window.c,v 1.239 2004/06/20 00:45:37 navaraf Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -2424,7 +2424,7 @@ NtUserFindWindowEx(HWND hwndParent,
     WCHAR *buf;
     /* safely copy the class name string (NULL terminated because class-lookup
        depends on it... */
-    buf = ExAllocatePoolWithTag(NonPagedPool, ClassName.Length + sizeof(WCHAR), TAG_STRING);
+    buf = ExAllocatePoolWithTag(PagedPool, ClassName.Length + sizeof(WCHAR), TAG_STRING);
     if(!buf)
     {
       SetLastWin32Error(STATUS_INSUFFICIENT_RESOURCES);
index b17a193..b43e935 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: winpos.c,v 1.116 2004/05/16 13:57:49 weiden Exp $
+/* $Id: winpos.c,v 1.117 2004/06/20 00:45:37 navaraf Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -188,7 +188,7 @@ WinPosInitInternalPos(PWINDOW_OBJECT WindowObject, POINT *pt, PRECT RestoreRect)
       else
         IntGetDesktopWorkArea(Desktop, &WorkArea);
       
-      WindowObject->InternalPos = ExAllocatePoolWithTag(NonPagedPool, sizeof(INTERNALPOS), TAG_WININTLIST);
+      WindowObject->InternalPos = ExAllocatePoolWithTag(PagedPool, sizeof(INTERNALPOS), TAG_WININTLIST);
       if(!WindowObject->InternalPos)
       {
         DPRINT1("Failed to allocate INTERNALPOS structure for window 0x%x\n", WindowObject->Self);
index ed330d0..0995a7c 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- *  $Id: winsta.c,v 1.63 2004/05/22 21:12:15 weiden Exp $
+ *  $Id: winsta.c,v 1.64 2004/06/20 00:45:37 navaraf Exp $
  *
  *  COPYRIGHT:        See COPYING in the top level directory
  *  PROJECT:          ReactOS kernel
@@ -106,7 +106,7 @@ IntGetFullWindowStationName(
       FullName->Length += WinStaName->Length + sizeof(WCHAR);
    if (DesktopName != NULL)
       FullName->Length += DesktopName->Length + sizeof(WCHAR);
-   FullName->Buffer = ExAllocatePoolWithTag(NonPagedPool, FullName->Length, TAG_STRING);
+   FullName->Buffer = ExAllocatePoolWithTag(PagedPool, FullName->Length, TAG_STRING);
    if (FullName->Buffer == NULL)
    {
       return FALSE;
index 6eecf94..c8dcfdc 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: bezier.c,v 1.8 2004/05/10 17:07:20 weiden Exp $ */
+/* $Id: bezier.c,v 1.9 2004/06/20 00:45:37 navaraf Exp $ */
 
 #include <w32k.h>
 
@@ -145,7 +145,7 @@ static void STDCALL GDI_InternalBezier( POINT *Points, POINT **PtsOut, INT *dwOu
 {
   if(*nPtsOut == *dwOut) {
     *dwOut *= 2;
-    *PtsOut = ExAllocatePoolWithTag(NonPagedPool, *dwOut * sizeof(POINT), TAG_BEZIER);
+    *PtsOut = ExAllocatePoolWithTag(PagedPool, *dwOut * sizeof(POINT), TAG_BEZIER);
   }
 
   if(!level || BezierCheck(level, Points)) {
@@ -209,7 +209,7 @@ POINT * FASTCALL GDI_Bezier( const POINT *Points, INT count, INT *nPtsOut )
     return NULL;
   }
   *nPtsOut = 0;
-  out = ExAllocatePoolWithTag(NonPagedPool, dwOut * sizeof(POINT), TAG_BEZIER);
+  out = ExAllocatePoolWithTag(PagedPool, dwOut * sizeof(POINT), TAG_BEZIER);
   for(Bezier = 0; Bezier < (count-1)/3; Bezier++) {
     POINT ptBuf[4];
     memcpy(ptBuf, Points + Bezier * 3, sizeof(POINT) * 4);
index 0afe6ef..b897f7d 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: bitmaps.c,v 1.73 2004/05/14 16:50:44 navaraf Exp $ */
+/* $Id: bitmaps.c,v 1.74 2004/06/20 00:45:37 navaraf Exp $ */
 #include <w32k.h>
 
 #define IN_RECT(r,x,y) \
@@ -1301,7 +1301,7 @@ BITMAPOBJ_CopyBitmap(HBITMAP  hBitmap)
        {
                char *buf;
 
-               buf = ExAllocatePoolWithTag (NonPagedPool, bm.bmWidthBytes * bm.bmHeight, TAG_BITMAP);
+               buf = ExAllocatePoolWithTag (PagedPool, bm.bmWidthBytes * bm.bmHeight, TAG_BITMAP);
                NtGdiGetBitmapBits (hBitmap, bm.bmWidthBytes * bm.bmHeight, buf);
                NtGdiSetBitmapBits (res, bm.bmWidthBytes * bm.bmHeight, buf);
                ExFreePool (buf);
index 9884f30..74dfc9c 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: dc.c,v 1.138 2004/06/18 15:18:56 navaraf Exp $
+/* $Id: dc.c,v 1.139 2004/06/20 00:45:37 navaraf Exp $
  *
  * DC.C - Device context functions
  *
@@ -1525,7 +1525,7 @@ NtGdiGetObject(HANDLE handle, INT count, LPVOID buffer)
     return 0;
   }
   
-  SafeBuf = ExAllocatePoolWithTag(NonPagedPool, count, TAG_GDIOBJ);
+  SafeBuf = ExAllocatePoolWithTag(PagedPool, count, TAG_GDIOBJ);
   if(!SafeBuf)
   {
     SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
index 3a0dbb9..b535517 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: dib.c,v 1.50 2004/05/30 14:01:13 weiden Exp $
+ * $Id: dib.c,v 1.51 2004/06/20 00:45:37 navaraf Exp $
  *
  * ReactOS W32 Subsystem
  * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
@@ -1093,7 +1093,7 @@ DIB_CreateDIBSection(
     bm.bmBits = EngAllocUserMem(totalSize, 0);
   }
 
-/*  bm.bmBits = ExAllocatePool(NonPagedPool, totalSize); */
+/*  bm.bmBits = ExAllocatePool(PagedPool, totalSize); */
 
   if(usage == DIB_PAL_COLORS)
     memcpy(bmi->bmiColors, (UINT *)DIB_MapPaletteColors(dc, bmi), sizeof(UINT *));
@@ -1165,7 +1165,7 @@ DIB_CreateDIBSection(
     if(bi->biBitCount == 4) { Entries = 16; } else
     if(bi->biBitCount == 8) { Entries = 256; }
 
-    bmp->ColorMap = ExAllocatePoolWithTag(NonPagedPool, sizeof(RGBQUAD)*Entries, TAG_COLORMAP);
+    bmp->ColorMap = ExAllocatePoolWithTag(PagedPool, sizeof(RGBQUAD)*Entries, TAG_COLORMAP);
     RtlCopyMemory(bmp->ColorMap, bmi->bmiColors, sizeof(RGBQUAD)*Entries);
   }
 
@@ -1343,7 +1343,7 @@ DIB_MapPaletteColors(PDC dc, CONST BITMAPINFO* lpbmi)
       nNumColors = min(nNumColors, lpbmi->bmiHeader.biClrUsed);
     }
 
-  lpRGB = (RGBQUAD *)ExAllocatePoolWithTag(NonPagedPool, sizeof(RGBQUAD) * nNumColors, TAG_COLORMAP);
+  lpRGB = (RGBQUAD *)ExAllocatePoolWithTag(PagedPool, sizeof(RGBQUAD) * nNumColors, TAG_COLORMAP);
   lpIndex = (USHORT *)&lpbmi->bmiColors[0];
 
   for (i = 0; i < nNumColors; i++)
@@ -1416,7 +1416,7 @@ BuildDIBPalette (PBITMAPINFO bmi, PINT paletteType)
 
   if (PAL_INDEXED == *paletteType)
     {
-      palEntries = ExAllocatePoolWithTag(NonPagedPool, sizeof(PALETTEENTRY)*ColorCount, TAG_COLORMAP);
+      palEntries = ExAllocatePoolWithTag(PagedPool, sizeof(PALETTEENTRY)*ColorCount, TAG_COLORMAP);
       DIBColorTableToPaletteEntries(palEntries, bmi->bmiColors, ColorCount);
     }
   hPal = PALETTE_AllocPalette( *paletteType, ColorCount, (ULONG*)palEntries, 0, 0, 0 );
index 9185a3e..fc64b19 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: fillshap.c,v 1.49 2004/05/14 16:55:18 navaraf Exp $ */
+/* $Id: fillshap.c,v 1.50 2004/06/20 00:45:37 navaraf Exp $ */
 #include <w32k.h>
 
 /*
@@ -835,7 +835,7 @@ NtGdiPolygon(HDC          hDC,
     SetLastWin32Error(ERROR_INVALID_HANDLE);
   else
   {
-    Safept = ExAllocatePoolWithTag(NonPagedPool, sizeof(POINT) * Count, TAG_SHAPE);
+    Safept = ExAllocatePoolWithTag(PagedPool, sizeof(POINT) * Count, TAG_SHAPE);
     if(!Safept)
       SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
     else
@@ -877,7 +877,7 @@ NtGdiPolyPolygon(HDC           hDC,
   
   if(Count > 0)
   {
-    Safept = ExAllocatePoolWithTag(NonPagedPool, (sizeof(POINT) + sizeof(INT)) * Count, TAG_SHAPE);
+    Safept = ExAllocatePoolWithTag(PagedPool, (sizeof(POINT) + sizeof(INT)) * Count, TAG_SHAPE);
     if(!Safept)
     {
       DC_UnlockDc(hDC);
index 71e0809..3d1c2fc 100644 (file)
@@ -19,7 +19,7 @@
 /*
  * GDIOBJ.C - GDI object manipulation routines
  *
- * $Id: gdiobj.c,v 1.67 2004/05/10 17:07:20 weiden Exp $
+ * $Id: gdiobj.c,v 1.68 2004/06/20 00:45:37 navaraf Exp $
  *
  */
 #include <w32k.h>
@@ -204,7 +204,7 @@ GDIOBJ_iAllocHandleTable (WORD Size)
 #endif
   handleTable->wTableSize = Size;
   handleTable->AllocationHint = 1;
-  handleTable->LookasideLists = ExAllocatePoolWithTag(NonPagedPool,
+  handleTable->LookasideLists = ExAllocatePoolWithTag(PagedPool,
                                                       OBJTYPE_COUNT * sizeof(PAGED_LOOKASIDE_LIST),
                                                       TAG_GDIHNDTBLE);
   if (NULL == handleTable->LookasideLists)
index f686413..4f2f5bb 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: line.c,v 1.32 2004/06/18 15:18:57 navaraf Exp $ */
+/* $Id: line.c,v 1.33 2004/06/20 00:45:37 navaraf Exp $ */
 #include <w32k.h>
 
 // Some code from the WINE project source (www.winehq.com)
@@ -163,7 +163,7 @@ IntGdiPolyBezierTo(DC      *dc,
   else /* We'll do it using PolyBezier */
   {
     POINT *npt;
-    npt = ExAllocatePoolWithTag(NonPagedPool, sizeof(POINT) * (Count + 1), TAG_BEZIER);
+    npt = ExAllocatePoolWithTag(PagedPool, sizeof(POINT) * (Count + 1), TAG_BEZIER);
     if ( npt )
     {
       npt[0].x = dc->w.CursPosX;
@@ -200,7 +200,7 @@ IntGdiPolyline(DC      *dc,
     return PATH_Polyline ( dc, pt, Count );
 
   //Allocate "Count" bytes of memory to hold a safe copy of pt
-  pts = (POINT*)ExAllocatePoolWithTag ( NonPagedPool, sizeof(POINT)*Count, TAG_SHAPE );
+  pts = (POINT*)ExAllocatePoolWithTag ( PagedPool, sizeof(POINT)*Count, TAG_SHAPE );
   if ( pts )
   {
     // safely copy pt to local version
@@ -250,7 +250,7 @@ IntGdiPolylineTo(DC      *dc,
   }
   else /* do it using Polyline */
   {
-    POINT *pts = ExAllocatePoolWithTag(NonPagedPool, sizeof(POINT) * (Count + 1), TAG_SHAPE);
+    POINT *pts = ExAllocatePoolWithTag(PagedPool, sizeof(POINT) * (Count + 1), TAG_SHAPE);
     if ( pts )
     {
       pts[0].x = dc->w.CursPosX;
@@ -521,7 +521,7 @@ NtGdiPolyBezier(HDC           hDC,
   
   if(Count > 0)
   {
-    Safept = ExAllocatePoolWithTag(NonPagedPool, sizeof(POINT) * Count, TAG_BEZIER);
+    Safept = ExAllocatePoolWithTag(PagedPool, sizeof(POINT) * Count, TAG_BEZIER);
     if(!Safept)
     {
       DC_UnlockDc(hDC);
@@ -572,7 +572,7 @@ NtGdiPolyBezierTo(HDC  hDC,
   
   if(Count > 0)
   {
-    Safept = ExAllocatePoolWithTag(NonPagedPool, sizeof(POINT) * Count, TAG_BEZIER);
+    Safept = ExAllocatePoolWithTag(PagedPool, sizeof(POINT) * Count, TAG_BEZIER);
     if(!Safept)
     {
       DC_UnlockDc(hDC);
@@ -633,7 +633,7 @@ NtGdiPolyline(HDC            hDC,
   
   if(Count >= 2)
   {
-    Safept = ExAllocatePoolWithTag(NonPagedPool, sizeof(POINT) * Count, TAG_SHAPE);
+    Safept = ExAllocatePoolWithTag(PagedPool, sizeof(POINT) * Count, TAG_SHAPE);
     if(!Safept)
     {
       DC_UnlockDc(hDC);
@@ -684,7 +684,7 @@ NtGdiPolylineTo(HDC            hDC,
   
   if(Count > 0)
   {
-    Safept = ExAllocatePoolWithTag(NonPagedPool, sizeof(POINT) * Count, TAG_SHAPE);
+    Safept = ExAllocatePoolWithTag(PagedPool, sizeof(POINT) * Count, TAG_SHAPE);
     if(!Safept)
     {
       DC_UnlockDc(hDC);
@@ -737,7 +737,7 @@ NtGdiPolyPolyline(HDC            hDC,
   
   if(Count > 0)
   {
-    Safept = ExAllocatePoolWithTag(NonPagedPool, (sizeof(POINT) + sizeof(DWORD)) * Count, TAG_SHAPE);
+    Safept = ExAllocatePoolWithTag(PagedPool, (sizeof(POINT) + sizeof(DWORD)) * Count, TAG_SHAPE);
     if(!Safept)
     {
       DC_UnlockDc(hDC);
index adb5410..c03b66a 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: palette.c,v 1.18 2004/05/10 17:07:20 weiden Exp $ */
+/* $Id: palette.c,v 1.19 2004/06/20 00:45:37 navaraf Exp $ */
 #include <w32k.h>
 
 #ifndef NO_MAPPING
@@ -72,7 +72,7 @@ PALETTE_AllocPalette(ULONG Mode,
 
   if (NULL != Colors)
     {
-      PalGDI->IndexedColors = ExAllocatePoolWithTag(NonPagedPool, sizeof(PALETTEENTRY) * NumColors, TAG_PALETTE);
+      PalGDI->IndexedColors = ExAllocatePoolWithTag(PagedPool, sizeof(PALETTEENTRY) * NumColors, TAG_PALETTE);
       if (NULL == PalGDI->IndexedColors)
        {
          PALETTE_UnlockPalette(NewPalette);
@@ -110,7 +110,7 @@ HPALETTE FASTCALL PALETTE_Init(VOID)
   const PALETTEENTRY* __sysPalTemplate = (const PALETTEENTRY*)COLOR_GetSystemPaletteTemplate();
 
   // create default palette (20 system colors)
-  palPtr = ExAllocatePoolWithTag(NonPagedPool, sizeof(LOGPALETTE) + (NB_RESERVED_COLORS * sizeof(PALETTEENTRY)), TAG_PALETTE);
+  palPtr = ExAllocatePoolWithTag(PagedPool, sizeof(LOGPALETTE) + (NB_RESERVED_COLORS * sizeof(PALETTEENTRY)), TAG_PALETTE);
   if (!palPtr) return FALSE;
 
   palPtr->palVersion = 0x300;
@@ -130,7 +130,7 @@ HPALETTE FASTCALL PALETTE_Init(VOID)
   palObj = (PALOBJ*)PALETTE_LockPalette(hpalette);
   if (palObj)
   {
-    if (!(palObj->mapping = ExAllocatePool(NonPagedPool, sizeof(int) * 20)))
+    if (!(palObj->mapping = ExAllocatePool(PagedPool, sizeof(int) * 20)))
     {
       DbgPrint("Win32k: Can not create palette mapping -- out of memory!");
       return FALSE;
@@ -199,7 +199,7 @@ INT STDCALL PALETTE_SetMapping(PALOBJ *palPtr, UINT uStart, UINT uNum, BOOL mapO
   //mapping = HeapReAlloc( GetProcessHeap(), 0, palPtr->mapping,
   //                       sizeof(int)*palPtr->logpalette->palNumEntries);
   ExFreePool(palPtr->mapping);
-  mapping = ExAllocatePoolWithTag(NonPagedPool, sizeof(int)*palGDI->NumColors, TAG_PALETTEMAP);
+  mapping = ExAllocatePoolWithTag(PagedPool, sizeof(int)*palGDI->NumColors, TAG_PALETTEMAP);
 
   palPtr->mapping = mapping;
 
index b9a261c..08390bf 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: path.c,v 1.21 2004/05/10 17:07:20 weiden Exp $ */
+/* $Id: path.c,v 1.22 2004/06/20 00:45:37 navaraf Exp $ */
 #include <w32k.h>
 #include <win32k/float.h>
 
@@ -852,7 +852,7 @@ PATH_PathToRegion ( const GdiPath *pPath, INT nPolyFillMode, HRGN *pHrgn )
       numStrokes++;
 
   /* Allocate memory for number-of-points-in-stroke array */
-  pNumPointsInStroke=(int *)ExAllocatePoolWithTag(NonPagedPool, sizeof(int) * numStrokes, TAG_PATH);
+  pNumPointsInStroke=(int *)ExAllocatePoolWithTag(PagedPool, sizeof(int) * numStrokes, TAG_PATH);
   if(!pNumPointsInStroke)
   {
 //    SetLastError(ERROR_NOT_ENOUGH_MEMORY);
@@ -975,10 +975,10 @@ PATH_ReserveEntries ( GdiPath *pPath, INT numEntries )
        numEntriesToAllocate=numEntries;
 
     /* Allocate new arrays */
-    pPointsNew=(POINT *)ExAllocatePoolWithTag(NonPagedPool, numEntriesToAllocate * sizeof(POINT), TAG_PATH);
+    pPointsNew=(POINT *)ExAllocatePoolWithTag(PagedPool, numEntriesToAllocate * sizeof(POINT), TAG_PATH);
     if(!pPointsNew)
       return FALSE;
-    pFlagsNew=(BYTE *)ExAllocatePoolWithTag(NonPagedPool, numEntriesToAllocate * sizeof(BYTE), TAG_PATH);
+    pFlagsNew=(BYTE *)ExAllocatePoolWithTag(PagedPool, numEntriesToAllocate * sizeof(BYTE), TAG_PATH);
     if(!pFlagsNew)
     {
       ExFreePool(pPointsNew);
index 65b565a..f5f9521 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: print.c,v 1.17 2004/05/10 17:07:20 weiden Exp $ */
+/* $Id: print.c,v 1.18 2004/06/20 00:45:37 navaraf Exp $ */
 #include <w32k.h>
 
 INT
@@ -123,7 +123,7 @@ NtGdiExtEscape(
 
    if ( InSize && UnsafeInData )
    {
-      SafeInData = ExAllocatePoolWithTag ( NonPagedPool, InSize, TAG_PRINT );
+      SafeInData = ExAllocatePoolWithTag ( PagedPool, InSize, TAG_PRINT );
       if ( !SafeInData )
       {
          DC_UnlockDc(hDC);
@@ -142,7 +142,7 @@ NtGdiExtEscape(
 
    if ( OutSize && UnsafeOutData )
    {
-      SafeOutData = ExAllocatePoolWithTag ( NonPagedPool, OutSize, TAG_PRINT );
+      SafeOutData = ExAllocatePoolWithTag ( PagedPool, OutSize, TAG_PRINT );
       if ( !SafeOutData )
       {
          if ( SafeInData )
index a41b7a3..bd5731d 100644 (file)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: text.c,v 1.96 2004/06/18 15:18:58 navaraf Exp $ */
+/* $Id: text.c,v 1.97 2004/06/20 00:45:37 navaraf Exp $ */
 #include <w32k.h>
 
 #include <ft2build.h>
@@ -44,7 +44,6 @@ static FAST_MUTEX FreeTypeLock;
 
 static LIST_ENTRY FontListHead;
 static FAST_MUTEX FontListLock;
-static INT FontsLoaded = 0; /* number of all fonts loaded (including private fonts */
 static BOOL RenderingEnabled = TRUE;
 
 static PWCHAR ElfScripts[32] = { /* these are in the order of the fsCsb[0] bits */
@@ -114,6 +113,301 @@ static CHARSETINFO FontTci[MAXTCIINDEX] = {
   { SYMBOL_CHARSET, CP_SYMBOL, FS(31)},
 };
 
+VOID FASTCALL
+IntLoadSystemFonts(VOID);
+
+INT FASTCALL
+IntGdiAddFontResource(PUNICODE_STRING FileName, DWORD Characteristics);
+
+BOOL FASTCALL
+InitFontSupport(VOID)
+{
+   ULONG ulError;
+
+   InitializeListHead(&FontListHead);
+   ExInitializeFastMutex(&FontListLock);
+   ExInitializeFastMutex(&FreeTypeLock);
+
+   ulError = FT_Init_FreeType(&library);
+   if (ulError)
+      return FALSE;
+
+   IntLoadSystemFonts();
+
+   return TRUE;
+}
+
+/*
+ * IntLoadSystemFonts
+ *
+ * Search the system font directory and adds each font found.
+ */
+
+VOID FASTCALL
+IntLoadSystemFonts(VOID)
+{
+   OBJECT_ATTRIBUTES ObjectAttributes;
+   UNICODE_STRING Directory, SearchPattern, FileName, TempString;
+   IO_STATUS_BLOCK Iosb;
+   HANDLE hDirectory;
+   BYTE *DirInfoBuffer;
+   PFILE_DIRECTORY_INFORMATION DirInfo;
+   BOOL bRestartScan = TRUE;
+   NTSTATUS Status;
+
+   RtlInitUnicodeString(&Directory, L"\\SystemRoot\\Media\\Fonts\\");
+   /* FIXME: Add support for other font types */
+   RtlInitUnicodeString(&SearchPattern, L"*.ttf");
+
+   InitializeObjectAttributes(
+      &ObjectAttributes,
+      &Directory,
+      OBJ_CASE_INSENSITIVE,
+      NULL,
+      NULL);
+
+   Status = ZwOpenFile(
+      &hDirectory,
+      SYNCHRONIZE | FILE_LIST_DIRECTORY,
+      &ObjectAttributes,
+      &Iosb,
+      FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
+      FILE_SYNCHRONOUS_IO_NONALERT | FILE_DIRECTORY_FILE);
+
+   if (NT_SUCCESS(Status))
+   {
+      DirInfoBuffer = ExAllocatePool(PagedPool, 0x4000);
+      if (DirInfoBuffer == NULL)
+      {
+         ZwClose(hDirectory);
+         return;
+      }
+      
+      FileName.Buffer = ExAllocatePool(PagedPool, MAX_PATH);
+      if (FileName.Buffer == NULL)
+      {
+         ExFreePool(DirInfoBuffer);
+         ZwClose(hDirectory);
+         return;
+      }
+      FileName.Length = 0;
+      FileName.MaximumLength = MAX_PATH;
+
+      while (1)
+      {
+         Status = ZwQueryDirectoryFile(
+            hDirectory,
+            NULL,
+            NULL,
+            NULL,
+            &Iosb,
+            DirInfoBuffer,
+            0x4000,
+            FileDirectoryInformation,
+            FALSE,
+            &SearchPattern,
+            bRestartScan);
+
+         if (!NT_SUCCESS(Status) || Status == STATUS_NO_MORE_FILES)
+         {
+            break;
+         }
+
+         for (DirInfo = (PFILE_DIRECTORY_INFORMATION)DirInfoBuffer;
+              DirInfo->NextEntryOffset != 0;
+              DirInfo = (PFILE_DIRECTORY_INFORMATION)((ULONG_PTR)DirInfo + DirInfo->NextEntryOffset))
+         {
+            TempString.Buffer = DirInfo->FileName;
+            TempString.Length =
+            TempString.MaximumLength = DirInfo->FileNameLength;
+            RtlCopyUnicodeString(&FileName, &Directory);
+            RtlAppendUnicodeStringToString(&FileName, &TempString);
+            IntGdiAddFontResource(&FileName, 0);
+         }
+
+         bRestartScan = FALSE;
+      }
+
+      ExFreePool(FileName.Buffer);
+      ExFreePool(DirInfoBuffer);
+      ZwClose(hDirectory);
+   }
+}
+
+/*
+ * IntGdiAddFontResource
+ *
+ * Adds the font resource from the specified file to the system.
+ */
+
+INT FASTCALL
+IntGdiAddFontResource(PUNICODE_STRING FileName, DWORD Characteristics)
+{
+   HFONT NewFont;
+   FONTOBJ *FontObj;
+   PFONTGDI FontGDI;
+   NTSTATUS Status;
+   HANDLE FileHandle;
+   OBJECT_ATTRIBUTES ObjectAttributes;
+   FILE_STANDARD_INFORMATION FileStdInfo;
+   PVOID Buffer;
+   IO_STATUS_BLOCK Iosb;
+   INT Error;
+   FT_Face Face;
+   ANSI_STRING AnsiFaceName;
+   PFONT_ENTRY Entry;
+
+   /* Create handle for the font */
+
+   NewFont = (HFONT)CreateGDIHandle(
+      sizeof(FONTGDI),
+      sizeof(FONTOBJ),
+      (PVOID*)&FontGDI,
+      (PVOID*)&FontObj);
+
+   if (NewFont == 0)
+   {
+      DPRINT("Could not allocate a new GDI font object\n");
+      return 0;
+   }
+
+   /* Open the font file */
+
+   InitializeObjectAttributes(&ObjectAttributes, FileName, 0, NULL, NULL);
+   Status = ZwOpenFile(
+      &FileHandle,
+      GENERIC_READ | SYNCHRONIZE,
+      &ObjectAttributes,
+      &Iosb,
+      0,
+      FILE_SYNCHRONOUS_IO_NONALERT);
+
+   if (!NT_SUCCESS(Status))
+   {
+      DPRINT("Could not font file: %wZ\n", Filename);
+      NtGdiDeleteObject(NewFont);
+      return 0;
+   }
+
+   /* Get the size of the file */
+
+   Status = NtQueryInformationFile(
+      FileHandle,
+      &Iosb,
+      &FileStdInfo,
+      sizeof(FileStdInfo),
+      FileStandardInformation);
+
+   if (!NT_SUCCESS(Status))
+   {
+      DPRINT("Could not get file size\n");
+      NtGdiDeleteObject(NewFont);
+      ZwClose(FileHandle);
+      return 0;
+   }
+
+   /* Allocate pageable memory for the font */
+
+   Buffer = ExAllocatePoolWithTag(
+      PagedPool,
+      FileStdInfo.EndOfFile.u.LowPart,
+      TAG_GDITEXT);
+
+   if (Buffer == NULL)
+   {
+      DPRINT("Could not allocate memory for font");
+      NtGdiDeleteObject(NewFont);
+      ZwClose(FileHandle);
+      return 0;
+   }
+
+   /* Load the font into memory chunk */
+
+   Status = ZwReadFile(
+      FileHandle,
+      NULL,
+      NULL,
+      NULL,
+      &Iosb,
+      Buffer,
+      FileStdInfo.EndOfFile.u.LowPart,
+      NULL,
+      NULL);
+
+   if (!NT_SUCCESS(Status))
+   {
+      DPRINT("Could not read the font file into memory");
+      ExFreePool(Buffer);
+      NtGdiDeleteObject(NewFont);
+      ZwClose(FileHandle);
+      return 0;
+   }
+
+   ZwClose(FileHandle);
+
+   IntLockFreeType;
+   Error = FT_New_Memory_Face(
+      library,
+      Buffer,
+      FileStdInfo.EndOfFile.u.LowPart,
+      0,
+      &Face);
+   IntUnLockFreeType;
+
+   if (Error)
+   {
+      if (Error == FT_Err_Unknown_File_Format)
+         DPRINT("Unknown font file format\n");
+      else
+         DPRINT("Error reading font file (error code: %u)\n", Error);
+      ExFreePool(Buffer);
+      NtGdiDeleteObject(NewFont);
+      return 0;
+   }
+
+   Entry = ExAllocatePoolWithTag(PagedPool, sizeof(FONT_ENTRY), TAG_FONT);
+   if (!Entry)
+   {
+      FT_Done_Face(Face);
+      ExFreePool(Buffer);
+      SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
+      return 0;
+   }
+
+   /* FontGDI->Filename = FileName; perform strcpy */
+   FontGDI->face = Face;
+
+   /* FIXME: Complete text metrics */
+   FontGDI->TextMetric.tmAscent = (Face->size->metrics.ascender + 32) >> 6; /* units above baseline */
+   FontGDI->TextMetric.tmDescent = (32 - Face->size->metrics.descender) >> 6; /* units below baseline */
+   FontGDI->TextMetric.tmHeight = FontGDI->TextMetric.tmAscent + FontGDI->TextMetric.tmDescent;
+
+   DPRINT("Font loaded: %s (%s)\n", face->family_name, face->style_name);
+   DPRINT("Num glyphs: %u\n", face->num_glyphs);
+
+   /* Add this font resource to the font table */
+
+   Entry->hFont = NewFont;
+   Entry->NotEnum = (Characteristics & FR_NOT_ENUM);
+   RtlInitAnsiString(&AnsiFaceName, (LPSTR)Face->family_name);
+   RtlAnsiStringToUnicodeString(&Entry->FaceName, &AnsiFaceName, TRUE);
+
+   if (Characteristics & FR_PRIVATE)
+   {
+      PW32PROCESS Win32Process = PsGetWin32Process();
+      IntLockProcessPrivateFonts(Win32Process);
+      InsertTailList(&Win32Process->PrivateFontListHead, &Entry->ListEntry);
+      IntUnLockProcessPrivateFonts(Win32Process);
+   }
+   else
+   {
+      IntLockGlobalFonts;
+      InsertTailList(&FontListHead, &Entry->ListEntry);
+      IntUnLockGlobalFonts;
+   }
+
+   return 1;
+}
 
 BOOL FASTCALL
 IntIsFontRenderingEnabled(VOID)
@@ -159,246 +453,6 @@ IntGetFontRenderMode(LOGFONTW *logfont)
   }
   return FT_RENDER_MODE_MONO;
 }
-
-int FASTCALL
-IntGdiAddFontResource(PUNICODE_STRING Filename, DWORD fl)
-{
-  HFONT NewFont;
-  FONTOBJ *FontObj;
-  PFONTGDI FontGDI;
-  NTSTATUS Status;
-  HANDLE FileHandle;
-  OBJECT_ATTRIBUTES ObjectAttributes;
-  FILE_STANDARD_INFORMATION FileStdInfo;
-  PVOID buffer;
-  ULONG size;
-  INT error;
-  FT_Face face;
-  ANSI_STRING StringA;
-  IO_STATUS_BLOCK Iosb;
-  PFONT_ENTRY entry;
-
-  NewFont = (HFONT)CreateGDIHandle(sizeof( FONTGDI ), sizeof( FONTOBJ ), (PVOID*)&FontGDI, (PVOID*)&FontObj);
-  if(NewFont == 0)
-  {
-    DPRINT1("Could not allocate a new GDI font object\n");
-    return 0;
-  }
-
-  //  Open the Module
-  InitializeObjectAttributes(&ObjectAttributes, Filename, 0, NULL, NULL);
-
-  Status = ZwOpenFile(&FileHandle, 
-                      GENERIC_READ|SYNCHRONIZE, 
-                      &ObjectAttributes, 
-                      &Iosb, 
-                      0, //ShareAccess
-                      FILE_SYNCHRONOUS_IO_NONALERT);
-
-  if (!NT_SUCCESS(Status))
-  {
-    DPRINT1("Could not open module file: %wZ\n", Filename);
-    return 0;
-  }
-
-  //  Get the size of the file
-  Status = NtQueryInformationFile(FileHandle, &Iosb, &FileStdInfo, sizeof(FileStdInfo), FileStandardInformation);
-  if (!NT_SUCCESS(Status))
-  {
-    DPRINT1("Could not get file size\n");
-    return 0;
-  }
-
-  //  Allocate nonpageable memory for driver
-  size = FileStdInfo.EndOfFile.u.LowPart;
-  buffer = ExAllocatePoolWithTag(NonPagedPool, size, TAG_GDITEXT);
-
-  if (buffer == NULL)
-  {
-    DPRINT1("could not allocate memory for module");
-    return 0;
-  }
-
-  //  Load driver into memory chunk
-  Status = ZwReadFile(FileHandle, 
-                      NULL, 
-                      NULL, 
-                      NULL, 
-                      &Iosb, 
-                      buffer, 
-                      FileStdInfo.EndOfFile.u.LowPart, 
-                      NULL, 
-                      NULL);
-                      
-  if (!NT_SUCCESS(Status))
-  {
-    DPRINT1("could not read module file into memory");
-    ExFreePool(buffer);
-    return 0;
-  }
-
-  ZwClose(FileHandle);
-
-  IntLockFreeType;
-  error = FT_New_Memory_Face(library, buffer, size, 0, &face);
-  IntUnLockFreeType;
-  if (error == FT_Err_Unknown_File_Format)
-  {
-    DPRINT1("Unknown font file format\n");
-    return 0;
-  }
-  else if (error)
-  {
-    DPRINT1("Error reading font file (error code: %u)\n", error); // 48
-    return 0;
-  }
-  
-  entry = ExAllocatePoolWithTag(NonPagedPool, sizeof(FONT_ENTRY), TAG_FONT);
-  if(!entry)
-  {
-    SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
-    return 0;
-  }
-
-  // FontGDI->Filename = Filename; perform strcpy
-  FontGDI->face = face;
-
-  // FIXME: Complete text metrics
-  FontGDI->TextMetric.tmAscent = (face->size->metrics.ascender + 32) >> 6; // units above baseline
-  FontGDI->TextMetric.tmDescent = (32 - face->size->metrics.descender) >> 6; // units below baseline
-  FontGDI->TextMetric.tmHeight = FontGDI->TextMetric.tmAscent + FontGDI->TextMetric.tmDescent;
-
-  DPRINT("Font loaded: %s (%s)\n", face->family_name, face->style_name);
-  DPRINT("Num glyphs: %u\n", face->num_glyphs);
-
-  // Add this font resource to the font table
-  entry->hFont = NewFont;
-  entry->NotEnum = (fl & FR_NOT_ENUM);
-  RtlInitAnsiString(&StringA, (LPSTR)face->family_name);
-  RtlAnsiStringToUnicodeString(&entry->FaceName, &StringA, TRUE);
-  
-  if(fl & FR_PRIVATE)
-  {
-    PW32PROCESS Win32Process = PsGetWin32Process();
-    
-    IntLockProcessPrivateFonts(Win32Process);
-    InsertTailList(&Win32Process->PrivateFontListHead, &entry->ListEntry);
-    FontsLoaded++;
-    IntUnLockProcessPrivateFonts(Win32Process);
-  }
-  else
-  {
-    IntLockGlobalFonts;
-    InsertTailList(&FontListHead, &entry->ListEntry);
-    FontsLoaded++;
-    IntUnLockGlobalFonts;
-  }
-
-  return 1;
-}
-
-BOOL FASTCALL InitFontSupport(VOID)
-{
-       ULONG ulError;
-       UNICODE_STRING cchDir, cchFilename, cchSearchPattern ;
-       OBJECT_ATTRIBUTES obAttr;
-       IO_STATUS_BLOCK Iosb;
-       HANDLE hDirectory;
-       NTSTATUS Status;
-       PFILE_DIRECTORY_INFORMATION iFileData;
-       PVOID   pBuff;
-       BOOLEAN bRestartScan = TRUE;
-    BOOLEAN Result = FALSE;
-       
-       InitializeListHead(&FontListHead);
-    ExInitializeFastMutex(&FontListLock);
-    ExInitializeFastMutex(&FreeTypeLock);
-       
-    ulError = FT_Init_FreeType(&library);
-    
-    if(!ulError)
-    {
-        RtlInitUnicodeString(&cchDir, L"\\SystemRoot\\Media\\Fonts\\");
-
-               RtlInitUnicodeString(&cchSearchPattern,L"*.ttf");
-        InitializeObjectAttributes( &obAttr,
-                                                               &cchDir,
-                                                               OBJ_CASE_INSENSITIVE, 
-                                                               NULL,
-                                                               NULL );
-                                                                       
-        Status = ZwOpenFile( &hDirectory,
-                             SYNCHRONIZE | FILE_LIST_DIRECTORY,
-                             &obAttr,
-                             &Iosb,
-                             FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
-                             FILE_SYNCHRONOUS_IO_NONALERT | FILE_DIRECTORY_FILE );         
-        if( NT_SUCCESS(Status) )
-        {          
-            while(1)
-            {   
-               if (bRestartScan)
-                 {
-                pBuff = ExAllocatePool(NonPagedPool,0x4000);
-                   if (pBuff == NULL)
-                     {
-                       break;
-                     }
-                RtlInitUnicodeString(&cchFilename,0);
-                cchFilename.MaximumLength = 0x1000;
-                cchFilename.Buffer = ExAllocatePoolWithTag(PagedPool,cchFilename.MaximumLength, TAG_STRING);
-                   if (cchFilename.Buffer == NULL)
-                     {
-                       ExFreePool(pBuff);
-                       break;
-                     }
-                 }
-                                   
-                               Status = NtQueryDirectoryFile( hDirectory,
-                                                              NULL,
-                                                              NULL,
-                                                              NULL,
-                                                              &Iosb,
-                                                              pBuff,
-                                                              0x4000,
-                                                              FileDirectoryInformation,
-                                              FALSE,
-                                                              &cchSearchPattern,
-                                                              bRestartScan );
-                                  
-                               if( !NT_SUCCESS(Status) || Status == STATUS_NO_MORE_FILES )
-                 {
-                               ExFreePool(pBuff);
-                               ExFreePool(cchFilename.Buffer);
-                   break;
-                 }
-                               bRestartScan = FALSE;
-                iFileData = (PFILE_DIRECTORY_INFORMATION)pBuff;
-               while(1)
-                 {
-                   UNICODE_STRING tmpString;
-                   tmpString.Buffer = iFileData->FileName;
-                   tmpString.Length = tmpString.MaximumLength = iFileData->FileNameLength;
-                    RtlCopyUnicodeString(&cchFilename, &cchDir);
-                    RtlAppendUnicodeStringToString(&cchFilename, &tmpString);
-                   cchFilename.Buffer[cchFilename.Length / sizeof(WCHAR)] = 0;
-                   if (0 != IntGdiAddFontResource(&cchFilename, 0))
-                     {
-                       Result = TRUE;
-                     }
-                   if (iFileData->NextEntryOffset == 0)
-                     {
-                       break;
-                     }
-                   iFileData = (PVOID)iFileData + iFileData->NextEntryOffset;
-                 }
-                       }
-        }
-    }
-    ZwClose(hDirectory);
-    return Result;
-}
-
 static NTSTATUS STDCALL
 GetFontObjectsFromTextObj(PTEXTOBJ TextObj, HFONT *FontHandle, FONTOBJ **FontObj, PFONTGDI *FontGDI)
 {