Author: tkreuzer
Date: Thu May 26 14:15:11 2011
New Revision: 51923
URL:
http://svn.reactos.org/svn/reactos?rev=51923&view=rev
Log:
[WIN32K]
- add better support for font files in EngLoadModuleEx (save name information)
- Fix compilation with MSVC
- Fix a memory leak when unloading drivers
Added:
branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/include/mapping.h (with
props)
Modified:
branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/dib/stretchblt.c
branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/eng/mapping.c
branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/eng/pdevobj.c
branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/include/eng.h
branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/include/win32kp.h
Modified: branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/dib/stretchblt.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/subsyst…
==============================================================================
--- branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/dib/stretchblt.c [iso-8859-1]
(original)
+++ branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/dib/stretchblt.c [iso-8859-1]
Thu May 26 14:15:11 2011
@@ -34,6 +34,7 @@
ULONG Dest, Source = 0, Pattern = 0;
ULONG xxBPPMask;
BOOLEAN CanDraw;
+ BOOL UsesSource, UsesPattern;
PFN_DIB_GetPixel fnSource_GetPixel = NULL;
PFN_DIB_GetPixel fnDest_GetPixel = NULL;
@@ -45,8 +46,8 @@
ASSERT(IS_VALID_ROP4(ROP));
- BOOL UsesSource = ROP4_USES_SOURCE(ROP);
- BOOL UsesPattern = ROP4_USES_PATTERN(ROP);
+ UsesSource = ROP4_USES_SOURCE(ROP);
+ UsesPattern = ROP4_USES_PATTERN(ROP);
fnDest_GetPixel =
DibFunctionsForBitmapFormat[DestSurf->iBitmapFormat].DIB_GetPixel;
fnDest_PutPixel =
DibFunctionsForBitmapFormat[DestSurf->iBitmapFormat].DIB_PutPixel;
Modified: branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/eng/mapping.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/subsyst…
==============================================================================
--- branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/eng/mapping.c [iso-8859-1]
(original)
+++ branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/eng/mapping.c [iso-8859-1]
Thu May 26 14:15:11 2011
@@ -11,49 +11,8 @@
#define NDEBUG
#include <debug.h>
-// HACK!!!
-#define MmMapViewInSessionSpace MmMapViewInSystemSpace
-#define MmUnmapViewInSessionSpace MmUnmapViewInSystemSpace
-
-typedef struct _ENGSECTION
-{
- PVOID pvSectionObject;
- PVOID pvMappedBase;
- SIZE_T cjViewSize;
- ULONG ulTag;
-} ENGSECTION, *PENGSECTION;
-
-typedef struct _FILEVIEW
-{
- LARGE_INTEGER LastWriteTime;
- PVOID pvKView;
- PVOID pvViewFD;
- SIZE_T cjView;
- PVOID pSection;
-} FILEVIEW, *PFILEVIEW;
-
-typedef struct _FONTFILEVIEW
-{
- FILEVIEW;
- DWORD reserved[2];
- PWSTR pwszPath;
- SIZE_T ulRegionSize;
- ULONG cKRefCount;
- ULONG cRefCountFD;
- PVOID pvSpoolerBase;
- DWORD dwSpoolerPid;
-} FONTFILEVIEW, *PFONTFILEVIEW;
-
-enum
-{
- FVF_SYSTEMROOT = 1,
- FVF_READONLY = 2,
- FVF_FONTFILE = 4,
-};
-
HANDLE ghSystem32Directory;
HANDLE ghRootDirectory;
-
PVOID
NTAPI
@@ -156,7 +115,7 @@
}
else
{
- DPRINT1("Failed to unmap a section @ &p Status=0x%x\n",
+ DPRINT1("Failed to unmap a section @ &p Status=0x%x\n",
pSection->pvMappedBase, Status);
}
}
@@ -256,26 +215,17 @@
FLONG fl)
{
PFILEVIEW pFileView = NULL;
+ PFONTFILEVIEW pffv;
OBJECT_ATTRIBUTES ObjectAttributes;
HANDLE hRootDir;
UNICODE_STRING ustrFileName;
IO_STATUS_BLOCK IoStatusBlock;
FILE_BASIC_INFORMATION FileInformation;
+ POBJECT_NAME_INFORMATION pNameInfo;
HANDLE hFile;
NTSTATUS Status;
LARGE_INTEGER liSize;
-
- if (fl & FVF_FONTFILE)
- {
- pFileView = EngAllocMem(0, sizeof(FONTFILEVIEW), 'vffG');
- }
- else
- {
- pFileView = EngAllocMem(0, sizeof(FILEVIEW), 'liFg');
- }
-
- /* Check for success */
- if (!pFileView) return NULL;
+ ULONG cjInfo, cjDesired;
/* Check if the file is relative to system32 */
if (fl & FVF_SYSTEMROOT)
@@ -308,6 +258,56 @@
NULL,
0);
+ /* Check if this is a font file */
+ if (fl & FVF_FONTFILE)
+ {
+ /* Query name information length */
+ Status = ZwQueryObject(hFile, ObjectNameInformation, NULL, 0, &cjInfo);
+ if (Status != STATUS_INFO_LENGTH_MISMATCH) goto cleanup;
+
+ /* Allocate a FONTFILEVIEW structure */
+ pffv = EngAllocMem(0, sizeof(FONTFILEVIEW) + cjInfo, 'vffG');
+ pFileView = (PFILEVIEW)pffv;
+ if (!pffv)
+ {
+ Status = STATUS_NO_MEMORY;
+ goto cleanup;
+ }
+
+ /* Query name information */
+ pNameInfo = (POBJECT_NAME_INFORMATION)(pffv + 1);
+ Status = ZwQueryObject(hFile,
+ ObjectNameInformation,
+ pNameInfo,
+ cjInfo,
+ &cjDesired);
+ if (!NT_SUCCESS(Status)) goto cleanup;
+
+ /* Initialize extended fields */
+ pffv->pwszPath = pNameInfo->Name.Buffer;
+ pffv->ulRegionSize = 0;
+ pffv->cKRefCount = 0;
+ pffv->cRefCountFD = 0;
+ pffv->pvSpoolerBase = NULL;
+ pffv->dwSpoolerPid = 0;
+ }
+ else
+ {
+ /* Allocate a FILEVIEW structure */
+ pFileView = EngAllocMem(0, sizeof(FILEVIEW), 'liFg');
+ if (!pFileView)
+ {
+ Status = STATUS_NO_MEMORY;
+ goto cleanup;
+ }
+ }
+
+ /* Initialize the structure */
+ pFileView->pvKView = NULL;
+ pFileView->pvViewFD = NULL;
+ pFileView->cjView = 0;
+
+ /* Query the last write time */
Status = ZwQueryInformationFile(hFile,
&IoStatusBlock,
&FileInformation,
@@ -329,6 +329,7 @@
hFile,
NULL);
+cleanup:
/* Close the file handle */
ZwClose(hFile);
@@ -338,11 +339,6 @@
EngFreeMem(pFileView);
return NULL;
}
-
-
- pFileView->pvKView = NULL;
- pFileView->pvViewFD = NULL;
- pFileView->cjView = 0;
return pFileView;
}
Modified: branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/eng/pdevobj.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/subsyst…
==============================================================================
--- branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/eng/pdevobj.c [iso-8859-1]
(original)
+++ branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/eng/pdevobj.c [iso-8859-1]
Thu May 26 14:15:11 2011
@@ -193,7 +193,7 @@
{
PGRAPHICS_DEVICE pGraphicsDevice;
PDEVMODEW pdmCurrent;
- INT i;
+ ULONG i;
DWORD dwFields;
pGraphicsDevice = ppdev->pGraphicsDevice;
Modified: branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/include/eng.h
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/subsyst…
==============================================================================
--- branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/include/eng.h [iso-8859-1]
(original)
+++ branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/include/eng.h [iso-8859-1]
Thu May 26 14:15:11 2011
@@ -22,18 +22,4 @@
VOID FASTCALL IntGdiReleaseSemaphore ( HSEMAPHORE hsem );
ULONGLONG APIENTRY EngGetTickCount(VOID);
-BOOL
-APIENTRY
-EngFreeSectionMem(
- IN PVOID pvSection OPTIONAL,
- IN PVOID pvMappedBase OPTIONAL);
-
-PVOID
-APIENTRY
-EngAllocSectionMem(
- OUT PVOID *ppvSection,
- IN ULONG fl,
- IN SIZE_T cjSize,
- IN ULONG ulTag);
-
VOID DecompressBitmap(SIZEL Size, BYTE *CompressedBits, BYTE *UncompressedBits, LONG
Delta, ULONG iFormat);
Added: branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/include/mapping.h
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/subsyst…
==============================================================================
--- branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/include/mapping.h (added)
+++ branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/include/mapping.h
[iso-8859-1] Thu May 26 14:15:11 2011
@@ -1,0 +1,76 @@
+
+// HACK!!!
+#define MmMapViewInSessionSpace MmMapViewInSystemSpace
+#define MmUnmapViewInSessionSpace MmUnmapViewInSystemSpace
+
+typedef struct _ENGSECTION
+{
+ PVOID pvSectionObject;
+ PVOID pvMappedBase;
+ SIZE_T cjViewSize;
+ ULONG ulTag;
+} ENGSECTION, *PENGSECTION;
+
+typedef struct _FILEVIEW
+{
+ LARGE_INTEGER LastWriteTime;
+ PVOID pvKView;
+ PVOID pvViewFD;
+ SIZE_T cjView;
+ PVOID pSection;
+} FILEVIEW, *PFILEVIEW;
+
+typedef struct _FONTFILEVIEW
+{
+ FILEVIEW;
+ DWORD reserved[2];
+ PWSTR pwszPath;
+ SIZE_T ulRegionSize;
+ ULONG cKRefCount;
+ ULONG cRefCountFD;
+ PVOID pvSpoolerBase;
+ DWORD dwSpoolerPid;
+} FONTFILEVIEW, *PFONTFILEVIEW;
+
+enum
+{
+ FVF_SYSTEMROOT = 1,
+ FVF_READONLY = 2,
+ FVF_FONTFILE = 4,
+};
+
+PVOID
+NTAPI
+EngCreateSection(
+ IN ULONG fl,
+ IN SIZE_T cjSize,
+ IN ULONG ulTag);
+
+BOOL
+APIENTRY
+EngMapSection(
+ IN PVOID pvSection,
+ IN BOOL bMap,
+ IN HANDLE hProcess,
+ OUT PVOID* pvBaseAddress);
+
+BOOL
+APIENTRY
+EngFreeSectionMem(
+ IN PVOID pvSection OPTIONAL,
+ IN PVOID pvMappedBase OPTIONAL);
+
+PVOID
+APIENTRY
+EngAllocSectionMem(
+ OUT PVOID *ppvSection,
+ IN ULONG fl,
+ IN SIZE_T cjSize,
+ IN ULONG ulTag);
+
+PFILEVIEW
+NTAPI
+EngLoadModuleEx(
+ LPWSTR pwsz,
+ ULONG cjSizeOfModule,
+ FLONG fl);
Propchange: branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/include/mapping.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/include/win32kp.h
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/subsyst…
==============================================================================
--- branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/include/win32kp.h
[iso-8859-1] (original)
+++ branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/include/win32kp.h
[iso-8859-1] Thu May 26 14:15:11 2011
@@ -91,5 +91,6 @@
#include <include/engevent.h>
#include <include/ldevobj.h>
#include <include/device.h>
+#include <include/mapping.h>
#include <dib/dib.h>
#include <include/gdidebug.h>