- Don't use ntdll's RtlDuplicateUnicodeString in kmode; it allocates from the process...
authorJeffrey Morlan <mrnobo1024@yahoo.com>
Mon, 30 Jun 2008 23:58:48 +0000 (23:58 +0000)
committerJeffrey Morlan <mrnobo1024@yahoo.com>
Mon, 30 Jun 2008 23:58:48 +0000 (23:58 +0000)
- Get rid of other ntdll imports (memcmp in freetype, tan in win32k) and instead link the functions statically, so ntdll is no longer loaded at all in kmode. Saves about 550kB of memory.
- Also remove unused <library>hal</library> in freetype.

svn path=/trunk/; revision=34227

reactos/dll/3rdparty/freetype/freetype.rbuild
reactos/subsystems/win32/win32k/eng/objects.h
reactos/subsystems/win32/win32k/objects/text.c
reactos/subsystems/win32/win32k/win32k.rbuild

index c4b240e..5d6c44b 100644 (file)
@@ -14,8 +14,7 @@
                <define name="TT_CONFIG_OPTION_BYTECODE_INTERPRETER" />
        </if>
        <library>ntoskrnl</library>
-       <library>ntdll</library>
-       <library>hal</library>
+       <library>libcntpr</library>
        <directory name="i386">
                <file>setjmplongjmp.s</file>
        </directory>
index aea3005..37fec82 100644 (file)
@@ -70,7 +70,7 @@ typedef struct _FLOATGDI {
 typedef struct _FONTGDI {
   FONTOBJ FontObj;
 
-  LPCWSTR Filename;
+  LPWSTR Filename;
   FT_Face face;
   TEXTMETRICW TextMetric;
 } FONTGDI, *PFONTGDI;
index 9b6d30c..a5ba4e6 100644 (file)
@@ -279,7 +279,6 @@ IntGdiAddFontResource(PUNICODE_STRING FileName, DWORD Characteristics)
    PSECTION_OBJECT SectionObject;
    ULONG ViewSize = 0;
    FT_Fixed XScale, YScale;
-   UNICODE_STRING FileNameCopy;
 
    /* Open the font file */
 
@@ -355,8 +354,18 @@ IntGdiAddFontResource(PUNICODE_STRING FileName, DWORD Characteristics)
       return 0;
    }
 
-   RtlDuplicateUnicodeString(RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE, FileName, &FileNameCopy);
-   FontGDI->Filename = FileNameCopy.Buffer;
+   FontGDI->Filename = ExAllocatePool(PagedPool, FileName->Length + sizeof(WCHAR));
+   if (FontGDI->Filename == NULL)
+   {
+      EngFreeMem(FontGDI);
+      FT_Done_Face(Face);
+      ObDereferenceObject(SectionObject);
+      ExFreePool(Entry);
+      SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
+      return 0;      
+   }
+   memcpy(FontGDI->Filename, FileName->Buffer, FileName->Length);
+   FontGDI->Filename[FileName->Length / sizeof(WCHAR)] = L'\0';
    FontGDI->face = Face;
 
    /* FIXME: Complete text metrics */
index 7063b67..7d2ee8b 100644 (file)
        <library>win32k_base</library>
        <library>pseh</library>
        <library>ntoskrnl</library>
-       <library>ntdll</library>
+       <library>libcntpr</library>
        <library>hal</library>
        <library>freetype</library>
        <library>dxguid</library>