From 57b3bc520a7581467c292643cf77b9ca24905f66 Mon Sep 17 00:00:00 2001 From: James Tabor Date: Sat, 28 Apr 2007 06:43:44 +0000 Subject: [PATCH] Fix indexing mistake, added new LDC structure items. New defines for LDC and Xfroms. Now the Dc_Attr works. Read and write to it in user space. svn path=/trunk/; revision=26557 --- reactos/dll/win32/gdi32/misc/misc.c | 12 +++++--- reactos/include/reactos/win32k/ntgdihdl.h | 34 ++++++++++++++++++----- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/reactos/dll/win32/gdi32/misc/misc.c b/reactos/dll/win32/gdi32/misc/misc.c index 0c696ae35bb..49f8e76dd5c 100644 --- a/reactos/dll/win32/gdi32/misc/misc.c +++ b/reactos/dll/win32/gdi32/misc/misc.c @@ -58,8 +58,10 @@ GdiQueryTable(VOID) BOOL GdiIsHandleValid(HGDIOBJ hGdiObj) { - PGDI_TABLE_ENTRY Entry = GdiHandleTable + GDI_HANDLE_TO_ENTRY(hGdiObj); - if(Entry->KernelData != NULL && (Entry->Type & GDI_HANDLE_TYPE_MASK) == (LONG)GDI_HANDLE_GET_TYPE(hGdiObj)) + PGDI_TABLE_ENTRY Entry = GdiHandleTable + GDI_HANDLE_GET_INDEX(hGdiObj); + if(Entry->KernelData != NULL && + (Entry->Type & GDI_HANDLE_TYPE_MASK) == + (LONG)GDI_HANDLE_GET_TYPE(hGdiObj)) { HANDLE pid = (HANDLE)((ULONG_PTR)Entry->ProcessId & ~0x1); if(pid == NULL || pid == CurrentProcessId) @@ -72,8 +74,10 @@ BOOL GdiIsHandleValid(HGDIOBJ hGdiObj) BOOL GdiGetHandleUserData(HGDIOBJ hGdiObj, PVOID *UserData) { - PGDI_TABLE_ENTRY Entry = GdiHandleTable + GDI_HANDLE_TO_ENTRY(hGdiObj); - if(Entry->KernelData != NULL && (Entry->Type & GDI_HANDLE_TYPE_MASK) == (LONG)GDI_HANDLE_GET_TYPE(hGdiObj)) + PGDI_TABLE_ENTRY Entry = GdiHandleTable + GDI_HANDLE_GET_INDEX(hGdiObj); + if(Entry->KernelData != NULL && + (Entry->Type & GDI_HANDLE_TYPE_MASK) == + (LONG)GDI_HANDLE_GET_TYPE(hGdiObj)) { HANDLE pid = (HANDLE)((ULONG_PTR)Entry->ProcessId & ~0x1); if(pid == NULL || pid == CurrentProcessId) diff --git a/reactos/include/reactos/win32k/ntgdihdl.h b/reactos/include/reactos/win32k/ntgdihdl.h index eb3cf345cf6..0bc071d3153 100644 --- a/reactos/include/reactos/win32k/ntgdihdl.h +++ b/reactos/include/reactos/win32k/ntgdihdl.h @@ -94,8 +94,30 @@ #define DC_LAST_CLIPRGN_VALID 0x00008000 #define DC_PRIMARY_DISPLAY 0x00010000 -#define LDC_LDC 0x01 // (init) local DC other than a normal DC -#define LDC_EMFLDC 0x02 // Enhance Meta File local DC +/* DC_ATTR LCD Flags */ +#define LDC_LDC 0x00000001 // (init) local DC other than a normal DC +#define LDC_EMFLDC 0x00000002 // Enhance Meta File local DC +#define LDC_INIT_DOCUMENT 0x00000040 +#define LDC_INIT_PAGE 0x00000080 +#define LDC_KILL_DOCUMENT 0x00010000 + + +/* DC_ATTR Xform Flags */ +#define METAFILE_TO_WORLD_IDENTITY 0x00000001 +#define WORLD_TO_PAGE_IDENTITY 0x00000002 +#define DEVICE_TO_PAGE_INVALID 0x00000008 +#define DEVICE_TO_WORLD_INVALID 0x00000010 +#define WORLD_TRANSFORM_SET 0x00000020 +#define POSITIVE_Y_IS_UP 0x00000040 +#define INVALIDATE_ATTRIBUTES 0x00000080 +#define PTOD_EFM11_NEGATIVE 0x00000100 +#define PTOD_EFM22_NEGATIVE 0x00000200 +#define ISO_OR_ANISO_MAP_MODE 0x00000400 +#define PAGE_TO_DEVICE_IDENTITY 0x00000800 +#define PAGE_TO_DEVICE_SCALE_IDENTITY 0x00001000 +#define PAGE_XLATE_CHANGED 0x00002000 +#define PAGE_EXTENTS_CHANGED 0x00004000 +#define WORLD_XFORM_CHANGED 0x00008000 /* TYPES *********************************************************************/ @@ -107,11 +129,6 @@ typedef struct _GDI_TABLE_ENTRY PVOID UserData; /* Points to the user mode structure, usually NULL though */ } GDI_TABLE_ENTRY, *PGDI_TABLE_ENTRY; - -#define GDI_HANDLE_TO_ENTRY(h) \ - ((((ULONG_PTR)(h)) & GDI_HANDLE_INDEX_MASK) * sizeof(GDI_TABLE_ENTRY)) - - typedef struct _RGNATTR { ULONG AttrFlags; @@ -127,6 +144,9 @@ typedef struct _LDC INT iType; PVOID pvEmfDC; /* Pointer to ENHMETAFILE structure */ ABORTPROC pAbortProc; /* AbortProc for Printing */ + HANDLE hPrinter; /* Local or Remote Printer driver */ + INT iInitPage; /* Start/Stop */ + INT iInitDocument; } LDC, *PLDC; typedef struct _DC_ATTR