mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
- Store GDI object type in the handle itself
- Rename remaining XX_HandleToPtr/XX_ReleasePtr funcs to XX_LockXx/XX_UnlockXx svn path=/trunk/; revision=5693
This commit is contained in:
parent
974eb2f364
commit
bb70febc2a
28 changed files with 633 additions and 717 deletions
|
@ -28,18 +28,11 @@ typedef struct _BITMAPOBJ
|
||||||
/* Internal interface */
|
/* Internal interface */
|
||||||
|
|
||||||
#define BITMAPOBJ_AllocBitmap() \
|
#define BITMAPOBJ_AllocBitmap() \
|
||||||
((HBITMAP) GDIOBJ_AllocObj (sizeof (BITMAPOBJ), GO_BITMAP_MAGIC))
|
((HBITMAP) GDIOBJ_AllocObj (sizeof (BITMAPOBJ), GDI_OBJECT_TYPE_BITMAP, (GDICLEANUPPROC) Bitmap_InternalDelete))
|
||||||
#define BITMAPOBJ_FreeBitmap(hBMObj) \
|
#define BITMAPOBJ_FreeBitmap(hBMObj) \
|
||||||
GDIOBJ_FreeObj((HGDIOBJ) hBMObj, GO_BITMAP_MAGIC, GDIOBJFLAG_DEFAULT)
|
GDIOBJ_FreeObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP, GDIOBJFLAG_DEFAULT)
|
||||||
#define BITMAPOBJ_HandleToPtr(hBMObj) \
|
#define BITMAPOBJ_LockBitmap(hBMObj) GDIOBJ_LockObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP)
|
||||||
((PBITMAPOBJ) GDIOBJ_LockObj ((HGDIOBJ) hBMObj, GO_BITMAP_MAGIC))
|
#define BITMAPOBJ_UnlockBitmap(hBMObj) GDIOBJ_UnlockObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP)
|
||||||
#define BITMAPOBJ_ReleasePtr(hBMObj) \
|
|
||||||
GDIOBJ_UnlockObj ((HGDIOBJ) hBMObj, GO_BITMAP_MAGIC)
|
|
||||||
|
|
||||||
/*#define BITMAPOBJ_PtrToHandle(hBMObj) \
|
|
||||||
((HBITMAP) GDIOBJ_PtrToHandle ((PGDIOBJ) hBMObj, GO_BITMAP_MAGIC))*/
|
|
||||||
#define BITMAPOBJ_LockBitmap(hBMObj) GDIOBJ_LockObject ((HGDIOBJ) hBMObj)
|
|
||||||
#define BITMAPOBJ_UnlockBitmap(hBMObj) GDIOBJ_UnlockObject ((HGDIOBJ) hBMObj)
|
|
||||||
|
|
||||||
INT FASTCALL BITMAPOBJ_GetWidthBytes (INT bmWidth, INT bpp);
|
INT FASTCALL BITMAPOBJ_GetWidthBytes (INT bmWidth, INT bpp);
|
||||||
HBITMAP FASTCALL BITMAPOBJ_CopyBitmap (HBITMAP hBitmap);
|
HBITMAP FASTCALL BITMAPOBJ_CopyBitmap (HBITMAP hBitmap);
|
||||||
|
|
|
@ -8,15 +8,10 @@
|
||||||
#define NB_HATCH_STYLES 6
|
#define NB_HATCH_STYLES 6
|
||||||
|
|
||||||
#define BRUSHOBJ_AllocBrush() \
|
#define BRUSHOBJ_AllocBrush() \
|
||||||
((HBRUSH) GDIOBJ_AllocObj (sizeof (BRUSHOBJ), GO_BRUSH_MAGIC))
|
((HBRUSH) GDIOBJ_AllocObj (sizeof (BRUSHOBJ), GDI_OBJECT_TYPE_BRUSH, NULL))
|
||||||
#define BRUSHOBJ_FreeBrush(hBrush) GDIOBJ_FreeObj((HGDIOBJ)hBrush, GO_BRUSH_MAGIC, GDIOBJFLAG_DEFAULT)
|
#define BRUSHOBJ_FreeBrush(hBrush) GDIOBJ_FreeObj((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH, GDIOBJFLAG_DEFAULT)
|
||||||
/*#define BRUSHOBJ_HandleToPtr(hBrush) \
|
#define BRUSHOBJ_LockBrush(hBrush) ((PBRUSHOBJ)GDIOBJ_LockObj((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH))
|
||||||
((PBRUSHOBJ) GDIOBJ_HandleToPtr ((HGDIOBJ) hBrush, GO_BRUSH_MAGIC))
|
#define BRUSHOBJ_UnlockBrush(hBrush) GDIOBJ_UnlockObj((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH)
|
||||||
#define BRUSHOBJ_PtrToHandle(pBrushObj) \
|
|
||||||
((HBRUSH) GDIOBJ_PtrToHandle ((PGDIOBJ) pBrushObj, GO_BRUSH_MAGIC))
|
|
||||||
*/
|
|
||||||
#define BRUSHOBJ_LockBrush(hBrush) ((PBRUSHOBJ)GDIOBJ_LockObj((HGDIOBJ)hBrush, GO_BRUSH_MAGIC))
|
|
||||||
#define BRUSHOBJ_UnlockBrush(hBrush) GDIOBJ_UnlockObj((HGDIOBJ)hBrush, GO_BRUSH_MAGIC)
|
|
||||||
|
|
||||||
HBRUSH
|
HBRUSH
|
||||||
STDCALL
|
STDCALL
|
||||||
|
|
|
@ -79,15 +79,15 @@ typedef struct _ICONCURSOROBJ
|
||||||
|
|
||||||
/* Internal interfaces */
|
/* Internal interfaces */
|
||||||
#define ICONCURSOROBJ_AllocIconCursor() \
|
#define ICONCURSOROBJ_AllocIconCursor() \
|
||||||
((HICON) GDIOBJ_AllocObj (sizeof (ICONCURSOROBJ), GO_ICONCURSOR_MAGIC))
|
((HICON) GDIOBJ_AllocObj (sizeof (ICONCURSOROBJ), GDI_OBJECT_TYPE_ICONCURSOR, (GDICLEANUPPROC) IconCursor_InternalDelete))
|
||||||
|
|
||||||
#define ICONCURSOROBJ_HandleToPtr(hICObj) \
|
#define ICONCURSOROBJ_LockIconCursor(hICObj) \
|
||||||
((PICONCURSOROBJ) GDIOBJ_LockObj ((HGDIOBJ) hICObj, GO_ICONCURSOR_MAGIC))
|
((PICONCURSOROBJ) GDIOBJ_LockObj ((HGDIOBJ) hICObj, GDI_OBJECT_TYPE_ICONCURSOR))
|
||||||
|
|
||||||
#define ICONCURSOROBJ_ReleasePtr(hICObj) GDIOBJ_UnlockObj ((HGDIOBJ) hICObj, GO_ICONCURSOR_MAGIC)
|
#define ICONCURSOROBJ_UnlockIconCursor(hICObj) GDIOBJ_UnlockObj ((HGDIOBJ) hICObj, GDI_OBJECT_TYPE_ICONCURSOR)
|
||||||
|
|
||||||
|
|
||||||
BOOL IconCursor_InternalDelete( PICONCURSOROBJ pIconCursor );
|
BOOL FASTCALL IconCursor_InternalDelete( PICONCURSOROBJ pIconCursor );
|
||||||
|
|
||||||
/* User Entry Points */
|
/* User Entry Points */
|
||||||
HICON
|
HICON
|
||||||
|
|
|
@ -119,15 +119,10 @@ typedef struct
|
||||||
|
|
||||||
/* Internal functions */
|
/* Internal functions */
|
||||||
|
|
||||||
/*
|
#define DC_LockDc(hDC) \
|
||||||
#define DC_PtrToHandle(pDC) \
|
((PDC) GDIOBJ_LockObj ((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC))
|
||||||
((HDC) GDIOBJ_PtrToHandle ((PGDIOBJ) pDC, GO_DC_MAGIC))
|
#define DC_UnlockDc(hDC) \
|
||||||
*/
|
GDIOBJ_UnlockObj ((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC)
|
||||||
|
|
||||||
#define DC_HandleToPtr(hDC) \
|
|
||||||
((PDC) GDIOBJ_LockObj ((HGDIOBJ) hDC, GO_DC_MAGIC))
|
|
||||||
#define DC_ReleasePtr(hDC) \
|
|
||||||
GDIOBJ_UnlockObj ((HGDIOBJ) hDC, GO_DC_MAGIC)
|
|
||||||
|
|
||||||
HDC FASTCALL RetrieveDisplayHDC(VOID);
|
HDC FASTCALL RetrieveDisplayHDC(VOID);
|
||||||
HDC FASTCALL DC_AllocDC(LPCWSTR Driver);
|
HDC FASTCALL DC_AllocDC(LPCWSTR Driver);
|
||||||
|
|
|
@ -9,58 +9,31 @@
|
||||||
|
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
|
|
||||||
/*! \defgroup GDI Magic
|
/*! \defgroup GDI object types
|
||||||
*
|
*
|
||||||
* GDI object magic numbers
|
* GDI object types
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
//@{
|
/*@{*/
|
||||||
#define GO_PEN_MAGIC 0x4f47
|
#define GDI_OBJECT_TYPE_DC 0x00010000
|
||||||
#define GO_BRUSH_MAGIC 0x4f48
|
#define GDI_OBJECT_TYPE_REGION 0x00040000
|
||||||
#define GO_FONT_MAGIC 0x4f49
|
#define GDI_OBJECT_TYPE_BITMAP 0x00050000
|
||||||
#define GO_PALETTE_MAGIC 0x4f4a
|
#define GDI_OBJECT_TYPE_PALETTE 0x00080000
|
||||||
#define GO_BITMAP_MAGIC 0x4f4b
|
#define GDI_OBJECT_TYPE_FONT 0x000a0000
|
||||||
#define GO_REGION_MAGIC 0x4f4c
|
#define GDI_OBJECT_TYPE_BRUSH 0x00100000
|
||||||
#define GO_DC_MAGIC 0x4f4d
|
#define GDI_OBJECT_TYPE_EMF 0x00210000
|
||||||
#define GO_DISABLED_DC_MAGIC 0x4f4e
|
#define GDI_OBJECT_TYPE_PEN 0x00300000
|
||||||
#define GO_META_DC_MAGIC 0x4f4f
|
#define GDI_OBJECT_TYPE_EXTPEN 0x00500000
|
||||||
#define GO_METAFILE_MAGIC 0x4f50
|
/* Following object types made up for ROS */
|
||||||
#define GO_METAFILE_DC_MAGIC 0x4f51
|
#define GDI_OBJECT_TYPE_METADC 0x00710000
|
||||||
#define GO_ENHMETAFILE_MAGIC 0x4f52
|
#define GDI_OBJECT_TYPE_METAFILE 0x00720000
|
||||||
#define GO_ENHMETAFILE_DC_MAGIC 0x4f53
|
#define GDI_OBJECT_TYPE_ENHMETAFILE 0x00730000
|
||||||
#define GO_DCE_MAGIC 0x4f54
|
#define GDI_OBJECT_TYPE_ENHMETADC 0x00740000
|
||||||
#define GO_ICONCURSOR_MAGIC 0x4f55
|
#define GDI_OBJECT_TYPE_MEMDC 0x00750000
|
||||||
#define GO_MAGIC_DONTCARE 0xffff
|
#define GDI_OBJECT_TYPE_ICONCURSOR 0x00760000
|
||||||
//@}
|
#define GDI_OBJECT_TYPE_DCE 0x00770000
|
||||||
/* (RJJ) swiped stock handles from wine */
|
#define GDI_OBJECT_TYPE_DONTCARE 0x007f0000
|
||||||
/* First handle possible for stock objects (must be >= GDI_HEAP_SIZE) */
|
/*@}*/
|
||||||
#define FIRST_STOCK_HANDLE 0xffffff00
|
|
||||||
|
|
||||||
/*! Stock object handles */
|
|
||||||
//@{
|
|
||||||
#define NB_STOCK_OBJECTS (DEFAULT_GUI_FONT + 1)
|
|
||||||
#define STOCK_WHITE_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+WHITE_BRUSH))
|
|
||||||
#define STOCK_LTGRAY_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+LTGRAY_BRUSH))
|
|
||||||
#define STOCK_GRAY_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+GRAY_BRUSH))
|
|
||||||
#define STOCK_DKGRAY_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+DKGRAY_BRUSH))
|
|
||||||
#define STOCK_BLACK_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+BLACK_BRUSH))
|
|
||||||
#define STOCK_NULL_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+NULL_BRUSH))
|
|
||||||
#define STOCK_HOLLOW_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+HOLLOW_BRUSH))
|
|
||||||
#define STOCK_WHITE_PEN ((HPEN)(FIRST_STOCK_HANDLE+WHITE_PEN))
|
|
||||||
#define STOCK_BLACK_PEN ((HPEN)(FIRST_STOCK_HANDLE+BLACK_PEN))
|
|
||||||
#define STOCK_NULL_PEN ((HPEN)(FIRST_STOCK_HANDLE+NULL_PEN))
|
|
||||||
#define STOCK_OEM_FIXED_FONT ((HFONT)(FIRST_STOCK_HANDLE+OEM_FIXED_FONT))
|
|
||||||
#define STOCK_ANSI_FIXED_FONT ((HFONT)(FIRST_STOCK_HANDLE+ANSI_FIXED_FONT))
|
|
||||||
#define STOCK_ANSI_VAR_FONT ((HFONT)(FIRST_STOCK_HANDLE+ANSI_VAR_FONT))
|
|
||||||
#define STOCK_SYSTEM_FONT ((HFONT)(FIRST_STOCK_HANDLE+SYSTEM_FONT))
|
|
||||||
#define STOCK_DEVICE_DEFAULT_FONT ((HFONT)(FIRST_STOCK_HANDLE+DEVICE_DEFAULT_FONT))
|
|
||||||
#define STOCK_DEFAULT_PALETTE ((HPALETTE)(FIRST_STOCK_HANDLE+DEFAULT_PALETTE))
|
|
||||||
#define STOCK_SYSTEM_FIXED_FONT ((HFONT)(FIRST_STOCK_HANDLE+SYSTEM_FIXED_FONT))
|
|
||||||
#define STOCK_DEFAULT_GUI_FONT ((HFONT)(FIRST_STOCK_HANDLE+DEFAULT_GUI_FONT))
|
|
||||||
#define FIRST_STOCK_FONT STOCK_OEM_FIXED_FONT
|
|
||||||
#define LAST_STOCK_FONT STOCK_DEFAULT_GUI_FONT
|
|
||||||
#define LAST_STOCK_HANDLE ((DWORD)STOCK_DEFAULT_GUI_FONT)
|
|
||||||
//@}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* GDI object header. This is a part of any GDI object
|
* GDI object header. This is a part of any GDI object
|
||||||
|
@ -68,16 +41,18 @@
|
||||||
typedef struct _GDIOBJHDR
|
typedef struct _GDIOBJHDR
|
||||||
{
|
{
|
||||||
WORD wTableIndex;
|
WORD wTableIndex;
|
||||||
DWORD dwCount; /// reference count for the object
|
DWORD dwCount; /* reference count for the object */
|
||||||
} GDIOBJHDR, *PGDIOBJHDR;
|
} GDIOBJHDR, *PGDIOBJHDR;
|
||||||
|
|
||||||
typedef PVOID PGDIOBJ;
|
typedef PVOID PGDIOBJ;
|
||||||
|
|
||||||
|
typedef BOOL (FASTCALL *GDICLEANUPPROC)(PGDIOBJ Obj);
|
||||||
|
|
||||||
typedef struct _GDI_HANDLE_ENTRY
|
typedef struct _GDI_HANDLE_ENTRY
|
||||||
{
|
{
|
||||||
WORD wMagic;
|
GDICLEANUPPROC CleanupProc;
|
||||||
HANDLE hProcessId;
|
HANDLE hProcessId;
|
||||||
PGDIOBJ pObject;
|
PGDIOBJ pObject;
|
||||||
const char* lockfile;
|
const char* lockfile;
|
||||||
int lockline;
|
int lockline;
|
||||||
} GDI_HANDLE_ENTRY, *PGDI_HANDLE_ENTRY;
|
} GDI_HANDLE_ENTRY, *PGDI_HANDLE_ENTRY;
|
||||||
|
@ -90,35 +65,33 @@ typedef struct _GDI_HANDLE_TABLE
|
||||||
|
|
||||||
typedef struct _GDIMULTILOCK
|
typedef struct _GDIMULTILOCK
|
||||||
{
|
{
|
||||||
HGDIOBJ hObj;
|
HGDIOBJ hObj;
|
||||||
PGDIOBJ pObj;
|
PGDIOBJ pObj;
|
||||||
WORD Magic;
|
DWORD ObjectType;
|
||||||
} GDIMULTILOCK, *PGDIMULTILOCK;
|
} GDIMULTILOCK, *PGDIMULTILOCK;
|
||||||
|
|
||||||
HGDIOBJ FASTCALL GDIOBJ_AllocObj(WORD Size, WORD Magic);
|
HGDIOBJ FASTCALL GDIOBJ_AllocObj(WORD Size, DWORD ObjectType, GDICLEANUPPROC CleanupProcPtr);
|
||||||
BOOL STDCALL GDIOBJ_FreeObj (HGDIOBJ Obj, WORD Magic, DWORD Flag);
|
BOOL STDCALL GDIOBJ_FreeObj (HGDIOBJ Obj, DWORD ObjectType, DWORD Flag);
|
||||||
PGDIOBJ FASTCALL GDIOBJ_LockObj (HGDIOBJ Obj, WORD Magic);
|
PGDIOBJ FASTCALL GDIOBJ_LockObj (HGDIOBJ Obj, DWORD ObjectType);
|
||||||
BOOL FASTCALL GDIOBJ_LockMultipleObj( PGDIMULTILOCK pList, INT nObj );
|
BOOL FASTCALL GDIOBJ_LockMultipleObj(PGDIMULTILOCK pList, INT nObj);
|
||||||
BOOL FASTCALL GDIOBJ_UnlockObj (HGDIOBJ Obj, WORD Magic);
|
BOOL FASTCALL GDIOBJ_UnlockObj (HGDIOBJ Obj, DWORD ObjectType);
|
||||||
BOOL FASTCALL GDIOBJ_UnlockMultipleObj( PGDIMULTILOCK pList, INT nObj );
|
BOOL FASTCALL GDIOBJ_UnlockMultipleObj(PGDIMULTILOCK pList, INT nObj);
|
||||||
WORD FASTCALL GDIOBJ_GetHandleMagic (HGDIOBJ ObjectHandle);
|
DWORD FASTCALL GDIOBJ_GetObjectType(HGDIOBJ ObjectHandle);
|
||||||
VOID STDCALL IntDumpGdiObjects( INT Pid );
|
|
||||||
|
|
||||||
// a couple macros for debugging GDIOBJ locking
|
/* a couple macros for debugging GDIOBJ locking */
|
||||||
#define GDIOBJ_LockObj(obj,mag) GDIOBJ_LockObjDbg(__FILE__,__LINE__,obj,mag)
|
#define GDIOBJ_LockObj(obj,ty) GDIOBJ_LockObjDbg(__FILE__,__LINE__,obj,ty)
|
||||||
#define GDIOBJ_UnlockObj(obj,mag) GDIOBJ_UnlockObjDbg(__FILE__,__LINE__,obj,mag)
|
#define GDIOBJ_UnlockObj(obj,ty) GDIOBJ_UnlockObjDbg(__FILE__,__LINE__,obj,ty)
|
||||||
|
|
||||||
#ifdef GDIOBJ_LockObj
|
#ifdef GDIOBJ_LockObj
|
||||||
PGDIOBJ FASTCALL GDIOBJ_LockObjDbg (const char* file, int line, HGDIOBJ Obj, WORD Magic);
|
PGDIOBJ FASTCALL GDIOBJ_LockObjDbg (const char* file, int line, HGDIOBJ Obj, DWORD ObjectType);
|
||||||
#endif//GDIOBJ_LockObj
|
#endif /* GDIOBJ_LockObj */
|
||||||
|
|
||||||
#ifdef GDIOBJ_UnlockObj
|
#ifdef GDIOBJ_UnlockObj
|
||||||
BOOL FASTCALL GDIOBJ_UnlockObjDbg (const char* file, int line, HGDIOBJ Obj, WORD Magic);
|
BOOL FASTCALL GDIOBJ_UnlockObjDbg (const char* file, int line, HGDIOBJ Obj, DWORD ObjectType);
|
||||||
#endif//GDIOBJ_UnlockObj
|
#endif /* GDIOBJ_UnlockObj */
|
||||||
|
|
||||||
#define GDIOBJFLAG_DEFAULT (0x0)
|
#define GDIOBJFLAG_DEFAULT (0x0)
|
||||||
#define GDIOBJFLAG_IGNOREPID (0x1)
|
#define GDIOBJFLAG_IGNOREPID (0x1)
|
||||||
#define GDIOBJFLAG_IGNORELOCK (0x2)
|
#define GDIOBJFLAG_IGNORELOCK (0x2)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -13,16 +13,10 @@ typedef struct
|
||||||
/* Internal interface */
|
/* Internal interface */
|
||||||
|
|
||||||
#define PENOBJ_AllocPen() \
|
#define PENOBJ_AllocPen() \
|
||||||
((HPEN) GDIOBJ_AllocObj (sizeof (PENOBJ), GO_PEN_MAGIC))
|
((HPEN) GDIOBJ_AllocObj (sizeof (PENOBJ), GDI_OBJECT_TYPE_PEN, NULL))
|
||||||
#define PENOBJ_FreePen(hBMObj) GDIOBJ_FreeObj((HGDIOBJ) hBMObj, GO_PEN_MAGIC, GDIOBJFLAG_DEFAULT)
|
#define PENOBJ_FreePen(hBMObj) GDIOBJ_FreeObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_PEN, GDIOBJFLAG_DEFAULT)
|
||||||
/*
|
#define PENOBJ_LockPen(hBMObj) ((PPENOBJ)GDIOBJ_LockObj ((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_PEN))
|
||||||
#define PENOBJ_HandleToPtr(hBMObj) \
|
#define PENOBJ_UnlockPen(hBMObj) GDIOBJ_UnlockObj ((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_PEN)
|
||||||
((PPENOBJ) GDIOBJ_HandleToPtr ((HGDIOBJ) hBMObj, GO_PEN_MAGIC))
|
|
||||||
#define PENOBJ_PtrToHandle(hBMObj) \
|
|
||||||
((HPEN) GDIOBJ_PtrToHandle ((PGDIOBJ) hBMObj, GO_PEN_MAGIC))
|
|
||||||
*/
|
|
||||||
#define PENOBJ_LockPen(hBMObj) ((PPENOBJ)GDIOBJ_LockObj ((HGDIOBJ) hBMObj, GO_PEN_MAGIC))
|
|
||||||
#define PENOBJ_UnlockPen(hBMObj) GDIOBJ_UnlockObj ((HGDIOBJ) hBMObj, GO_PEN_MAGIC)
|
|
||||||
|
|
||||||
HPEN STDCALL NtGdiCreatePen(INT PenStyle,
|
HPEN STDCALL NtGdiCreatePen(INT PenStyle,
|
||||||
INT Width,
|
INT Width,
|
||||||
|
|
|
@ -11,9 +11,9 @@ typedef struct _ROSRGNDATA {
|
||||||
} ROSRGNDATA, *PROSRGNDATA, *LPROSRGNDATA;
|
} ROSRGNDATA, *PROSRGNDATA, *LPROSRGNDATA;
|
||||||
|
|
||||||
|
|
||||||
#define RGNDATA_FreeRgn(hRgn) GDIOBJ_FreeObj((HGDIOBJ)hRgn, GO_REGION_MAGIC, GDIOBJFLAG_DEFAULT)
|
#define RGNDATA_FreeRgn(hRgn) GDIOBJ_FreeObj((HGDIOBJ)hRgn, GDI_OBJECT_TYPE_REGION, GDIOBJFLAG_DEFAULT)
|
||||||
#define RGNDATA_LockRgn(hRgn) ((PROSRGNDATA)GDIOBJ_LockObj((HGDIOBJ)hRgn, GO_REGION_MAGIC))
|
#define RGNDATA_LockRgn(hRgn) ((PROSRGNDATA)GDIOBJ_LockObj((HGDIOBJ)hRgn, GDI_OBJECT_TYPE_REGION))
|
||||||
#define RGNDATA_UnlockRgn(hRgn) GDIOBJ_UnlockObj((HGDIOBJ)hRgn, GO_REGION_MAGIC)
|
#define RGNDATA_UnlockRgn(hRgn) GDIOBJ_UnlockObj((HGDIOBJ)hRgn, GDI_OBJECT_TYPE_REGION)
|
||||||
HRGN FASTCALL RGNDATA_AllocRgn(INT n);
|
HRGN FASTCALL RGNDATA_AllocRgn(INT n);
|
||||||
|
|
||||||
BOOL FASTCALL RGNDATA_InternalDelete( PROSRGNDATA Obj );
|
BOOL FASTCALL RGNDATA_InternalDelete( PROSRGNDATA Obj );
|
||||||
|
|
|
@ -12,10 +12,10 @@ typedef struct
|
||||||
/* Internal interface */
|
/* Internal interface */
|
||||||
|
|
||||||
#define TEXTOBJ_AllocText() \
|
#define TEXTOBJ_AllocText() \
|
||||||
((HFONT) GDIOBJ_AllocObj (sizeof (TEXTOBJ), GO_FONT_MAGIC))
|
((HFONT) GDIOBJ_AllocObj (sizeof (TEXTOBJ), GDI_OBJECT_TYPE_FONT, NULL))
|
||||||
#define TEXTOBJ_FreeText(hBMObj) GDIOBJ_FreeObj((HGDIOBJ) hBMObj, GO_FONT_MAGIC, GDIOBJFLAG_DEFAULT)
|
#define TEXTOBJ_FreeText(hBMObj) GDIOBJ_FreeObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_FONT, GDIOBJFLAG_DEFAULT)
|
||||||
#define TEXTOBJ_LockText(hBMObj) ((PTEXTOBJ) GDIOBJ_LockObj ((HGDIOBJ) hBMObj, GO_FONT_MAGIC))
|
#define TEXTOBJ_LockText(hBMObj) ((PTEXTOBJ) GDIOBJ_LockObj ((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_FONT))
|
||||||
#define TEXTOBJ_UnlockText(hBMObj) GDIOBJ_UnlockObj ((HGDIOBJ) hBMObj, GO_FONT_MAGIC)
|
#define TEXTOBJ_UnlockText(hBMObj) GDIOBJ_UnlockObj ((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_FONT)
|
||||||
|
|
||||||
NTSTATUS FASTCALL TextIntRealizeFont(HFONT FontHandle);
|
NTSTATUS FASTCALL TextIntRealizeFont(HFONT FontHandle);
|
||||||
NTSTATUS FASTCALL TextIntCreateFontIndirect(CONST LPLOGFONTW lf, HFONT *NewFont);
|
NTSTATUS FASTCALL TextIntCreateFontIndirect(CONST LPLOGFONTW lf, HFONT *NewFont);
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: mouse.c,v 1.28 2003/08/19 11:48:49 weiden Exp $
|
/* $Id: mouse.c,v 1.29 2003/08/20 07:45:01 gvg Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* PURPOSE: Mouse
|
* PURPOSE: Mouse
|
||||||
|
@ -232,10 +232,10 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dc = DC_HandleToPtr(hDC);
|
dc = DC_LockDc(hDC);
|
||||||
SurfObj = (PSURFOBJ)AccessUserObject((ULONG) dc->Surface);
|
SurfObj = (PSURFOBJ)AccessUserObject((ULONG) dc->Surface);
|
||||||
SurfGDI = (PSURFGDI)AccessInternalObject((ULONG) dc->Surface);
|
SurfGDI = (PSURFGDI)AccessInternalObject((ULONG) dc->Surface);
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
|
|
||||||
/* Compile the total mouse movement change and dispatch button events. */
|
/* Compile the total mouse movement change and dispatch button events. */
|
||||||
for (i = 0; i < InputCount; i++)
|
for (i = 0; i < InputCount; i++)
|
||||||
|
@ -324,10 +324,10 @@ EnableMouse(HDC hDisplayDC)
|
||||||
|
|
||||||
if( hDisplayDC )
|
if( hDisplayDC )
|
||||||
{
|
{
|
||||||
dc = DC_HandleToPtr(hDisplayDC);
|
dc = DC_LockDc(hDisplayDC);
|
||||||
SurfObj = (PSURFOBJ)AccessUserObject((ULONG) dc->Surface);
|
SurfObj = (PSURFOBJ)AccessUserObject((ULONG) dc->Surface);
|
||||||
SurfGDI = (PSURFGDI)AccessInternalObject((ULONG) dc->Surface);
|
SurfGDI = (PSURFGDI)AccessInternalObject((ULONG) dc->Surface);
|
||||||
DC_ReleasePtr( hDisplayDC );
|
DC_UnlockDc( hDisplayDC );
|
||||||
|
|
||||||
/* Create the default mouse cursor. */
|
/* Create the default mouse cursor. */
|
||||||
mouse_width = 32;
|
mouse_width = 32;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: surface.c,v 1.22 2003/08/04 19:57:47 royce Exp $
|
/* $Id: surface.c,v 1.23 2003/08/20 07:45:01 gvg Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -341,7 +341,7 @@ EngLockSurface(IN HSURF Surface)
|
||||||
* FIXME - don't know if GDIOBJ_LockObj's return value is a SURFOBJ or not...
|
* FIXME - don't know if GDIOBJ_LockObj's return value is a SURFOBJ or not...
|
||||||
* also, what is HSURF's correct magic #?
|
* also, what is HSURF's correct magic #?
|
||||||
*/
|
*/
|
||||||
GDIOBJ_LockObj ( Surface, GO_MAGIC_DONTCARE );
|
GDIOBJ_LockObj ( Surface, GDI_OBJECT_TYPE_DONTCARE );
|
||||||
return (SURFOBJ*)AccessUserObject((ULONG)Surface);
|
return (SURFOBJ*)AccessUserObject((ULONG)Surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,6 +354,6 @@ EngUnlockSurface(IN SURFOBJ *Surface)
|
||||||
/*
|
/*
|
||||||
* FIXME what is HSURF's correct magic #?
|
* FIXME what is HSURF's correct magic #?
|
||||||
*/
|
*/
|
||||||
GDIOBJ_UnlockObj ( Surface->hsurf, GO_MAGIC_DONTCARE );
|
GDIOBJ_UnlockObj ( Surface->hsurf, GDI_OBJECT_TYPE_DONTCARE );
|
||||||
}
|
}
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -34,10 +34,10 @@ typedef struct tagDCE
|
||||||
|
|
||||||
|
|
||||||
#define DCEOBJ_AllocDCE() \
|
#define DCEOBJ_AllocDCE() \
|
||||||
((HDCE) GDIOBJ_AllocObj (sizeof (DCE), GO_DCE_MAGIC))
|
((HDCE) GDIOBJ_AllocObj (sizeof (DCE), GDI_OBJECT_TYPE_DCE, (GDICLEANUPPROC) DCE_InternalDelete))
|
||||||
#define DCEOBJ_FreeDCE(hDCE) GDIOBJ_FreeObj((HGDIOBJ)hDCE, GO_DCE_MAGIC, GDIOBJFLAG_DEFAULT)
|
#define DCEOBJ_FreeDCE(hDCE) GDIOBJ_FreeObj((HGDIOBJ)hDCE, GDI_OBJECT_TYPE_DCE, GDIOBJFLAG_DEFAULT)
|
||||||
#define DCEOBJ_LockDCE(hDCE) ((PDCE)GDIOBJ_LockObj((HGDIOBJ)hDCE, GO_DCE_MAGIC))
|
#define DCEOBJ_LockDCE(hDCE) ((PDCE)GDIOBJ_LockObj((HGDIOBJ)hDCE, GDI_OBJECT_TYPE_DCE))
|
||||||
#define DCEOBJ_UnlockDCE(hDCE) GDIOBJ_UnlockObj((HGDIOBJ)hDCE, GO_DCE_MAGIC)
|
#define DCEOBJ_UnlockDCE(hDCE) GDIOBJ_UnlockObj((HGDIOBJ)hDCE, GDI_OBJECT_TYPE_DCE)
|
||||||
|
|
||||||
PDCE FASTCALL DCE_AllocDCE(HWND hWnd, DCE_TYPE type); // ???
|
PDCE FASTCALL DCE_AllocDCE(HWND hWnd, DCE_TYPE type); // ???
|
||||||
PDCE FASTCALL DceAllocDCE(HWND hWnd, DCE_TYPE Type);
|
PDCE FASTCALL DceAllocDCE(HWND hWnd, DCE_TYPE Type);
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: windc.c,v 1.21 2003/08/19 11:48:50 weiden Exp $
|
/* $Id: windc.c,v 1.22 2003/08/20 07:45:01 gvg Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -170,7 +170,7 @@ VOID STATIC STDCALL
|
||||||
DceSetDrawable(PWINDOW_OBJECT WindowObject, HDC hDC, ULONG Flags,
|
DceSetDrawable(PWINDOW_OBJECT WindowObject, HDC hDC, ULONG Flags,
|
||||||
BOOL SetClipOrigin)
|
BOOL SetClipOrigin)
|
||||||
{
|
{
|
||||||
DC *dc = DC_HandleToPtr(hDC);
|
DC *dc = DC_LockDc(hDC);
|
||||||
if (WindowObject == NULL)
|
if (WindowObject == NULL)
|
||||||
{
|
{
|
||||||
dc->w.DCOrgX = 0;
|
dc->w.DCOrgX = 0;
|
||||||
|
@ -189,7 +189,7 @@ DceSetDrawable(PWINDOW_OBJECT WindowObject, HDC hDC, ULONG Flags,
|
||||||
dc->w.DCOrgY = WindowObject->ClientRect.top;
|
dc->w.DCOrgY = WindowObject->ClientRect.top;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DC_ReleasePtr(hDC);
|
DC_UnlockDc(hDC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: winpos.c,v 1.25 2003/08/19 11:48:50 weiden Exp $
|
/* $Id: winpos.c,v 1.26 2003/08/20 07:45:01 gvg Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -42,6 +42,7 @@
|
||||||
#include <include/callback.h>
|
#include <include/callback.h>
|
||||||
#include <include/painting.h>
|
#include <include/painting.h>
|
||||||
#include <include/dce.h>
|
#include <include/dce.h>
|
||||||
|
#include <include/vis.h>
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
@ -696,6 +697,7 @@ WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
|
||||||
RECT NewWindowRect;
|
RECT NewWindowRect;
|
||||||
RECT NewClientRect;
|
RECT NewClientRect;
|
||||||
HRGN VisRgn = NULL;
|
HRGN VisRgn = NULL;
|
||||||
|
HRGN VisibleRgn = NULL;
|
||||||
ULONG WvrFlags = 0;
|
ULONG WvrFlags = 0;
|
||||||
RECT OldWindowRect, OldClientRect;
|
RECT OldWindowRect, OldClientRect;
|
||||||
UINT FlagsEx = 0;
|
UINT FlagsEx = 0;
|
||||||
|
@ -792,11 +794,13 @@ WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
|
||||||
{
|
{
|
||||||
if (Window->Style & WS_CLIPCHILDREN)
|
if (Window->Style & WS_CLIPCHILDREN)
|
||||||
{
|
{
|
||||||
VisRgn = DceGetVisRgn(Wnd, DCX_WINDOW | DCX_CLIPSIBLINGS, 0, 0);
|
VisRgn = VIS_ComputeVisibleRegion(PsGetWin32Thread()->Desktop,
|
||||||
|
Window, FALSE, FALSE, TRUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VisRgn = DceGetVisRgn(Wnd, DCX_WINDOW, 0, 0);
|
VisRgn = VIS_ComputeVisibleRegion(PsGetWin32Thread()->Desktop,
|
||||||
|
Window, FALSE, FALSE, FALSE);
|
||||||
}
|
}
|
||||||
NtGdiOffsetRgn(VisRgn, -Window->WindowRect.left, -Window->WindowRect.top);
|
NtGdiOffsetRgn(VisRgn, -Window->WindowRect.left, -Window->WindowRect.top);
|
||||||
}
|
}
|
||||||
|
@ -863,7 +867,11 @@ WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
|
||||||
|
|
||||||
if (WinPos.flags & SWP_HIDEWINDOW)
|
if (WinPos.flags & SWP_HIDEWINDOW)
|
||||||
{
|
{
|
||||||
|
VisibleRgn = VIS_ComputeVisibleRegion(PsGetWin32Thread()->Desktop, Window,
|
||||||
|
FALSE, FALSE, FALSE);
|
||||||
Window->Style &= ~WS_VISIBLE;
|
Window->Style &= ~WS_VISIBLE;
|
||||||
|
VIS_WindowLayoutChanged(PsGetWin32Thread()->Desktop, Window, VisibleRgn);
|
||||||
|
NtGdiDeleteObject(VisibleRgn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Hide or show the claret */
|
/* FIXME: Hide or show the claret */
|
||||||
|
@ -921,6 +929,7 @@ WinPosShowWindow(HWND Wnd, INT Cmd)
|
||||||
UINT Swp = 0;
|
UINT Swp = 0;
|
||||||
RECT NewPos;
|
RECT NewPos;
|
||||||
BOOLEAN ShowFlag;
|
BOOLEAN ShowFlag;
|
||||||
|
HRGN VisibleRgn;
|
||||||
|
|
||||||
Status =
|
Status =
|
||||||
ObmReferenceObjectByHandle(PsGetWin32Process()->WindowStation->HandleTable,
|
ObmReferenceObjectByHandle(PsGetWin32Process()->WindowStation->HandleTable,
|
||||||
|
@ -1024,7 +1033,11 @@ WinPosShowWindow(HWND Wnd, INT Cmd)
|
||||||
{
|
{
|
||||||
if (Cmd == SW_HIDE)
|
if (Cmd == SW_HIDE)
|
||||||
{
|
{
|
||||||
|
VisibleRgn = VIS_ComputeVisibleRegion(PsGetWin32Thread()->Desktop, Window,
|
||||||
|
FALSE, FALSE, FALSE);
|
||||||
Window->Style &= ~WS_VISIBLE;
|
Window->Style &= ~WS_VISIBLE;
|
||||||
|
VIS_WindowLayoutChanged(PsGetWin32Thread()->Desktop, Window, VisibleRgn);
|
||||||
|
NtGdiDeleteObject(VisibleRgn);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1139,8 +1152,6 @@ WinPosSearchChildren(PWINDOW_OBJECT ScopeWin, POINT Point,
|
||||||
Point.y >= Current->ClientRect.top &&
|
Point.y >= Current->ClientRect.top &&
|
||||||
Point.y < Current->ClientRect.bottom)
|
Point.y < Current->ClientRect.bottom)
|
||||||
{
|
{
|
||||||
Point.x -= Current->ClientRect.left;
|
|
||||||
Point.y -= Current->ClientRect.top;
|
|
||||||
|
|
||||||
ExReleaseFastMutexUnsafe(&ScopeWin->ChildrenListLock);
|
ExReleaseFastMutexUnsafe(&ScopeWin->ChildrenListLock);
|
||||||
return(WinPosSearchChildren(Current, Point, Window));
|
return(WinPosSearchChildren(Current, Point, Window));
|
||||||
|
|
|
@ -16,10 +16,11 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: bitmaps.c,v 1.33 2003/08/19 11:48:50 weiden Exp $ */
|
/* $Id: bitmaps.c,v 1.34 2003/08/20 07:45:02 gvg Exp $ */
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <win32k/gdiobj.h>
|
||||||
#include <win32k/bitmaps.h>
|
#include <win32k/bitmaps.h>
|
||||||
//#include <win32k/debug.h>
|
//#include <win32k/debug.h>
|
||||||
#include "../eng/handle.h"
|
#include "../eng/handle.h"
|
||||||
|
@ -40,7 +41,7 @@ BOOL STDCALL NtGdiBitBlt(HDC hDCDest,
|
||||||
INT YSrc,
|
INT YSrc,
|
||||||
DWORD ROP)
|
DWORD ROP)
|
||||||
{
|
{
|
||||||
GDIMULTILOCK Lock[2] = {{hDCDest, 0, GO_DC_MAGIC}, {hDCSrc, 0, GO_DC_MAGIC}};
|
GDIMULTILOCK Lock[2] = {{hDCDest, 0, GDI_OBJECT_TYPE_DC}, {hDCSrc, 0, GDI_OBJECT_TYPE_DC}};
|
||||||
PDC DCDest = NULL;
|
PDC DCDest = NULL;
|
||||||
PDC DCSrc = NULL;
|
PDC DCSrc = NULL;
|
||||||
PSURFOBJ SurfDest, SurfSrc;
|
PSURFOBJ SurfDest, SurfSrc;
|
||||||
|
@ -171,7 +172,7 @@ HBITMAP STDCALL NtGdiCreateBitmap(INT Width,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bmp = BITMAPOBJ_HandleToPtr( hBitmap );
|
bmp = BITMAPOBJ_LockBitmap( hBitmap );
|
||||||
|
|
||||||
DPRINT("NtGdiCreateBitmap:%dx%d, %d (%d BPP) colors returning %08x\n", Width, Height,
|
DPRINT("NtGdiCreateBitmap:%dx%d, %d (%d BPP) colors returning %08x\n", Width, Height,
|
||||||
1 << (Planes * BitsPerPel), BitsPerPel, bmp);
|
1 << (Planes * BitsPerPel), BitsPerPel, bmp);
|
||||||
|
@ -196,7 +197,7 @@ HBITMAP STDCALL NtGdiCreateBitmap(INT Width,
|
||||||
NtGdiSetBitmapBits(hBitmap, Height * bmp->bitmap.bmWidthBytes, Bits);
|
NtGdiSetBitmapBits(hBitmap, Height * bmp->bitmap.bmWidthBytes, Bits);
|
||||||
}
|
}
|
||||||
|
|
||||||
BITMAPOBJ_ReleasePtr( hBitmap );
|
BITMAPOBJ_UnlockBitmap( hBitmap );
|
||||||
|
|
||||||
return hBitmap;
|
return hBitmap;
|
||||||
}
|
}
|
||||||
|
@ -237,7 +238,7 @@ HBITMAP STDCALL NtGdiCreateCompatibleBitmap(HDC hDC,
|
||||||
PDC dc;
|
PDC dc;
|
||||||
|
|
||||||
hbmpRet = 0;
|
hbmpRet = 0;
|
||||||
dc = DC_HandleToPtr (hDC);
|
dc = DC_LockDc(hDC);
|
||||||
|
|
||||||
DPRINT("NtGdiCreateCompatibleBitmap(%04x,%d,%d, bpp:%d) = \n", hDC, Width, Height, dc->w.bitsPerPixel);
|
DPRINT("NtGdiCreateCompatibleBitmap(%04x,%d,%d, bpp:%d) = \n", hDC, Width, Height, dc->w.bitsPerPixel);
|
||||||
|
|
||||||
|
@ -262,7 +263,7 @@ HBITMAP STDCALL NtGdiCreateCompatibleBitmap(HDC hDC,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DPRINT ("\t\t%04x\n", hbmpRet);
|
DPRINT ("\t\t%04x\n", hbmpRet);
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
return hbmpRet;
|
return hbmpRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,7 +306,7 @@ BOOL STDCALL NtGdiGetBitmapDimensionEx(HBITMAP hBitmap,
|
||||||
{
|
{
|
||||||
PBITMAPOBJ bmp;
|
PBITMAPOBJ bmp;
|
||||||
|
|
||||||
bmp = BITMAPOBJ_HandleToPtr (hBitmap);
|
bmp = BITMAPOBJ_LockBitmap(hBitmap);
|
||||||
if (bmp == NULL)
|
if (bmp == NULL)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -313,6 +314,8 @@ BOOL STDCALL NtGdiGetBitmapDimensionEx(HBITMAP hBitmap,
|
||||||
|
|
||||||
*Dimension = bmp->size;
|
*Dimension = bmp->size;
|
||||||
|
|
||||||
|
BITMAPOBJ_UnlockBitmap(hBitmap);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,7 +363,7 @@ LONG STDCALL NtGdiSetBitmapBits(HBITMAP hBitmap,
|
||||||
LONG height, ret;
|
LONG height, ret;
|
||||||
PBITMAPOBJ bmp;
|
PBITMAPOBJ bmp;
|
||||||
|
|
||||||
bmp = BITMAPOBJ_HandleToPtr (hBitmap);
|
bmp = BITMAPOBJ_LockBitmap(hBitmap);
|
||||||
if (bmp == NULL || Bits == NULL)
|
if (bmp == NULL || Bits == NULL)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -433,7 +436,7 @@ BOOL STDCALL NtGdiSetBitmapDimensionEx(HBITMAP hBitmap,
|
||||||
{
|
{
|
||||||
PBITMAPOBJ bmp;
|
PBITMAPOBJ bmp;
|
||||||
|
|
||||||
bmp = BITMAPOBJ_HandleToPtr (hBitmap);
|
bmp = BITMAPOBJ_LockBitmap(hBitmap);
|
||||||
if (bmp == NULL)
|
if (bmp == NULL)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -522,7 +525,7 @@ HBITMAP FASTCALL BITMAPOBJ_CopyBitmap(HBITMAP hBitmap)
|
||||||
HBITMAP res;
|
HBITMAP res;
|
||||||
BITMAP bm;
|
BITMAP bm;
|
||||||
|
|
||||||
bmp = BITMAPOBJ_HandleToPtr (hBitmap);
|
bmp = BITMAPOBJ_LockBitmap(hBitmap);
|
||||||
if (bmp == NULL)
|
if (bmp == NULL)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: brush.c,v 1.24 2003/08/19 11:48:50 weiden Exp $
|
/* $Id: brush.c,v 1.25 2003/08/20 07:45:02 gvg Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -134,15 +134,15 @@ HBRUSH STDCALL NtGdiCreateDIBPatternBrushPt(CONST VOID *PackedDIB,
|
||||||
}
|
}
|
||||||
size += DIB_BitmapInfoSize (info, Usage);
|
size += DIB_BitmapInfoSize (info, Usage);
|
||||||
|
|
||||||
logbrush.lbHatch = (LONG) GDIOBJ_AllocObj(size, GO_MAGIC_DONTCARE);
|
logbrush.lbHatch = (LONG) GDIOBJ_AllocObj(size, GDI_OBJECT_TYPE_DONTCARE, NULL);
|
||||||
if (logbrush.lbHatch == 0)
|
if (logbrush.lbHatch == 0)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
newInfo = (PBITMAPINFO) GDIOBJ_LockObj ((HGDIOBJ) logbrush.lbHatch, GO_MAGIC_DONTCARE);
|
newInfo = (PBITMAPINFO) GDIOBJ_LockObj ((HGDIOBJ) logbrush.lbHatch, GDI_OBJECT_TYPE_DONTCARE);
|
||||||
ASSERT(newInfo);
|
ASSERT(newInfo);
|
||||||
memcpy(newInfo, info, size);
|
memcpy(newInfo, info, size);
|
||||||
GDIOBJ_UnlockObj( (HGDIOBJ) logbrush.lbHatch, GO_MAGIC_DONTCARE );
|
GDIOBJ_UnlockObj((HGDIOBJ) logbrush.lbHatch, GDI_OBJECT_TYPE_DONTCARE);
|
||||||
|
|
||||||
return NtGdiCreateBrushIndirect (&logbrush);
|
return NtGdiCreateBrushIndirect (&logbrush);
|
||||||
}
|
}
|
||||||
|
@ -258,7 +258,7 @@ BOOL STDCALL NtGdiPolyPatBlt(HDC hDC,
|
||||||
int i;
|
int i;
|
||||||
PATRECT r;
|
PATRECT r;
|
||||||
PBRUSHOBJ BrushObj;
|
PBRUSHOBJ BrushObj;
|
||||||
DC *dc = DC_HandleToPtr(hDC);
|
DC *dc = DC_LockDc(hDC);
|
||||||
if (dc == NULL)
|
if (dc == NULL)
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||||
|
@ -267,12 +267,12 @@ BOOL STDCALL NtGdiPolyPatBlt(HDC hDC,
|
||||||
for (i = 0;i<cRects;i++)
|
for (i = 0;i<cRects;i++)
|
||||||
{
|
{
|
||||||
r = *pRects;
|
r = *pRects;
|
||||||
BrushObj = (BRUSHOBJ*) GDIOBJ_LockObj(r.hBrush, GO_BRUSH_MAGIC);
|
BrushObj = BRUSHOBJ_LockBrush(r.hBrush);
|
||||||
IntPatBlt(dc,r.r.left,r.r.top,r.r.right,r.r.bottom,dwRop,BrushObj);
|
IntPatBlt(dc,r.r.left,r.r.top,r.r.right,r.r.bottom,dwRop,BrushObj);
|
||||||
GDIOBJ_UnlockObj(r.hBrush , GO_BRUSH_MAGIC );
|
BRUSHOBJ_UnlockBrush(r.hBrush);
|
||||||
pRects++;
|
pRects++;
|
||||||
}
|
}
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ BOOL STDCALL NtGdiPatBlt(HDC hDC,
|
||||||
DWORD ROP)
|
DWORD ROP)
|
||||||
{
|
{
|
||||||
PBRUSHOBJ BrushObj;
|
PBRUSHOBJ BrushObj;
|
||||||
DC *dc = DC_HandleToPtr(hDC);
|
DC *dc = DC_LockDc(hDC);
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
|
||||||
if (dc == NULL)
|
if (dc == NULL)
|
||||||
|
@ -293,11 +293,11 @@ BOOL STDCALL NtGdiPatBlt(HDC hDC,
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
BrushObj = (BRUSHOBJ*) GDIOBJ_LockObj(dc->w.hBrush, GO_BRUSH_MAGIC);
|
BrushObj = BRUSHOBJ_LockBrush(dc->w.hBrush);
|
||||||
ret = IntPatBlt(dc,XLeft,YLeft,Width,Height,ROP,BrushObj);
|
ret = IntPatBlt(dc,XLeft,YLeft,Width,Height,ROP,BrushObj);
|
||||||
|
|
||||||
GDIOBJ_UnlockObj( dc->w.hBrush, GO_BRUSH_MAGIC );
|
BRUSHOBJ_UnlockBrush(dc->w.hBrush);
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: cliprgn.c,v 1.20 2003/08/19 11:48:50 weiden Exp $ */
|
/* $Id: cliprgn.c,v 1.21 2003/08/20 07:45:02 gvg Exp $ */
|
||||||
|
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
@ -88,7 +88,7 @@ HRGN WINAPI SaveVisRgn(HDC hdc)
|
||||||
{
|
{
|
||||||
HRGN copy;
|
HRGN copy;
|
||||||
PROSRGNDATA obj, copyObj;
|
PROSRGNDATA obj, copyObj;
|
||||||
PDC dc = DC_HandleToPtr(hdc);
|
PDC dc = DC_LockDc(hdc);
|
||||||
|
|
||||||
if (!dc) return 0;
|
if (!dc) return 0;
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ HRGN WINAPI SaveVisRgn(HDC hdc)
|
||||||
if(!(copy = NtGdiCreateRectRgn(0, 0, 0, 0)))
|
if(!(copy = NtGdiCreateRectRgn(0, 0, 0, 0)))
|
||||||
{
|
{
|
||||||
RGNDATA_UnlockRgn(dc->w.hVisRgn);
|
RGNDATA_UnlockRgn(dc->w.hVisRgn);
|
||||||
DC_ReleasePtr(hdc);
|
DC_UnlockDc(hdc);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
NtGdiCombineRgn(copy, dc->w.hVisRgn, 0, RGN_COPY);
|
NtGdiCombineRgn(copy, dc->w.hVisRgn, 0, RGN_COPY);
|
||||||
|
@ -116,7 +116,7 @@ NtGdiSelectVisRgn(HDC hdc, HRGN hrgn)
|
||||||
|
|
||||||
if (!hrgn)
|
if (!hrgn)
|
||||||
return ERROR;
|
return ERROR;
|
||||||
if (!(dc = DC_HandleToPtr(hdc)))
|
if (!(dc = DC_LockDc(hdc)))
|
||||||
return ERROR;
|
return ERROR;
|
||||||
|
|
||||||
dc->w.flags &= ~DC_DIRTY;
|
dc->w.flags &= ~DC_DIRTY;
|
||||||
|
@ -128,7 +128,7 @@ NtGdiSelectVisRgn(HDC hdc, HRGN hrgn)
|
||||||
|
|
||||||
retval = NtGdiCombineRgn(dc->w.hVisRgn, hrgn, 0, RGN_COPY);
|
retval = NtGdiCombineRgn(dc->w.hVisRgn, hrgn, 0, RGN_COPY);
|
||||||
CLIPPING_UpdateGCRegion(dc);
|
CLIPPING_UpdateGCRegion(dc);
|
||||||
DC_ReleasePtr( hdc );
|
DC_UnlockDc( hdc );
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ int STDCALL NtGdiGetClipBox(HDC hDC,
|
||||||
int retval;
|
int retval;
|
||||||
DC *dc;
|
DC *dc;
|
||||||
|
|
||||||
if (!(dc = DC_HandleToPtr(hDC)))
|
if (!(dc = DC_LockDc(hDC)))
|
||||||
return ERROR;
|
return ERROR;
|
||||||
retval = UnsafeIntGetRgnBox(dc->w.hGCClipRgn, rc);
|
retval = UnsafeIntGetRgnBox(dc->w.hGCClipRgn, rc);
|
||||||
rc->left -= dc->w.DCOrgX;
|
rc->left -= dc->w.DCOrgX;
|
||||||
|
@ -163,7 +163,7 @@ int STDCALL NtGdiGetClipBox(HDC hDC,
|
||||||
rc->top -= dc->w.DCOrgY;
|
rc->top -= dc->w.DCOrgY;
|
||||||
rc->bottom -= dc->w.DCOrgY;
|
rc->bottom -= dc->w.DCOrgY;
|
||||||
|
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
NtGdiDPtoLP(hDC, (LPPOINT)rc, 2);
|
NtGdiDPtoLP(hDC, (LPPOINT)rc, 2);
|
||||||
return(retval);
|
return(retval);
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ int STDCALL NtGdiSelectClipRgn(HDC hDC,
|
||||||
PDC dc;
|
PDC dc;
|
||||||
HRGN Copy;
|
HRGN Copy;
|
||||||
|
|
||||||
dc = DC_HandleToPtr(hDC);
|
dc = DC_LockDc(hDC);
|
||||||
if (NULL == dc)
|
if (NULL == dc)
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: color.c,v 1.20 2003/08/19 11:48:50 weiden Exp $ */
|
/* $Id: color.c,v 1.21 2003/08/20 07:45:02 gvg Exp $ */
|
||||||
|
|
||||||
// FIXME: Use PXLATEOBJ logicalToSystem instead of int *mapping
|
// FIXME: Use PXLATEOBJ logicalToSystem instead of int *mapping
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ COLORREF STDCALL NtGdiGetNearestColor(HDC hDC,
|
||||||
PDC dc;
|
PDC dc;
|
||||||
PPALOBJ palObj;
|
PPALOBJ palObj;
|
||||||
|
|
||||||
if( (dc = DC_HandleToPtr(hDC) ) )
|
if( (dc = DC_LockDc(hDC) ) )
|
||||||
{
|
{
|
||||||
HPALETTE hpal = (dc->w.hPalette)? dc->w.hPalette : NtGdiGetStockObject(DEFAULT_PALETTE);
|
HPALETTE hpal = (dc->w.hPalette)? dc->w.hPalette : NtGdiGetStockObject(DEFAULT_PALETTE);
|
||||||
palObj = (PPALOBJ)AccessUserObject((ULONG)hpal);
|
palObj = (PPALOBJ)AccessUserObject((ULONG)hpal);
|
||||||
|
@ -211,7 +211,7 @@ COLORREF STDCALL NtGdiGetNearestColor(HDC hDC,
|
||||||
palObj->logpalette->palNumEntries, Color);
|
palObj->logpalette->palNumEntries, Color);
|
||||||
// FIXME: release hpal!!
|
// FIXME: release hpal!!
|
||||||
// GDI_ReleaseObj( hpal );
|
// GDI_ReleaseObj( hpal );
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
}
|
}
|
||||||
|
|
||||||
return nearest;
|
return nearest;
|
||||||
|
@ -330,13 +330,13 @@ UINT STDCALL NtGdiRealizePalette(HDC hDC)
|
||||||
PSURFGDI SurfGDI;
|
PSURFGDI SurfGDI;
|
||||||
BOOLEAN success;
|
BOOLEAN success;
|
||||||
|
|
||||||
dc = DC_HandleToPtr(hDC);
|
dc = DC_LockDc(hDC);
|
||||||
if (!dc)
|
if (!dc)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
palPtr = (PPALOBJ)AccessUserObject((ULONG)dc->w.hPalette);
|
palPtr = (PPALOBJ)AccessUserObject((ULONG)dc->w.hPalette);
|
||||||
SurfGDI = (PSURFGDI)AccessInternalObjectFromUserObject(dc->Surface);
|
SurfGDI = (PSURFGDI)AccessInternalObjectFromUserObject(dc->Surface);
|
||||||
systemPalette = NtGdiGetStockObject((INT)STOCK_DEFAULT_PALETTE);
|
systemPalette = NtGdiGetStockObject((INT)DEFAULT_PALETTE);
|
||||||
sysPtr = (PPALOBJ)AccessInternalObject((ULONG)systemPalette);
|
sysPtr = (PPALOBJ)AccessInternalObject((ULONG)systemPalette);
|
||||||
palGDI = (PPALGDI)AccessInternalObject((ULONG)dc->w.hPalette);
|
palGDI = (PPALGDI)AccessInternalObject((ULONG)dc->w.hPalette);
|
||||||
sysGDI = (PPALGDI)AccessInternalObject((ULONG)systemPalette);
|
sysGDI = (PPALGDI)AccessInternalObject((ULONG)systemPalette);
|
||||||
|
@ -436,11 +436,11 @@ HPALETTE STDCALL NtGdiSelectPalette(HDC hDC,
|
||||||
HPALETTE oldPal;
|
HPALETTE oldPal;
|
||||||
|
|
||||||
// FIXME: mark the palette as a [fore\back]ground pal
|
// FIXME: mark the palette as a [fore\back]ground pal
|
||||||
dc = DC_HandleToPtr(hDC);
|
dc = DC_LockDc(hDC);
|
||||||
if( dc ){
|
if( dc ){
|
||||||
oldPal = dc->w.hPalette;
|
oldPal = dc->w.hPalette;
|
||||||
dc->w.hPalette = hpal;
|
dc->w.hPalette = hpal;
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
}
|
}
|
||||||
|
|
||||||
return oldPal;
|
return oldPal;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: coord.c,v 1.16 2003/08/19 11:48:50 weiden Exp $
|
/* $Id: coord.c,v 1.17 2003/08/20 07:45:02 gvg Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -101,7 +101,7 @@ NtGdiDPtoLP(HDC hDC,
|
||||||
ASSERT(Points);
|
ASSERT(Points);
|
||||||
MmCopyFromCaller( Points, UnsafePoints, Count*sizeof(POINT) );
|
MmCopyFromCaller( Points, UnsafePoints, Count*sizeof(POINT) );
|
||||||
|
|
||||||
Dc = DC_HandleToPtr (hDC);
|
Dc = DC_LockDc (hDC);
|
||||||
if (Dc == NULL || !Dc->w.vport2WorldValid)
|
if (Dc == NULL || !Dc->w.vport2WorldValid)
|
||||||
{
|
{
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
|
@ -111,7 +111,7 @@ NtGdiDPtoLP(HDC hDC,
|
||||||
{
|
{
|
||||||
CoordDPtoLP(Dc, &Points[i]);
|
CoordDPtoLP(Dc, &Points[i]);
|
||||||
}
|
}
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
|
|
||||||
MmCopyToCaller( UnsafePoints, Points, Count*sizeof(POINT) );
|
MmCopyToCaller( UnsafePoints, Points, Count*sizeof(POINT) );
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
|
@ -129,13 +129,13 @@ int
|
||||||
STDCALL
|
STDCALL
|
||||||
NtGdiGetGraphicsMode ( HDC hDC )
|
NtGdiGetGraphicsMode ( HDC hDC )
|
||||||
{
|
{
|
||||||
PDC dc = DC_HandleToPtr ( hDC );
|
PDC dc = DC_LockDc ( hDC );
|
||||||
int GraphicsMode = 0; // default to failure
|
int GraphicsMode = 0; // default to failure
|
||||||
|
|
||||||
if ( dc )
|
if ( dc )
|
||||||
{
|
{
|
||||||
GraphicsMode = dc->w.GraphicsMode;
|
GraphicsMode = dc->w.GraphicsMode;
|
||||||
DC_ReleasePtr ( hDC );
|
DC_UnlockDc ( hDC );
|
||||||
}
|
}
|
||||||
|
|
||||||
return GraphicsMode;
|
return GraphicsMode;
|
||||||
|
@ -148,7 +148,7 @@ NtGdiGetWorldTransform(HDC hDC,
|
||||||
{
|
{
|
||||||
PDC dc;
|
PDC dc;
|
||||||
|
|
||||||
dc = DC_HandleToPtr (hDC);
|
dc = DC_LockDc (hDC);
|
||||||
if (!dc)
|
if (!dc)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -158,7 +158,7 @@ NtGdiGetWorldTransform(HDC hDC,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
*XForm = dc->w.xformWorld2Wnd;
|
*XForm = dc->w.xformWorld2Wnd;
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ IntLPtoDP ( PDC dc, LPPOINT Points, INT Count )
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
NtGdiLPtoDP ( HDC hDC, LPPOINT UnsafePoints, INT Count )
|
NtGdiLPtoDP ( HDC hDC, LPPOINT UnsafePoints, INT Count )
|
||||||
{
|
{
|
||||||
PDC dc = DC_HandleToPtr ( hDC );
|
PDC dc = DC_LockDc ( hDC );
|
||||||
LPPOINT Points;
|
LPPOINT Points;
|
||||||
|
|
||||||
if ( !dc )
|
if ( !dc )
|
||||||
|
@ -214,7 +214,7 @@ NtGdiLPtoDP ( HDC hDC, LPPOINT UnsafePoints, INT Count )
|
||||||
|
|
||||||
ExFreePool ( Points );
|
ExFreePool ( Points );
|
||||||
|
|
||||||
DC_ReleasePtr ( hDC );
|
DC_UnlockDc ( hDC );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -232,7 +232,7 @@ NtGdiModifyWorldTransform(HDC hDC,
|
||||||
|
|
||||||
MmCopyFromCaller( XForm, UnsafeXForm, sizeof( XFORM ) );
|
MmCopyFromCaller( XForm, UnsafeXForm, sizeof( XFORM ) );
|
||||||
|
|
||||||
dc = DC_HandleToPtr (hDC);
|
dc = DC_LockDc (hDC);
|
||||||
if (!dc)
|
if (!dc)
|
||||||
{
|
{
|
||||||
// SetLastError( ERROR_INVALID_HANDLE );
|
// SetLastError( ERROR_INVALID_HANDLE );
|
||||||
|
@ -268,11 +268,11 @@ NtGdiModifyWorldTransform(HDC hDC,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
DC_UpdateXforms (dc);
|
DC_UpdateXforms (dc);
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,7 +287,7 @@ NtGdiOffsetViewportOrgEx(HDC hDC,
|
||||||
POINT Point;
|
POINT Point;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
dc = DC_HandleToPtr(hDC);
|
dc = DC_LockDc(hDC);
|
||||||
if (NULL == dc)
|
if (NULL == dc)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -324,7 +324,7 @@ NtGdiOffsetWindowOrgEx(HDC hDC,
|
||||||
{
|
{
|
||||||
PDC dc;
|
PDC dc;
|
||||||
|
|
||||||
dc = DC_HandleToPtr(hDC);
|
dc = DC_LockDc(hDC);
|
||||||
if (!dc)
|
if (!dc)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -339,7 +339,7 @@ NtGdiOffsetWindowOrgEx(HDC hDC,
|
||||||
dc->wndOrgX += XOffset;
|
dc->wndOrgX += XOffset;
|
||||||
dc->wndOrgY += YOffset;
|
dc->wndOrgY += YOffset;
|
||||||
|
|
||||||
DC_ReleasePtr(hDC);
|
DC_UnlockDc(hDC);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -376,7 +376,7 @@ NtGdiSetGraphicsMode(HDC hDC,
|
||||||
INT ret;
|
INT ret;
|
||||||
PDC dc;
|
PDC dc;
|
||||||
|
|
||||||
dc = DC_HandleToPtr (hDC);
|
dc = DC_LockDc (hDC);
|
||||||
if (!dc)
|
if (!dc)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -390,13 +390,13 @@ NtGdiSetGraphicsMode(HDC hDC,
|
||||||
|
|
||||||
if ((Mode != GM_COMPATIBLE) && (Mode != GM_ADVANCED))
|
if ((Mode != GM_COMPATIBLE) && (Mode != GM_ADVANCED))
|
||||||
{
|
{
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = dc->w.GraphicsMode;
|
ret = dc->w.GraphicsMode;
|
||||||
dc->w.GraphicsMode = Mode;
|
dc->w.GraphicsMode = Mode;
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -408,7 +408,7 @@ NtGdiSetMapMode(HDC hDC,
|
||||||
int PrevMapMode;
|
int PrevMapMode;
|
||||||
PDC dc;
|
PDC dc;
|
||||||
|
|
||||||
dc = DC_HandleToPtr(hDC);
|
dc = DC_LockDc(hDC);
|
||||||
if (!dc)
|
if (!dc)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -429,7 +429,7 @@ NtGdiSetViewportExtEx(HDC hDC,
|
||||||
{
|
{
|
||||||
PDC dc;
|
PDC dc;
|
||||||
|
|
||||||
dc = DC_HandleToPtr(hDC);
|
dc = DC_LockDc(hDC);
|
||||||
if (!dc)
|
if (!dc)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -443,7 +443,7 @@ NtGdiSetViewportExtEx(HDC hDC,
|
||||||
case MM_LOMETRIC:
|
case MM_LOMETRIC:
|
||||||
case MM_TEXT:
|
case MM_TEXT:
|
||||||
case MM_TWIPS:
|
case MM_TWIPS:
|
||||||
DC_ReleasePtr(hDC);
|
DC_UnlockDc(hDC);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
case MM_ISOTROPIC:
|
case MM_ISOTROPIC:
|
||||||
|
@ -461,7 +461,7 @@ NtGdiSetViewportExtEx(HDC hDC,
|
||||||
dc->vportExtX = XExtent;
|
dc->vportExtX = XExtent;
|
||||||
dc->vportExtY = YExtent;
|
dc->vportExtY = YExtent;
|
||||||
|
|
||||||
DC_ReleasePtr(hDC);
|
DC_UnlockDc(hDC);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -475,7 +475,7 @@ NtGdiSetViewportOrgEx(HDC hDC,
|
||||||
{
|
{
|
||||||
PDC dc;
|
PDC dc;
|
||||||
|
|
||||||
dc = DC_HandleToPtr(hDC);
|
dc = DC_LockDc(hDC);
|
||||||
if (!dc)
|
if (!dc)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -490,7 +490,7 @@ NtGdiSetViewportOrgEx(HDC hDC,
|
||||||
dc->vportOrgX = X;
|
dc->vportOrgX = X;
|
||||||
dc->vportOrgY = Y;
|
dc->vportOrgY = Y;
|
||||||
|
|
||||||
DC_ReleasePtr(hDC);
|
DC_UnlockDc(hDC);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -504,7 +504,7 @@ NtGdiSetWindowExtEx(HDC hDC,
|
||||||
{
|
{
|
||||||
PDC dc;
|
PDC dc;
|
||||||
|
|
||||||
dc = DC_HandleToPtr(hDC);
|
dc = DC_LockDc(hDC);
|
||||||
if (!dc)
|
if (!dc)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -518,7 +518,7 @@ NtGdiSetWindowExtEx(HDC hDC,
|
||||||
case MM_LOMETRIC:
|
case MM_LOMETRIC:
|
||||||
case MM_TEXT:
|
case MM_TEXT:
|
||||||
case MM_TWIPS:
|
case MM_TWIPS:
|
||||||
DC_ReleasePtr(hDC);
|
DC_UnlockDc(hDC);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -531,7 +531,7 @@ NtGdiSetWindowExtEx(HDC hDC,
|
||||||
dc->wndExtX = XExtent;
|
dc->wndExtX = XExtent;
|
||||||
dc->wndExtY = YExtent;
|
dc->wndExtY = YExtent;
|
||||||
|
|
||||||
DC_ReleasePtr(hDC);
|
DC_UnlockDc(hDC);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -545,7 +545,7 @@ NtGdiSetWindowOrgEx(HDC hDC,
|
||||||
{
|
{
|
||||||
PDC dc;
|
PDC dc;
|
||||||
|
|
||||||
dc = DC_HandleToPtr(hDC);
|
dc = DC_LockDc(hDC);
|
||||||
if (!dc)
|
if (!dc)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -560,7 +560,7 @@ NtGdiSetWindowOrgEx(HDC hDC,
|
||||||
dc->wndOrgX = X;
|
dc->wndOrgX = X;
|
||||||
dc->wndOrgY = Y;
|
dc->wndOrgY = Y;
|
||||||
|
|
||||||
DC_ReleasePtr(hDC);
|
DC_UnlockDc(hDC);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -572,26 +572,26 @@ NtGdiSetWorldTransform(HDC hDC,
|
||||||
{
|
{
|
||||||
PDC dc;
|
PDC dc;
|
||||||
|
|
||||||
dc = DC_HandleToPtr (hDC);
|
dc = DC_LockDc (hDC);
|
||||||
if (!dc)
|
if (!dc)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!XForm)
|
if (!XForm)
|
||||||
{
|
{
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check that graphics mode is GM_ADVANCED */
|
/* Check that graphics mode is GM_ADVANCED */
|
||||||
if (dc->w.GraphicsMode != GM_ADVANCED)
|
if (dc->w.GraphicsMode != GM_ADVANCED)
|
||||||
{
|
{
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
dc->w.xformWorld2Wnd = *XForm;
|
dc->w.xformWorld2Wnd = *XForm;
|
||||||
DC_UpdateXforms (dc);
|
DC_UpdateXforms (dc);
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <win32k/debug1.h>
|
#include <win32k/debug1.h>
|
||||||
|
|
||||||
BOOL IconCursor_InternalDelete( PICONCURSOROBJ pIconCursor )
|
BOOL FASTCALL IconCursor_InternalDelete( PICONCURSOROBJ pIconCursor )
|
||||||
{
|
{
|
||||||
ASSERT( pIconCursor );
|
ASSERT( pIconCursor );
|
||||||
if( pIconCursor->ANDBitmap.bmBits )
|
if( pIconCursor->ANDBitmap.bmBits )
|
||||||
|
@ -52,7 +52,7 @@ HICON STDCALL NtGdiCreateIcon(BOOL fIcon,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
icon = ICONCURSOROBJ_HandleToPtr(hIcon);
|
icon = ICONCURSOROBJ_LockIconCursor(hIcon);
|
||||||
|
|
||||||
/* Set up the basic icon stuff */
|
/* Set up the basic icon stuff */
|
||||||
icon->fIcon = TRUE;
|
icon->fIcon = TRUE;
|
||||||
|
@ -92,7 +92,7 @@ HICON STDCALL NtGdiCreateIcon(BOOL fIcon,
|
||||||
memcpy(icon->XORBitmap.bmBits, (PVOID)XORBits, Height * icon->XORBitmap.bmWidthBytes);
|
memcpy(icon->XORBitmap.bmBits, (PVOID)XORBits, Height * icon->XORBitmap.bmWidthBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
ICONCURSOROBJ_ReleasePtr( hIcon );
|
ICONCURSOROBJ_UnlockIconCursor( hIcon );
|
||||||
|
|
||||||
return hIcon;
|
return hIcon;
|
||||||
}
|
}
|
||||||
|
@ -109,11 +109,11 @@ NtUserGetIconInfo(
|
||||||
{
|
{
|
||||||
PICONCURSOROBJ icon;
|
PICONCURSOROBJ icon;
|
||||||
|
|
||||||
icon = ICONCURSOROBJ_HandleToPtr(hIcon);
|
icon = ICONCURSOROBJ_LockIconCursor(hIcon);
|
||||||
|
|
||||||
if (!icon)
|
if (!icon)
|
||||||
{
|
{
|
||||||
DbgPrint("NtUserGetIconInfo: ICONCURSOROBJ_HandleToPtr() returned 0\n");
|
DPRINT1("NtUserGetIconInfo: ICONCURSOROBJ_LockIconCursor() returned 0\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ NtUserGetIconInfo(
|
||||||
icon->XORBitmap.bmBitsPixel,
|
icon->XORBitmap.bmBitsPixel,
|
||||||
icon->XORBitmap.bmBits);
|
icon->XORBitmap.bmBits);
|
||||||
|
|
||||||
ICONCURSOROBJ_ReleasePtr(hIcon);
|
ICONCURSOROBJ_UnlockIconCursor(hIcon);
|
||||||
|
|
||||||
if (!*hbmMask || !*hbmColor)
|
if (!*hbmMask || !*hbmColor)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: dc.c,v 1.72 2003/08/19 11:48:50 weiden Exp $
|
/* $Id: dc.c,v 1.73 2003/08/20 07:45:02 gvg Exp $
|
||||||
*
|
*
|
||||||
* DC.C - Device context functions
|
* DC.C - Device context functions
|
||||||
*
|
*
|
||||||
|
@ -28,6 +28,7 @@
|
||||||
#include <ddk/ntddvid.h>
|
#include <ddk/ntddvid.h>
|
||||||
|
|
||||||
#include <win32k/bitmaps.h>
|
#include <win32k/bitmaps.h>
|
||||||
|
#include <win32k/brush.h>
|
||||||
#include <win32k/cliprgn.h>
|
#include <win32k/cliprgn.h>
|
||||||
#include <win32k/coord.h>
|
#include <win32k/coord.h>
|
||||||
#include <win32k/driver.h>
|
#include <win32k/driver.h>
|
||||||
|
@ -60,13 +61,13 @@ static BOOL PrimarySurfaceCreated = FALSE;
|
||||||
func_type STDCALL func_name( HDC hdc ) \
|
func_type STDCALL func_name( HDC hdc ) \
|
||||||
{ \
|
{ \
|
||||||
func_type ft; \
|
func_type ft; \
|
||||||
PDC dc = DC_HandleToPtr( hdc ); \
|
PDC dc = DC_LockDc( hdc ); \
|
||||||
if (!dc) \
|
if (!dc) \
|
||||||
{ \
|
{ \
|
||||||
return 0; \
|
return 0; \
|
||||||
} \
|
} \
|
||||||
ft = dc->dc_field; \
|
ft = dc->dc_field; \
|
||||||
DC_ReleasePtr( hdc ); \
|
DC_UnlockDc( hdc ); \
|
||||||
return ft; \
|
return ft; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,11 +85,11 @@ VOID FASTCALL IntFuncName ( PDC dc, LP##type pt ) \
|
||||||
} \
|
} \
|
||||||
BOOL STDCALL NtGdiFuncName ( HDC hdc, LP##type pt ) \
|
BOOL STDCALL NtGdiFuncName ( HDC hdc, LP##type pt ) \
|
||||||
{ \
|
{ \
|
||||||
PDC dc = DC_HandleToPtr ( hdc ); \
|
PDC dc = DC_LockDc ( hdc ); \
|
||||||
if ( !dc ) \
|
if ( !dc ) \
|
||||||
return FALSE; \
|
return FALSE; \
|
||||||
IntFuncName ( dc, pt ); \
|
IntFuncName ( dc, pt ); \
|
||||||
DC_ReleasePtr ( hdc ); \
|
DC_UnlockDc ( hdc ); \
|
||||||
return TRUE; \
|
return TRUE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,12 +100,12 @@ INT STDCALL func_name( HDC hdc, INT mode ) \
|
||||||
PDC dc; \
|
PDC dc; \
|
||||||
if ((mode < min_val) || (mode > max_val)) \
|
if ((mode < min_val) || (mode > max_val)) \
|
||||||
return 0; \
|
return 0; \
|
||||||
dc = DC_HandleToPtr ( hdc ); \
|
dc = DC_LockDc ( hdc ); \
|
||||||
if ( !dc ) \
|
if ( !dc ) \
|
||||||
return 0; \
|
return 0; \
|
||||||
prevMode = dc->dc_field; \
|
prevMode = dc->dc_field; \
|
||||||
dc->dc_field = mode; \
|
dc->dc_field = mode; \
|
||||||
DC_ReleasePtr ( hdc ); \
|
DC_UnlockDc ( hdc ); \
|
||||||
return prevMode; \
|
return prevMode; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,19 +131,19 @@ NtGdiCreateCompatableDC(HDC hDC)
|
||||||
HDC hNewDC;
|
HDC hNewDC;
|
||||||
HRGN hVisRgn;
|
HRGN hVisRgn;
|
||||||
|
|
||||||
OrigDC = DC_HandleToPtr(hDC);
|
OrigDC = DC_LockDc(hDC);
|
||||||
if (OrigDC == NULL)
|
if (OrigDC == NULL)
|
||||||
{
|
{
|
||||||
hNewDC = DC_AllocDC(L"DISPLAY");
|
hNewDC = DC_AllocDC(L"DISPLAY");
|
||||||
if( hNewDC )
|
if( hNewDC )
|
||||||
NewDC = DC_HandleToPtr( hNewDC );
|
NewDC = DC_LockDc( hNewDC );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Allocate a new DC based on the original DC's device */
|
/* Allocate a new DC based on the original DC's device */
|
||||||
hNewDC = DC_AllocDC(OrigDC->DriverName);
|
hNewDC = DC_AllocDC(OrigDC->DriverName);
|
||||||
if( hNewDC )
|
if( hNewDC )
|
||||||
NewDC = DC_HandleToPtr( hNewDC );
|
NewDC = DC_LockDc( hNewDC );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NewDC == NULL)
|
if (NewDC == NULL)
|
||||||
|
@ -189,7 +190,7 @@ NtGdiCreateCompatableDC(HDC hDC)
|
||||||
/* Create default bitmap */
|
/* Create default bitmap */
|
||||||
if (!(hBitmap = NtGdiCreateBitmap( 1, 1, 1, 1, NULL )))
|
if (!(hBitmap = NtGdiCreateBitmap( 1, 1, 1, 1, NULL )))
|
||||||
{
|
{
|
||||||
DC_ReleasePtr( hNewDC );
|
DC_UnlockDc( hNewDC );
|
||||||
DC_FreeDC( hNewDC );
|
DC_FreeDC( hNewDC );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -197,7 +198,7 @@ NtGdiCreateCompatableDC(HDC hDC)
|
||||||
NewDC->w.bitsPerPixel = 1;
|
NewDC->w.bitsPerPixel = 1;
|
||||||
NewDC->w.hBitmap = hBitmap;
|
NewDC->w.hBitmap = hBitmap;
|
||||||
NewDC->w.hFirstBitmap = hBitmap;
|
NewDC->w.hFirstBitmap = hBitmap;
|
||||||
NewDC->Surface = BitmapToSurf(BITMAPOBJ_HandleToPtr(hBitmap));
|
NewDC->Surface = BitmapToSurf(BITMAPOBJ_LockBitmap(hBitmap));
|
||||||
|
|
||||||
if(OrigDC != NULL)
|
if(OrigDC != NULL)
|
||||||
{
|
{
|
||||||
|
@ -205,8 +206,8 @@ NtGdiCreateCompatableDC(HDC hDC)
|
||||||
NewDC->w.textColor = OrigDC->w.textColor;
|
NewDC->w.textColor = OrigDC->w.textColor;
|
||||||
NewDC->w.textAlign = OrigDC->w.textAlign;
|
NewDC->w.textAlign = OrigDC->w.textAlign;
|
||||||
}
|
}
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
DC_ReleasePtr( hNewDC );
|
DC_UnlockDc( hNewDC );
|
||||||
|
|
||||||
hVisRgn = NtGdiCreateRectRgn(0, 0, 1, 1);
|
hVisRgn = NtGdiCreateRectRgn(0, 0, 1, 1);
|
||||||
NtGdiSelectVisRgn(hNewDC, hVisRgn);
|
NtGdiSelectVisRgn(hNewDC, hVisRgn);
|
||||||
|
@ -429,7 +430,7 @@ NtGdiCreateDC(LPCWSTR Driver,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
NewDC = DC_HandleToPtr( hNewDC );
|
NewDC = DC_LockDc( hNewDC );
|
||||||
ASSERT( NewDC );
|
ASSERT( NewDC );
|
||||||
|
|
||||||
if (! PrimarySurfaceCreated)
|
if (! PrimarySurfaceCreated)
|
||||||
|
@ -438,7 +439,7 @@ NtGdiCreateDC(LPCWSTR Driver,
|
||||||
if (!NtGdiCreatePrimarySurface(Driver, Device))
|
if (!NtGdiCreatePrimarySurface(Driver, Device))
|
||||||
{
|
{
|
||||||
PrimarySurfaceCreated = FALSE;
|
PrimarySurfaceCreated = FALSE;
|
||||||
DC_ReleasePtr( hNewDC );
|
DC_UnlockDc( hNewDC );
|
||||||
DC_FreeDC(hNewDC);
|
DC_FreeDC(hNewDC);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -471,7 +472,7 @@ NtGdiCreateDC(LPCWSTR Driver,
|
||||||
|
|
||||||
DPRINT("Bits per pel: %u\n", NewDC->w.bitsPerPixel);
|
DPRINT("Bits per pel: %u\n", NewDC->w.bitsPerPixel);
|
||||||
|
|
||||||
DC_ReleasePtr( hNewDC );
|
DC_UnlockDc( hNewDC );
|
||||||
|
|
||||||
hVisRgn = NtGdiCreateRectRgn(0, 0, SurfGDI->SurfObj.sizlBitmap.cx,
|
hVisRgn = NtGdiCreateRectRgn(0, 0, SurfGDI->SurfObj.sizlBitmap.cx,
|
||||||
SurfGDI->SurfObj.sizlBitmap.cy);
|
SurfGDI->SurfObj.sizlBitmap.cy);
|
||||||
|
@ -501,7 +502,7 @@ NtGdiDeleteDC(HDC DCHandle)
|
||||||
{
|
{
|
||||||
PDC DCToDelete;
|
PDC DCToDelete;
|
||||||
|
|
||||||
DCToDelete = DC_HandleToPtr(DCHandle);
|
DCToDelete = DC_LockDc(DCHandle);
|
||||||
if (DCToDelete == NULL)
|
if (DCToDelete == NULL)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -541,14 +542,14 @@ NtGdiDeleteDC(HDC DCHandle)
|
||||||
HDC savedHDC;
|
HDC savedHDC;
|
||||||
|
|
||||||
savedHDC = DC_GetNextDC (DCToDelete);
|
savedHDC = DC_GetNextDC (DCToDelete);
|
||||||
savedDC = DC_HandleToPtr (savedHDC);
|
savedDC = DC_LockDc (savedHDC);
|
||||||
if (savedDC == NULL)
|
if (savedDC == NULL)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DC_SetNextDC (DCToDelete, DC_GetNextDC (savedDC));
|
DC_SetNextDC (DCToDelete, DC_GetNextDC (savedDC));
|
||||||
DCToDelete->saveLevel--;
|
DCToDelete->saveLevel--;
|
||||||
DC_ReleasePtr( savedHDC );
|
DC_UnlockDc( savedHDC );
|
||||||
NtGdiDeleteDC (savedHDC);
|
NtGdiDeleteDC (savedHDC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -562,7 +563,7 @@ NtGdiDeleteDC(HDC DCHandle)
|
||||||
DC_LockDC (DCHandle); NtGdiSelectObject does not recognize stock objects yet */
|
DC_LockDC (DCHandle); NtGdiSelectObject does not recognize stock objects yet */
|
||||||
if ( DCToDelete->w.hBitmap != NULL )
|
if ( DCToDelete->w.hBitmap != NULL )
|
||||||
{
|
{
|
||||||
BITMAPOBJ_ReleasePtr(DCToDelete->w.hBitmap);
|
BITMAPOBJ_UnlockBitmap(DCToDelete->w.hBitmap);
|
||||||
}
|
}
|
||||||
if (DCToDelete->w.flags & DC_MEMORY)
|
if (DCToDelete->w.flags & DC_MEMORY)
|
||||||
{
|
{
|
||||||
|
@ -589,7 +590,7 @@ NtGdiDeleteDC(HDC DCHandle)
|
||||||
#if 0 /* FIXME */
|
#if 0 /* FIXME */
|
||||||
PATH_DestroyGdiPath (&DCToDelete->w.path);
|
PATH_DestroyGdiPath (&DCToDelete->w.path);
|
||||||
#endif
|
#endif
|
||||||
DC_ReleasePtr( DCHandle );
|
DC_UnlockDc( DCHandle );
|
||||||
DC_FreeDC ( DCHandle );
|
DC_FreeDC ( DCHandle );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -635,7 +636,7 @@ NtGdiGetDCOrgEx(HDC hDC, LPPOINT Point)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
dc = DC_HandleToPtr(hDC);
|
dc = DC_LockDc(hDC);
|
||||||
if (dc == NULL)
|
if (dc == NULL)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -645,7 +646,7 @@ NtGdiGetDCOrgEx(HDC hDC, LPPOINT Point)
|
||||||
|
|
||||||
Point->x += dc->w.DCOrgX;
|
Point->x += dc->w.DCOrgX;
|
||||||
Point->y += dc->w.DCOrgY;
|
Point->y += dc->w.DCOrgY;
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -655,7 +656,7 @@ NtGdiGetDCState16(HDC hDC)
|
||||||
PDC newdc, dc;
|
PDC newdc, dc;
|
||||||
HDC hnewdc;
|
HDC hnewdc;
|
||||||
|
|
||||||
dc = DC_HandleToPtr(hDC);
|
dc = DC_LockDc(hDC);
|
||||||
if (dc == NULL)
|
if (dc == NULL)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -664,10 +665,10 @@ NtGdiGetDCState16(HDC hDC)
|
||||||
hnewdc = DC_AllocDC(NULL);
|
hnewdc = DC_AllocDC(NULL);
|
||||||
if (hnewdc == NULL)
|
if (hnewdc == NULL)
|
||||||
{
|
{
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
newdc = DC_HandleToPtr( hnewdc );
|
newdc = DC_LockDc( hnewdc );
|
||||||
ASSERT( newdc );
|
ASSERT( newdc );
|
||||||
|
|
||||||
newdc->w.flags = dc->w.flags | DC_SAVED;
|
newdc->w.flags = dc->w.flags | DC_SAVED;
|
||||||
|
@ -743,7 +744,7 @@ NtGdiGetDCState16(HDC hDC)
|
||||||
{
|
{
|
||||||
newdc->w.hClipRgn = 0;
|
newdc->w.hClipRgn = 0;
|
||||||
}
|
}
|
||||||
DC_ReleasePtr( hnewdc );
|
DC_UnlockDc( hnewdc );
|
||||||
return hnewdc;
|
return hnewdc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -755,7 +756,7 @@ NtGdiGetDeviceCaps(HDC hDC,
|
||||||
INT ret;
|
INT ret;
|
||||||
POINT pt;
|
POINT pt;
|
||||||
|
|
||||||
dc = DC_HandleToPtr(hDC);
|
dc = DC_LockDc(hDC);
|
||||||
if (dc == NULL)
|
if (dc == NULL)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -949,7 +950,7 @@ NtGdiGetDeviceCaps(HDC hDC,
|
||||||
|
|
||||||
DPRINT("(%04x,%d): returning %d\n", hDC, Index, ret);
|
DPRINT("(%04x,%d): returning %d\n", hDC, Index, ret);
|
||||||
|
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -961,27 +962,27 @@ NtGdiGetObjectA(HANDLE handle, INT count, LPVOID buffer)
|
||||||
{
|
{
|
||||||
PGDIOBJ gdiObject;
|
PGDIOBJ gdiObject;
|
||||||
INT result = 0;
|
INT result = 0;
|
||||||
WORD magic;
|
DWORD objectType;
|
||||||
|
|
||||||
if (!count)
|
if (!count)
|
||||||
return 0;
|
return 0;
|
||||||
gdiObject = GDIOBJ_LockObj (handle, GO_MAGIC_DONTCARE);
|
gdiObject = GDIOBJ_LockObj (handle, GDI_OBJECT_TYPE_DONTCARE);
|
||||||
if (gdiObject == 0)
|
if (gdiObject == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
magic = GDIOBJ_GetHandleMagic (handle);
|
objectType = GDIOBJ_GetObjectType(handle);
|
||||||
switch(magic)
|
switch(objectType)
|
||||||
{
|
{
|
||||||
/* case GO_PEN_MAGIC:
|
/* case GDI_OBJECT_TYPE_PEN:
|
||||||
result = PEN_GetObject((PENOBJ *)gdiObject, count, buffer);
|
result = PEN_GetObject((PENOBJ *)gdiObject, count, buffer);
|
||||||
break;
|
break;
|
||||||
case GO_BRUSH_MAGIC:
|
case GDI_OBJECT_TYPE_BRUSH:
|
||||||
result = BRUSH_GetObject((BRUSHOBJ *)gdiObject, count, buffer);
|
result = BRUSH_GetObject((BRUSHOBJ *)gdiObject, count, buffer);
|
||||||
break; */
|
break; */
|
||||||
case GO_BITMAP_MAGIC:
|
case GDI_OBJECT_TYPE_BITMAP:
|
||||||
result = BITMAP_GetObject((BITMAPOBJ *)gdiObject, count, buffer);
|
result = BITMAP_GetObject((BITMAPOBJ *)gdiObject, count, buffer);
|
||||||
break;
|
break;
|
||||||
/* case GO_FONT_MAGIC:
|
/* case GDI_OBJECT_TYPE_FONT:
|
||||||
result = FONT_GetObjectA((FONTOBJ *)gdiObject, count, buffer);
|
result = FONT_GetObjectA((FONTOBJ *)gdiObject, count, buffer);
|
||||||
|
|
||||||
// FIXME: Fix the LOGFONT structure for the stock fonts
|
// FIXME: Fix the LOGFONT structure for the stock fonts
|
||||||
|
@ -989,27 +990,26 @@ NtGdiGetObjectA(HANDLE handle, INT count, LPVOID buffer)
|
||||||
if ( (handle >= FIRST_STOCK_HANDLE) && (handle <= LAST_STOCK_HANDLE) )
|
if ( (handle >= FIRST_STOCK_HANDLE) && (handle <= LAST_STOCK_HANDLE) )
|
||||||
FixStockFontSizeA(handle, count, buffer);
|
FixStockFontSizeA(handle, count, buffer);
|
||||||
break;
|
break;
|
||||||
case GO_PALETTE_MAGIC:
|
case GDI_OBJECT_TYPE_PALETTE:
|
||||||
result = PALETTE_GetObject((PALETTEOBJ *)gdiObject, count, buffer);
|
result = PALETTE_GetObject((PALETTEOBJ *)gdiObject, count, buffer);
|
||||||
break; */
|
break; */
|
||||||
|
|
||||||
case GO_REGION_MAGIC:
|
case GDI_OBJECT_TYPE_REGION:
|
||||||
case GO_DC_MAGIC:
|
case GDI_OBJECT_TYPE_DC:
|
||||||
case GO_DISABLED_DC_MAGIC:
|
case GDI_OBJECT_TYPE_METADC:
|
||||||
case GO_META_DC_MAGIC:
|
case GDI_OBJECT_TYPE_METAFILE:
|
||||||
case GO_METAFILE_MAGIC:
|
case GDI_OBJECT_TYPE_ENHMETADC:
|
||||||
case GO_METAFILE_DC_MAGIC:
|
case GDI_OBJECT_TYPE_EMF:
|
||||||
case GO_ENHMETAFILE_MAGIC:
|
DPRINT1("GDI object type 0x%08x not implemented\n", objectType);
|
||||||
case GO_ENHMETAFILE_DC_MAGIC:
|
|
||||||
// FIXME("Magic %04x not implemented\n", magic);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DbgPrint("Invalid GDI Magic %04x\n", magic);
|
DPRINT1("Invalid GDI object type 0x%08x\n", objectType);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
GDIOBJ_UnlockObj (handle, GO_MAGIC_DONTCARE);
|
GDIOBJ_UnlockObj(handle, GDI_OBJECT_TYPE_DONTCARE);
|
||||||
return result;
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT STDCALL
|
INT STDCALL
|
||||||
|
@ -1017,27 +1017,27 @@ NtGdiGetObjectW(HANDLE handle, INT count, LPVOID buffer)
|
||||||
{
|
{
|
||||||
PGDIOBJHDR gdiObject;
|
PGDIOBJHDR gdiObject;
|
||||||
INT result = 0;
|
INT result = 0;
|
||||||
WORD magic;
|
DWORD objectType;
|
||||||
|
|
||||||
if (!count)
|
if (!count)
|
||||||
return 0;
|
return 0;
|
||||||
gdiObject = GDIOBJ_LockObj(handle, GO_MAGIC_DONTCARE);
|
gdiObject = GDIOBJ_LockObj(handle, GDI_OBJECT_TYPE_DONTCARE);
|
||||||
if (gdiObject == 0)
|
if (gdiObject == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
magic = GDIOBJ_GetHandleMagic (handle);
|
objectType = GDIOBJ_GetObjectType(handle);
|
||||||
switch(magic)
|
switch(objectType)
|
||||||
{
|
{
|
||||||
/* case GO_PEN_MAGIC:
|
/* case GDI_OBJECT_TYPE_PEN:
|
||||||
result = PEN_GetObject((PENOBJ *)gdiObject, count, buffer);
|
result = PEN_GetObject((PENOBJ *)gdiObject, count, buffer);
|
||||||
break;
|
break;
|
||||||
case GO_BRUSH_MAGIC:
|
case GDI_OBJECT_TYPE_BRUSH:
|
||||||
result = BRUSH_GetObject((BRUSHOBJ *)gdiObject, count, buffer);
|
result = BRUSH_GetObject((BRUSHOBJ *)gdiObject, count, buffer);
|
||||||
break; */
|
break; */
|
||||||
case GO_BITMAP_MAGIC:
|
case GDI_OBJECT_TYPE_BITMAP:
|
||||||
result = BITMAP_GetObject((BITMAPOBJ *)gdiObject, count, buffer);
|
result = BITMAP_GetObject((BITMAPOBJ *)gdiObject, count, buffer);
|
||||||
break;
|
break;
|
||||||
/* case GO_FONT_MAGIC:
|
/* case GDI_OBJECT_TYPE_FONT:
|
||||||
result = FONT_GetObjectW((FONTOBJ *)gdiObject, count, buffer);
|
result = FONT_GetObjectW((FONTOBJ *)gdiObject, count, buffer);
|
||||||
|
|
||||||
// Fix the LOGFONT structure for the stock fonts
|
// Fix the LOGFONT structure for the stock fonts
|
||||||
|
@ -1045,15 +1045,17 @@ NtGdiGetObjectW(HANDLE handle, INT count, LPVOID buffer)
|
||||||
if ( (handle >= FIRST_STOCK_HANDLE) && (handle <= LAST_STOCK_HANDLE) )
|
if ( (handle >= FIRST_STOCK_HANDLE) && (handle <= LAST_STOCK_HANDLE) )
|
||||||
FixStockFontSizeW(handle, count, buffer);
|
FixStockFontSizeW(handle, count, buffer);
|
||||||
break;
|
break;
|
||||||
case GO_PALETTE_MAGIC:
|
case GDI_OBJECT_TYPE_PALETTE:
|
||||||
result = PALETTE_GetObject((PALETTEOBJ *)gdiObject, count, buffer);
|
result = PALETTE_GetObject((PALETTEOBJ *)gdiObject, count, buffer);
|
||||||
break; */
|
break; */
|
||||||
default:
|
default:
|
||||||
// FIXME("Magic %04x not implemented\n", gdiObject->magic);
|
DPRINT1("GDI object type 0x%08x not implemented\n", objectType);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
GDIOBJ_UnlockObj(handle, GO_MAGIC_DONTCARE);
|
|
||||||
return result;
|
GDIOBJ_UnlockObj(handle, GDI_OBJECT_TYPE_DONTCARE);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT STDCALL
|
INT STDCALL
|
||||||
|
@ -1067,56 +1069,59 @@ NtGdiGetObjectType(HANDLE handle)
|
||||||
{
|
{
|
||||||
GDIOBJHDR * ptr;
|
GDIOBJHDR * ptr;
|
||||||
INT result = 0;
|
INT result = 0;
|
||||||
WORD magic;
|
DWORD objectType;
|
||||||
|
|
||||||
ptr = GDIOBJ_LockObj(handle, GO_MAGIC_DONTCARE);
|
ptr = GDIOBJ_LockObj(handle, GDI_OBJECT_TYPE_DONTCARE);
|
||||||
if (ptr == 0)
|
if (ptr == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
magic = GDIOBJ_GetHandleMagic (handle);
|
objectType = GDIOBJ_GetObjectType(handle);
|
||||||
switch(magic)
|
switch(objectType)
|
||||||
{
|
{
|
||||||
case GO_PEN_MAGIC:
|
case GDI_OBJECT_TYPE_PEN:
|
||||||
result = OBJ_PEN;
|
result = OBJ_PEN;
|
||||||
break;
|
break;
|
||||||
case GO_BRUSH_MAGIC:
|
case GDI_OBJECT_TYPE_BRUSH:
|
||||||
result = OBJ_BRUSH;
|
result = OBJ_BRUSH;
|
||||||
break;
|
break;
|
||||||
case GO_BITMAP_MAGIC:
|
case GDI_OBJECT_TYPE_BITMAP:
|
||||||
result = OBJ_BITMAP;
|
result = OBJ_BITMAP;
|
||||||
break;
|
break;
|
||||||
case GO_FONT_MAGIC:
|
case GDI_OBJECT_TYPE_FONT:
|
||||||
result = OBJ_FONT;
|
result = OBJ_FONT;
|
||||||
break;
|
break;
|
||||||
case GO_PALETTE_MAGIC:
|
case GDI_OBJECT_TYPE_PALETTE:
|
||||||
result = OBJ_PAL;
|
result = OBJ_PAL;
|
||||||
break;
|
break;
|
||||||
case GO_REGION_MAGIC:
|
case GDI_OBJECT_TYPE_REGION:
|
||||||
result = OBJ_REGION;
|
result = OBJ_REGION;
|
||||||
break;
|
break;
|
||||||
case GO_DC_MAGIC:
|
case GDI_OBJECT_TYPE_DC:
|
||||||
result = OBJ_DC;
|
result = OBJ_DC;
|
||||||
break;
|
break;
|
||||||
case GO_META_DC_MAGIC:
|
case GDI_OBJECT_TYPE_METADC:
|
||||||
result = OBJ_METADC;
|
result = OBJ_METADC;
|
||||||
break;
|
break;
|
||||||
case GO_METAFILE_MAGIC:
|
case GDI_OBJECT_TYPE_METAFILE:
|
||||||
result = OBJ_METAFILE;
|
result = OBJ_METAFILE;
|
||||||
break;
|
break;
|
||||||
case GO_METAFILE_DC_MAGIC:
|
case GDI_OBJECT_TYPE_ENHMETAFILE:
|
||||||
result = OBJ_METADC;
|
|
||||||
break;
|
|
||||||
case GO_ENHMETAFILE_MAGIC:
|
|
||||||
result = OBJ_ENHMETAFILE;
|
result = OBJ_ENHMETAFILE;
|
||||||
break;
|
break;
|
||||||
case GO_ENHMETAFILE_DC_MAGIC:
|
case GDI_OBJECT_TYPE_ENHMETADC:
|
||||||
result = OBJ_ENHMETADC;
|
result = OBJ_ENHMETADC;
|
||||||
break;
|
break;
|
||||||
|
case GDI_OBJECT_TYPE_EXTPEN:
|
||||||
|
result = OBJ_EXTPEN;
|
||||||
|
break;
|
||||||
|
case GDI_OBJECT_TYPE_MEMDC:
|
||||||
|
result = OBJ_MEMDC;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// FIXME("Magic %04x not implemented\n", magic);
|
DPRINT1("Magic 0x%08x not implemented\n", objectType);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
GDIOBJ_UnlockObj(handle, GO_MAGIC_DONTCARE);
|
GDIOBJ_UnlockObj(handle, GDI_OBJECT_TYPE_DONTCARE);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1142,7 +1147,7 @@ NtGdiRestoreDC(HDC hDC, INT SaveLevel)
|
||||||
PDC dc, dcs;
|
PDC dc, dcs;
|
||||||
BOOL success;
|
BOOL success;
|
||||||
|
|
||||||
dc = DC_HandleToPtr(hDC);
|
dc = DC_LockDc(hDC);
|
||||||
if(!dc)
|
if(!dc)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1163,7 +1168,7 @@ NtGdiRestoreDC(HDC hDC, INT SaveLevel)
|
||||||
{
|
{
|
||||||
HDC hdcs = DC_GetNextDC (dc);
|
HDC hdcs = DC_GetNextDC (dc);
|
||||||
|
|
||||||
dcs = DC_HandleToPtr (hdcs);
|
dcs = DC_LockDc (hdcs);
|
||||||
if (dcs == NULL)
|
if (dcs == NULL)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1181,10 +1186,10 @@ NtGdiRestoreDC(HDC hDC, INT SaveLevel)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
DC_ReleasePtr( hdcs );
|
DC_UnlockDc( hdcs );
|
||||||
NtGdiDeleteDC (hdcs);
|
NtGdiDeleteDC (hdcs);
|
||||||
}
|
}
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1195,7 +1200,7 @@ NtGdiSaveDC(HDC hDC)
|
||||||
PDC dc, dcs;
|
PDC dc, dcs;
|
||||||
INT ret;
|
INT ret;
|
||||||
|
|
||||||
dc = DC_HandleToPtr (hDC);
|
dc = DC_LockDc (hDC);
|
||||||
if (dc == NULL)
|
if (dc == NULL)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1205,7 +1210,7 @@ NtGdiSaveDC(HDC hDC)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
dcs = DC_HandleToPtr (hdcs);
|
dcs = DC_LockDc (hdcs);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* Copy path. The reason why path saving / restoring is in SaveDC/
|
/* Copy path. The reason why path saving / restoring is in SaveDC/
|
||||||
|
@ -1224,8 +1229,8 @@ NtGdiSaveDC(HDC hDC)
|
||||||
DC_SetNextDC (dcs, DC_GetNextDC (dc));
|
DC_SetNextDC (dcs, DC_GetNextDC (dc));
|
||||||
DC_SetNextDC (dc, hdcs);
|
DC_SetNextDC (dc, hdcs);
|
||||||
ret = ++dc->saveLevel;
|
ret = ++dc->saveLevel;
|
||||||
DC_ReleasePtr( hdcs );
|
DC_UnlockDc( hdcs );
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1241,24 +1246,24 @@ NtGdiSelectObject(HDC hDC, HGDIOBJ hGDIObj)
|
||||||
PBRUSHOBJ brush;
|
PBRUSHOBJ brush;
|
||||||
PXLATEOBJ XlateObj;
|
PXLATEOBJ XlateObj;
|
||||||
PPALGDI PalGDI;
|
PPALGDI PalGDI;
|
||||||
WORD objectMagic;
|
DWORD objectType;
|
||||||
COLORREF *ColorMap;
|
COLORREF *ColorMap;
|
||||||
ULONG NumColors, Index;
|
ULONG NumColors, Index;
|
||||||
HRGN hVisRgn;
|
HRGN hVisRgn;
|
||||||
|
|
||||||
if(!hDC || !hGDIObj) return NULL;
|
if(!hDC || !hGDIObj) return NULL;
|
||||||
|
|
||||||
dc = DC_HandleToPtr(hDC);
|
dc = DC_LockDc(hDC);
|
||||||
ASSERT ( dc );
|
ASSERT ( dc );
|
||||||
|
|
||||||
objectMagic = GDIOBJ_GetHandleMagic (hGDIObj);
|
objectType = GDIOBJ_GetObjectType(hGDIObj);
|
||||||
// GdiObjHdr = hGDIObj;
|
// GdiObjHdr = hGDIObj;
|
||||||
|
|
||||||
// FIXME: Get object handle from GDIObj and use it instead of GDIObj below?
|
// FIXME: Get object handle from GDIObj and use it instead of GDIObj below?
|
||||||
|
|
||||||
switch ( objectMagic )
|
switch (objectType)
|
||||||
{
|
{
|
||||||
case GO_PEN_MAGIC:
|
case GDI_OBJECT_TYPE_PEN:
|
||||||
objOrg = (HGDIOBJ)dc->w.hPen;
|
objOrg = (HGDIOBJ)dc->w.hPen;
|
||||||
dc->w.hPen = hGDIObj;
|
dc->w.hPen = hGDIObj;
|
||||||
|
|
||||||
|
@ -1268,17 +1273,17 @@ NtGdiSelectObject(HDC hDC, HGDIOBJ hGDIObj)
|
||||||
{
|
{
|
||||||
XlateObj = (PXLATEOBJ)IntEngCreateXlate(PalGDI->Mode, PAL_RGB, dc->w.hPalette, NULL);
|
XlateObj = (PXLATEOBJ)IntEngCreateXlate(PalGDI->Mode, PAL_RGB, dc->w.hPalette, NULL);
|
||||||
ASSERT ( XlateObj );
|
ASSERT ( XlateObj );
|
||||||
pen = GDIOBJ_LockObj(dc->w.hPen, GO_PEN_MAGIC);
|
pen = PENOBJ_LockPen(dc->w.hPen);
|
||||||
if( pen )
|
if( pen )
|
||||||
{
|
{
|
||||||
pen->logpen.lopnColor = XLATEOBJ_iXlate(XlateObj, pen->logpen.lopnColor);
|
pen->logpen.lopnColor = XLATEOBJ_iXlate(XlateObj, pen->logpen.lopnColor);
|
||||||
GDIOBJ_UnlockObj( dc->w.hPen, GO_PEN_MAGIC);
|
PENOBJ_UnlockPen(dc->w.hPen);
|
||||||
}
|
}
|
||||||
EngDeleteXlate(XlateObj);
|
EngDeleteXlate(XlateObj);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GO_BRUSH_MAGIC:
|
case GDI_OBJECT_TYPE_BRUSH:
|
||||||
objOrg = (HGDIOBJ)dc->w.hBrush;
|
objOrg = (HGDIOBJ)dc->w.hBrush;
|
||||||
dc->w.hBrush = (HBRUSH) hGDIObj;
|
dc->w.hBrush = (HBRUSH) hGDIObj;
|
||||||
|
|
||||||
|
@ -1288,32 +1293,32 @@ NtGdiSelectObject(HDC hDC, HGDIOBJ hGDIObj)
|
||||||
{
|
{
|
||||||
XlateObj = (PXLATEOBJ)IntEngCreateXlate(PalGDI->Mode, PAL_RGB, dc->w.hPalette, NULL);
|
XlateObj = (PXLATEOBJ)IntEngCreateXlate(PalGDI->Mode, PAL_RGB, dc->w.hPalette, NULL);
|
||||||
ASSERT(XlateObj);
|
ASSERT(XlateObj);
|
||||||
brush = GDIOBJ_LockObj(dc->w.hBrush, GO_BRUSH_MAGIC);
|
brush = BRUSHOBJ_LockBrush(dc->w.hBrush);
|
||||||
if( brush )
|
if( brush )
|
||||||
{
|
{
|
||||||
brush->iSolidColor = XLATEOBJ_iXlate(XlateObj, brush->logbrush.lbColor);
|
brush->iSolidColor = XLATEOBJ_iXlate(XlateObj, brush->logbrush.lbColor);
|
||||||
}
|
}
|
||||||
GDIOBJ_UnlockObj( dc->w.hBrush, GO_BRUSH_MAGIC);
|
BRUSHOBJ_UnlockBrush(dc->w.hBrush);
|
||||||
EngDeleteXlate(XlateObj);
|
EngDeleteXlate(XlateObj);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GO_FONT_MAGIC:
|
case GDI_OBJECT_TYPE_FONT:
|
||||||
objOrg = (HGDIOBJ)dc->w.hFont;
|
objOrg = (HGDIOBJ)dc->w.hFont;
|
||||||
dc->w.hFont = (HFONT) hGDIObj;
|
dc->w.hFont = (HFONT) hGDIObj;
|
||||||
TextIntRealizeFont(dc->w.hFont);
|
TextIntRealizeFont(dc->w.hFont);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GO_BITMAP_MAGIC:
|
case GDI_OBJECT_TYPE_BITMAP:
|
||||||
// must be memory dc to select bitmap
|
// must be memory dc to select bitmap
|
||||||
if (!(dc->w.flags & DC_MEMORY)) return NULL;
|
if (!(dc->w.flags & DC_MEMORY)) return NULL;
|
||||||
objOrg = (HGDIOBJ)dc->w.hBitmap;
|
objOrg = (HGDIOBJ)dc->w.hBitmap;
|
||||||
|
|
||||||
/* Release the old bitmap, lock the new one and convert it to a SURF */
|
/* Release the old bitmap, lock the new one and convert it to a SURF */
|
||||||
EngDeleteSurface(dc->Surface);
|
EngDeleteSurface(dc->Surface);
|
||||||
BITMAPOBJ_ReleasePtr(objOrg);
|
BITMAPOBJ_UnlockBitmap(objOrg);
|
||||||
dc->w.hBitmap = hGDIObj;
|
dc->w.hBitmap = hGDIObj;
|
||||||
pb = BITMAPOBJ_HandleToPtr(hGDIObj);
|
pb = BITMAPOBJ_LockBitmap(hGDIObj);
|
||||||
ASSERT(pb);
|
ASSERT(pb);
|
||||||
dc->Surface = BitmapToSurf(pb);
|
dc->Surface = BitmapToSurf(pb);
|
||||||
|
|
||||||
|
@ -1353,7 +1358,7 @@ NtGdiSelectObject(HDC hDC, HGDIOBJ hGDIObj)
|
||||||
dc->w.bitsPerPixel = pb->bitmap.bmBitsPixel;
|
dc->w.bitsPerPixel = pb->bitmap.bmBitsPixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
DC_ReleasePtr ( hDC );
|
DC_UnlockDc ( hDC );
|
||||||
hVisRgn = NtGdiCreateRectRgn ( 0, 0, pb->size.cx, pb->size.cy );
|
hVisRgn = NtGdiCreateRectRgn ( 0, 0, pb->size.cx, pb->size.cy );
|
||||||
NtGdiSelectVisRgn ( hDC, hVisRgn );
|
NtGdiSelectVisRgn ( hDC, hVisRgn );
|
||||||
NtGdiDeleteObject ( hVisRgn );
|
NtGdiDeleteObject ( hVisRgn );
|
||||||
|
@ -1361,15 +1366,15 @@ NtGdiSelectObject(HDC hDC, HGDIOBJ hGDIObj)
|
||||||
return objOrg;
|
return objOrg;
|
||||||
|
|
||||||
#if UPDATEREGIONS
|
#if UPDATEREGIONS
|
||||||
case GO_REGION_MAGIC:
|
case GDI_OBJECT_TYPE_REGION:
|
||||||
DC_ReleasePtr ( hDC );
|
DC_UnlockDc ( hDC );
|
||||||
SelectClipRgn(hDC, (HRGN)hGDIObj);
|
SelectClipRgn(hDC, (HRGN)hGDIObj);
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
return objOrg;
|
return objOrg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1383,14 +1388,14 @@ COLORREF STDCALL
|
||||||
NtGdiSetBkColor(HDC hDC, COLORREF color)
|
NtGdiSetBkColor(HDC hDC, COLORREF color)
|
||||||
{
|
{
|
||||||
COLORREF oldColor;
|
COLORREF oldColor;
|
||||||
PDC dc = DC_HandleToPtr(hDC);
|
PDC dc = DC_LockDc(hDC);
|
||||||
|
|
||||||
if ( !dc )
|
if ( !dc )
|
||||||
return 0x80000000;
|
return 0x80000000;
|
||||||
|
|
||||||
oldColor = dc->w.backgroundColor;
|
oldColor = dc->w.backgroundColor;
|
||||||
dc->w.backgroundColor = color;
|
dc->w.backgroundColor = color;
|
||||||
DC_ReleasePtr ( hDC );
|
DC_UnlockDc ( hDC );
|
||||||
return oldColor;
|
return oldColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1401,10 +1406,10 @@ NtGdiSetDCState16 ( HDC hDC, HDC hDCSave )
|
||||||
{
|
{
|
||||||
PDC dc, dcs;
|
PDC dc, dcs;
|
||||||
|
|
||||||
dc = DC_HandleToPtr ( hDC );
|
dc = DC_LockDc ( hDC );
|
||||||
if ( dc )
|
if ( dc )
|
||||||
{
|
{
|
||||||
dcs = DC_HandleToPtr ( hDCSave );
|
dcs = DC_LockDc ( hDCSave );
|
||||||
if ( dcs )
|
if ( dcs )
|
||||||
{
|
{
|
||||||
if ( dcs->w.flags & DC_SAVED )
|
if ( dcs->w.flags & DC_SAVED )
|
||||||
|
@ -1498,9 +1503,9 @@ NtGdiSetDCState16 ( HDC hDC, HDC hDCSave )
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
DC_ReleasePtr ( hDCSave );
|
DC_UnlockDc ( hDCSave );
|
||||||
}
|
}
|
||||||
DC_ReleasePtr ( hDC );
|
DC_UnlockDc ( hDC );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1512,13 +1517,13 @@ DC_AllocDC(LPCWSTR Driver)
|
||||||
PDC NewDC;
|
PDC NewDC;
|
||||||
HDC hDC;
|
HDC hDC;
|
||||||
|
|
||||||
hDC = (HDC) GDIOBJ_AllocObj(sizeof(DC), GO_DC_MAGIC);
|
hDC = (HDC) GDIOBJ_AllocObj(sizeof(DC), GDI_OBJECT_TYPE_DC, (GDICLEANUPPROC) DC_InternalDeleteDC);
|
||||||
if (hDC == NULL)
|
if (hDC == NULL)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
NewDC = (PDC) GDIOBJ_LockObj( hDC, GO_DC_MAGIC );
|
NewDC = DC_LockDc(hDC);
|
||||||
|
|
||||||
if (Driver != NULL)
|
if (Driver != NULL)
|
||||||
{
|
{
|
||||||
|
@ -1539,7 +1544,8 @@ DC_AllocDC(LPCWSTR Driver)
|
||||||
NewDC->w.hFont = NtGdiGetStockObject(SYSTEM_FONT);
|
NewDC->w.hFont = NtGdiGetStockObject(SYSTEM_FONT);
|
||||||
TextIntRealizeFont(NewDC->w.hFont);
|
TextIntRealizeFont(NewDC->w.hFont);
|
||||||
|
|
||||||
GDIOBJ_UnlockObj( hDC, GO_DC_MAGIC );
|
DC_UnlockDc(hDC);
|
||||||
|
|
||||||
return hDC;
|
return hDC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1568,7 +1574,7 @@ DC_InitDC(HDC DCHandle)
|
||||||
VOID FASTCALL
|
VOID FASTCALL
|
||||||
DC_FreeDC(HDC DCToFree)
|
DC_FreeDC(HDC DCToFree)
|
||||||
{
|
{
|
||||||
if (!GDIOBJ_FreeObj(DCToFree, GO_DC_MAGIC, GDIOBJFLAG_DEFAULT))
|
if (!GDIOBJ_FreeObj(DCToFree, GDI_OBJECT_TYPE_DC, GDIOBJFLAG_DEFAULT))
|
||||||
{
|
{
|
||||||
DPRINT("DC_FreeDC failed\n");
|
DPRINT("DC_FreeDC failed\n");
|
||||||
}
|
}
|
||||||
|
@ -1577,9 +1583,12 @@ DC_FreeDC(HDC DCToFree)
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
DC_InternalDeleteDC( PDC DCToDelete )
|
DC_InternalDeleteDC( PDC DCToDelete )
|
||||||
{
|
{
|
||||||
if( DCToDelete->DriverName )
|
if( DCToDelete->DriverName )
|
||||||
ExFreePool(DCToDelete->DriverName);
|
{
|
||||||
return TRUE;
|
ExFreePool(DCToDelete->DriverName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
HDC FASTCALL
|
HDC FASTCALL
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* $Id: dib.c,v 1.27 2003/08/19 11:48:50 weiden Exp $
|
* $Id: dib.c,v 1.28 2003/08/20 07:45:02 gvg Exp $
|
||||||
*
|
*
|
||||||
* ReactOS W32 Subsystem
|
* ReactOS W32 Subsystem
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
|
||||||
|
@ -113,12 +113,12 @@ NtGdiSetDIBits(
|
||||||
INT scanDirection = 1, DIBWidth;
|
INT scanDirection = 1, DIBWidth;
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (!(dc = DC_HandleToPtr(hDC)))
|
if (!(dc = DC_LockDc(hDC)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!(bitmap = (BITMAPOBJ *)GDIOBJ_LockObj(hBitmap, GO_BITMAP_MAGIC)))
|
if (!(bitmap = BITMAPOBJ_LockBitmap(hBitmap)))
|
||||||
{
|
{
|
||||||
DC_ReleasePtr(hDC);
|
DC_UnlockDc(hDC);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,9 +193,8 @@ NtGdiSetDIBits(
|
||||||
// if (ColorUse == DIB_PAL_COLORS)
|
// if (ColorUse == DIB_PAL_COLORS)
|
||||||
// WinFree((LPSTR)lpRGB);
|
// WinFree((LPSTR)lpRGB);
|
||||||
|
|
||||||
// GDI_ReleaseObj(hBitmap); unlock?
|
BITMAPOBJ_UnlockBitmap(hBitmap);
|
||||||
GDIOBJ_UnlockObj(hBitmap, GO_BITMAP_MAGIC);
|
DC_UnlockDc(hDC);
|
||||||
DC_ReleasePtr(hDC);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -251,7 +250,7 @@ INT STDCALL NtGdiGetDIBits(HDC hDC,
|
||||||
DWORD *BitField;
|
DWORD *BitField;
|
||||||
DWORD InfoSize;
|
DWORD InfoSize;
|
||||||
|
|
||||||
BitmapObj = (PBITMAPOBJ) GDIOBJ_LockObj(hBitmap, GO_BITMAP_MAGIC);
|
BitmapObj = BITMAPOBJ_LockBitmap(hBitmap);
|
||||||
if (NULL == BitmapObj)
|
if (NULL == BitmapObj)
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||||
|
@ -265,7 +264,7 @@ INT STDCALL NtGdiGetDIBits(HDC hDC,
|
||||||
if (! NT_SUCCESS(Status))
|
if (! NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
GDIOBJ_UnlockObj(hBitmap, GO_BITMAP_MAGIC);
|
BITMAPOBJ_UnlockBitmap(hBitmap);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +275,7 @@ INT STDCALL NtGdiGetDIBits(HDC hDC,
|
||||||
NULL != Bits))
|
NULL != Bits))
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||||
GDIOBJ_UnlockObj(hBitmap, GO_BITMAP_MAGIC);
|
BITMAPOBJ_UnlockBitmap(hBitmap);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,7 +285,7 @@ INT STDCALL NtGdiGetDIBits(HDC hDC,
|
||||||
if (! NT_SUCCESS(Status))
|
if (! NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
GDIOBJ_UnlockObj(hBitmap, GO_BITMAP_MAGIC);
|
BITMAPOBJ_UnlockBitmap(hBitmap);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,7 +323,7 @@ INT STDCALL NtGdiGetDIBits(HDC hDC,
|
||||||
if (! NT_SUCCESS(Status))
|
if (! NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
GDIOBJ_UnlockObj(hBitmap, GO_BITMAP_MAGIC);
|
BITMAPOBJ_UnlockBitmap(hBitmap);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Result = 1;
|
Result = 1;
|
||||||
|
@ -341,18 +340,18 @@ INT STDCALL NtGdiGetDIBits(HDC hDC,
|
||||||
if (! NT_SUCCESS(Status))
|
if (! NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
GDIOBJ_UnlockObj(hBitmap, GO_BITMAP_MAGIC);
|
BITMAPOBJ_UnlockBitmap(hBitmap);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
RtlZeroMemory(&InfoWithBitFields, sizeof(InfoWithBitFields));
|
RtlZeroMemory(&InfoWithBitFields, sizeof(InfoWithBitFields));
|
||||||
RtlCopyMemory(&(InfoWithBitFields.Info), &Info, sizeof(BITMAPINFO));
|
RtlCopyMemory(&(InfoWithBitFields.Info), &Info, sizeof(BITMAPINFO));
|
||||||
if (BI_BITFIELDS == Info.bmiHeader.biCompression)
|
if (BI_BITFIELDS == Info.bmiHeader.biCompression)
|
||||||
{
|
{
|
||||||
DCObj = DC_HandleToPtr(hDC);
|
DCObj = DC_LockDc(hDC);
|
||||||
if (NULL == DCObj)
|
if (NULL == DCObj)
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||||
GDIOBJ_UnlockObj(hBitmap, GO_BITMAP_MAGIC);
|
BITMAPOBJ_UnlockBitmap(hBitmap);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
PalGdi = (PPALGDI) AccessInternalObject((ULONG) DCObj->w.hPalette);
|
PalGdi = (PPALGDI) AccessInternalObject((ULONG) DCObj->w.hPalette);
|
||||||
|
@ -361,7 +360,7 @@ INT STDCALL NtGdiGetDIBits(HDC hDC,
|
||||||
BitField[1] = PalGdi->GreenMask;
|
BitField[1] = PalGdi->GreenMask;
|
||||||
BitField[2] = PalGdi->BlueMask;
|
BitField[2] = PalGdi->BlueMask;
|
||||||
InfoSize = InfoWithBitFields.Info.bmiHeader.biSize + 3 * sizeof(DWORD);
|
InfoSize = InfoWithBitFields.Info.bmiHeader.biSize + 3 * sizeof(DWORD);
|
||||||
DC_ReleasePtr(hDC);
|
DC_UnlockDc(hDC);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -371,7 +370,7 @@ INT STDCALL NtGdiGetDIBits(HDC hDC,
|
||||||
if (! NT_SUCCESS(Status))
|
if (! NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
GDIOBJ_UnlockObj(hBitmap, GO_BITMAP_MAGIC);
|
BITMAPOBJ_UnlockBitmap(hBitmap);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -380,7 +379,7 @@ INT STDCALL NtGdiGetDIBits(HDC hDC,
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
GDIOBJ_UnlockObj(hBitmap, GO_BITMAP_MAGIC);
|
BITMAPOBJ_UnlockBitmap(hBitmap);
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
@ -409,7 +408,7 @@ LONG STDCALL NtGdiGetBitmapBits(HBITMAP hBitmap,
|
||||||
PBITMAPOBJ bmp;
|
PBITMAPOBJ bmp;
|
||||||
LONG height, ret;
|
LONG height, ret;
|
||||||
|
|
||||||
bmp = BITMAPOBJ_HandleToPtr (hBitmap);
|
bmp = BITMAPOBJ_LockBitmap (hBitmap);
|
||||||
if (!bmp)
|
if (!bmp)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -580,11 +579,11 @@ HBITMAP STDCALL NtGdiCreateDIBSection(HDC hDC,
|
||||||
bDesktopDC = TRUE;
|
bDesktopDC = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((dc = DC_HandleToPtr(hDC)))
|
if ((dc = DC_LockDc(hDC)))
|
||||||
{
|
{
|
||||||
hbitmap = DIB_CreateDIBSection ( dc, (BITMAPINFO*)bmi, Usage, Bits,
|
hbitmap = DIB_CreateDIBSection ( dc, (BITMAPINFO*)bmi, Usage, Bits,
|
||||||
hSection, dwOffset, 0);
|
hSection, dwOffset, 0);
|
||||||
DC_ReleasePtr(hDC);
|
DC_UnlockDc(hDC);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bDesktopDC)
|
if (bDesktopDC)
|
||||||
|
@ -692,7 +691,7 @@ DIB_CreateDIBSection(
|
||||||
res = NtGdiCreateDIBitmap(dc->hSelf, bi, 0, NULL, bmi, usage);
|
res = NtGdiCreateDIBitmap(dc->hSelf, bi, 0, NULL, bmi, usage);
|
||||||
if (res)
|
if (res)
|
||||||
{
|
{
|
||||||
bmp = BITMAPOBJ_HandleToPtr (res);
|
bmp = BITMAPOBJ_LockBitmap(res);
|
||||||
if (bmp)
|
if (bmp)
|
||||||
{
|
{
|
||||||
bmp->dib = (DIBSECTION *) dib;
|
bmp->dib = (DIBSECTION *) dib;
|
||||||
|
@ -727,12 +726,12 @@ DIB_CreateDIBSection(
|
||||||
|
|
||||||
if (dib) { ExFreePool(dib); dib = NULL; }
|
if (dib) { ExFreePool(dib); dib = NULL; }
|
||||||
if (bmp) { bmp = NULL; }
|
if (bmp) { bmp = NULL; }
|
||||||
if (res) { GDIOBJ_FreeObj(res, GO_BITMAP_MAGIC, GDIOBJFLAG_DEFAULT); res = 0; }
|
if (res) { BITMAPOBJ_FreeBitmap(res); res = 0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bmp)
|
if (bmp)
|
||||||
{
|
{
|
||||||
BITMAPOBJ_ReleasePtr(res);
|
BITMAPOBJ_UnlockBitmap(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return BITMAP handle and storage location
|
// Return BITMAP handle and storage location
|
||||||
|
@ -860,7 +859,7 @@ PBITMAPOBJ FASTCALL DIBtoDDB(HGLOBAL hPackedDIB, HDC hdc) // FIXME: This should
|
||||||
// GlobalUnlock(hPackedDIB);
|
// GlobalUnlock(hPackedDIB);
|
||||||
|
|
||||||
// Retrieve the internal Pixmap from the DDB
|
// Retrieve the internal Pixmap from the DDB
|
||||||
pBmp = (BITMAPOBJ *)GDIOBJ_LockObj(hBmp, GO_BITMAP_MAGIC);
|
pBmp = BITMAPOBJ_LockBitmap(hBmp);
|
||||||
|
|
||||||
return pBmp;
|
return pBmp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,14 +16,16 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: fillshap.c,v 1.26 2003/08/19 11:48:50 weiden Exp $ */
|
/* $Id: fillshap.c,v 1.27 2003/08/20 07:45:02 gvg Exp $ */
|
||||||
|
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
#include <win32k/fillshap.h>
|
#include <win32k/fillshap.h>
|
||||||
|
#include <win32k/brush.h>
|
||||||
#include <win32k/dc.h>
|
#include <win32k/dc.h>
|
||||||
#include <win32k/pen.h>
|
#include <win32k/pen.h>
|
||||||
|
#include <win32k/region.h>
|
||||||
#include <include/error.h>
|
#include <include/error.h>
|
||||||
#include <include/object.h>
|
#include <include/object.h>
|
||||||
#include <include/inteng.h>
|
#include <include/inteng.h>
|
||||||
|
@ -140,7 +142,7 @@ IntPolygon(PDC dc,
|
||||||
Points[CurrentPoint].y += dc->w.DCOrgY;
|
Points[CurrentPoint].y += dc->w.DCOrgY;
|
||||||
}
|
}
|
||||||
|
|
||||||
RectBounds = GDIOBJ_LockObj(dc->w.hGCClipRgn, GO_REGION_MAGIC);
|
RectBounds = (PRECTL) RGNDATA_LockRgn(dc->w.hGCClipRgn);
|
||||||
//ei not yet implemented ASSERT(RectBounds);
|
//ei not yet implemented ASSERT(RectBounds);
|
||||||
|
|
||||||
if (PATH_IsPathOpen(dc->w.path))
|
if (PATH_IsPathOpen(dc->w.path))
|
||||||
|
@ -162,11 +164,11 @@ IntPolygon(PDC dc,
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
/* Now fill the polygon with the current brush. */
|
/* Now fill the polygon with the current brush. */
|
||||||
FillBrushObj = (BRUSHOBJ*) GDIOBJ_LockObj(dc->w.hBrush, GO_BRUSH_MAGIC);
|
FillBrushObj = BRUSHOBJ_LockBrush(dc->w.hBrush);
|
||||||
ASSERT(FillBrushObj);
|
ASSERT(FillBrushObj);
|
||||||
if ( FillBrushObj->logbrush.lbStyle != BS_NULL )
|
if ( FillBrushObj->logbrush.lbStyle != BS_NULL )
|
||||||
ret = FillPolygon ( dc, SurfObj, FillBrushObj, dc->w.ROPmode, Points, Count, DestRect );
|
ret = FillPolygon ( dc, SurfObj, FillBrushObj, dc->w.ROPmode, Points, Count, DestRect );
|
||||||
GDIOBJ_UnlockObj(dc->w.hBrush, GO_BRUSH_MAGIC);
|
BRUSHOBJ_UnlockBrush(dc->w.hBrush);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* make BRUSHOBJ from current pen. */
|
/* make BRUSHOBJ from current pen. */
|
||||||
|
@ -203,15 +205,15 @@ IntPolygon(PDC dc,
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
/* Now fill the polygon with the current brush. */
|
/* Now fill the polygon with the current brush. */
|
||||||
FillBrushObj = (BRUSHOBJ*) GDIOBJ_LockObj(dc->w.hBrush, GO_BRUSH_MAGIC);
|
FillBrushObj = BRUSHOBJ_LockBrush(dc->w.hBrush);
|
||||||
ASSERT(FillBrushObj);
|
ASSERT(FillBrushObj);
|
||||||
if ( FillBrushObj->logbrush.lbStyle != BS_NULL )
|
if ( FillBrushObj->logbrush.lbStyle != BS_NULL )
|
||||||
ret = FillPolygon ( dc, SurfObj, FillBrushObj, dc->w.ROPmode, Points, Count, DestRect );
|
ret = FillPolygon ( dc, SurfObj, FillBrushObj, dc->w.ROPmode, Points, Count, DestRect );
|
||||||
GDIOBJ_UnlockObj(dc->w.hBrush, GO_BRUSH_MAGIC);
|
BRUSHOBJ_UnlockBrush(dc->w.hBrush);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
GDIOBJ_UnlockObj ( dc->w.hGCClipRgn, GO_REGION_MAGIC );
|
RGNDATA_UnlockRgn(dc->w.hGCClipRgn);
|
||||||
}
|
}
|
||||||
ExFreePool ( Points );
|
ExFreePool ( Points );
|
||||||
}
|
}
|
||||||
|
@ -230,14 +232,14 @@ NtGdiPolygon(HDC hDC,
|
||||||
|
|
||||||
//DPRINT("In NtGdiPolygon()\n");
|
//DPRINT("In NtGdiPolygon()\n");
|
||||||
|
|
||||||
dc = DC_HandleToPtr ( hDC );
|
dc = DC_LockDc ( hDC );
|
||||||
|
|
||||||
if ( !dc )
|
if ( !dc )
|
||||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = IntPolygon ( dc, UnsafePoints, Count );
|
ret = IntPolygon ( dc, UnsafePoints, Count );
|
||||||
DC_ReleasePtr ( hDC );
|
DC_UnlockDc ( hDC );
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -270,7 +272,7 @@ IntRectangle(PDC dc,
|
||||||
|
|
||||||
ASSERT ( dc ); // caller's responsibility to set this up
|
ASSERT ( dc ); // caller's responsibility to set this up
|
||||||
|
|
||||||
RectBounds = GDIOBJ_LockObj ( dc->w.hGCClipRgn, GO_REGION_MAGIC );
|
RectBounds = (PRECTL) RGNDATA_LockRgn(dc->w.hGCClipRgn);
|
||||||
//ei not yet implemented ASSERT(RectBounds);
|
//ei not yet implemented ASSERT(RectBounds);
|
||||||
|
|
||||||
if ( PATH_IsPathOpen(dc->w.path) )
|
if ( PATH_IsPathOpen(dc->w.path) )
|
||||||
|
@ -284,7 +286,7 @@ IntRectangle(PDC dc,
|
||||||
TopRect += dc->w.DCOrgY;
|
TopRect += dc->w.DCOrgY;
|
||||||
BottomRect += dc->w.DCOrgY - 1;
|
BottomRect += dc->w.DCOrgY - 1;
|
||||||
|
|
||||||
FillBrushObj = (BRUSHOBJ*) GDIOBJ_LockObj(dc->w.hBrush, GO_BRUSH_MAGIC);
|
FillBrushObj = BRUSHOBJ_LockBrush(dc->w.hBrush);
|
||||||
|
|
||||||
ASSERT(FillBrushObj); // FIXME - I *think* this should always happen...
|
ASSERT(FillBrushObj); // FIXME - I *think* this should always happen...
|
||||||
// it would be nice to remove the following if statement if that proves to be true
|
// it would be nice to remove the following if statement if that proves to be true
|
||||||
|
@ -310,7 +312,7 @@ IntRectangle(PDC dc,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GDIOBJ_UnlockObj( dc->w.hBrush, GO_BRUSH_MAGIC );
|
BRUSHOBJ_UnlockBrush(dc->w.hBrush);
|
||||||
|
|
||||||
/* make BRUSHOBJ from current pen. */
|
/* make BRUSHOBJ from current pen. */
|
||||||
HPenToBrushObj ( &PenBrushObj, dc->w.hPen );
|
HPenToBrushObj ( &PenBrushObj, dc->w.hPen );
|
||||||
|
@ -352,7 +354,7 @@ IntRectangle(PDC dc,
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Move current position in DC?
|
// FIXME: Move current position in DC?
|
||||||
GDIOBJ_UnlockObj(dc->w.hGCClipRgn, GO_REGION_MAGIC);
|
RGNDATA_UnlockRgn(dc->w.hGCClipRgn);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -364,13 +366,13 @@ NtGdiRectangle(HDC hDC,
|
||||||
int RightRect,
|
int RightRect,
|
||||||
int BottomRect)
|
int BottomRect)
|
||||||
{
|
{
|
||||||
DC *dc = DC_HandleToPtr(hDC);
|
DC *dc = DC_LockDc(hDC);
|
||||||
BOOL ret = FALSE; // default to failure
|
BOOL ret = FALSE; // default to failure
|
||||||
|
|
||||||
if ( dc )
|
if ( dc )
|
||||||
{
|
{
|
||||||
ret = IntRectangle ( dc, LeftRect, TopRect, RightRect, BottomRect );
|
ret = IntRectangle ( dc, LeftRect, TopRect, RightRect, BottomRect );
|
||||||
DC_ReleasePtr ( hDC );
|
DC_UnlockDc ( hDC );
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
/*
|
/*
|
||||||
* GDIOBJ.C - GDI object manipulation routines
|
* GDIOBJ.C - GDI object manipulation routines
|
||||||
*
|
*
|
||||||
* $Id: gdiobj.c,v 1.37 2003/08/19 11:48:50 weiden Exp $
|
* $Id: gdiobj.c,v 1.38 2003/08/20 07:45:02 gvg Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -41,10 +41,18 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <win32k/debug1.h>
|
#include <win32k/debug1.h>
|
||||||
|
|
||||||
#define GDI_HANDLE2INDEX(h) (((WORD)(size_t)(h)) & 0xffff)
|
#define GDI_HANDLE_INDEX_MASK 0x00000fff
|
||||||
#define GDI_INDEX2HANDLE(i) ((HANDLE) (((size_t)(i))&0xffff) )
|
#define GDI_HANDLE_TYPE_MASK 0x007f0000
|
||||||
|
#define GDI_HANDLE_STOCK_MASK 0x00800000
|
||||||
|
|
||||||
// GDI stock objects
|
#define GDI_HANDLE_CREATE(i, t) ((HANDLE)(((i) & GDI_HANDLE_INDEX_MASK) | ((t) & GDI_HANDLE_TYPE_MASK)))
|
||||||
|
#define GDI_HANDLE_GET_INDEX(h) (((DWORD)(h)) & GDI_HANDLE_INDEX_MASK)
|
||||||
|
#define GDI_HANDLE_GET_TYPE(h) (((DWORD)(h)) & GDI_HANDLE_TYPE_MASK)
|
||||||
|
#define GDI_HANDLE_IS_TYPE(h, t) ((t) == (((DWORD)(h)) & GDI_HANDLE_TYPE_MASK))
|
||||||
|
#define GDI_HANDLE_IS_STOCKOBJ(h) (0 != (((DWORD)(h)) & GDI_HANDLE_STOCK_MASK))
|
||||||
|
#define GDI_HANDLE_SET_STOCKOBJ(h) ((h) = (HANDLE)(((DWORD)(h)) | GDI_HANDLE_STOCK_MASK))
|
||||||
|
|
||||||
|
/* GDI stock objects */
|
||||||
|
|
||||||
static LOGBRUSH WhiteBrush =
|
static LOGBRUSH WhiteBrush =
|
||||||
{ BS_SOLID, RGB(255,255,255), 0 };
|
{ BS_SOLID, RGB(255,255,255), 0 };
|
||||||
|
@ -81,60 +89,40 @@ static LOGFONTW OEMFixedFont =
|
||||||
{ 14, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, OEM_CHARSET,
|
{ 14, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, OEM_CHARSET,
|
||||||
0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, L"" };
|
0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, L"" };
|
||||||
|
|
||||||
/* Filler to make the location counter dword aligned again. This is necessary
|
|
||||||
since (a) LOGFONT is packed, (b) gcc places initialised variables in the code
|
|
||||||
segment, and (c) Solaris assembler is stupid. */
|
|
||||||
//static UINT align_OEMFixedFont = 1;
|
|
||||||
|
|
||||||
static LOGFONTW AnsiFixedFont =
|
static LOGFONTW AnsiFixedFont =
|
||||||
{ 14, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
|
{ 14, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
|
||||||
0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, L"" };
|
0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, L"" };
|
||||||
|
|
||||||
//static UINT align_AnsiFixedFont = 1;
|
/*static LOGFONTW AnsiVarFont =
|
||||||
|
*{ 14, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
|
||||||
//static LOGFONTW AnsiVarFont =
|
* 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, L"MS Sans Serif" }; */
|
||||||
//{ 14, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
|
|
||||||
// 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, L"MS Sans Serif" };
|
|
||||||
|
|
||||||
//static UINT align_AnsiVarFont = 1;
|
|
||||||
|
|
||||||
static LOGFONTW SystemFont =
|
static LOGFONTW SystemFont =
|
||||||
{ 14, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
|
{ 14, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
|
||||||
0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, L"System" };
|
0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, L"System" };
|
||||||
|
|
||||||
//static UINT align_SystemFont = 1;
|
|
||||||
|
|
||||||
static LOGFONTW DeviceDefaultFont =
|
static LOGFONTW DeviceDefaultFont =
|
||||||
{ 14, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
|
{ 14, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
|
||||||
0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, L"" };
|
0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, L"" };
|
||||||
|
|
||||||
//static UINT align_DeviceDefaultFont = 1;
|
|
||||||
|
|
||||||
static LOGFONTW SystemFixedFont =
|
static LOGFONTW SystemFixedFont =
|
||||||
{ 14, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
|
{ 14, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
|
||||||
0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, L"" };
|
0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, L"" };
|
||||||
|
|
||||||
//static UINT align_SystemFixedFont = 1;
|
|
||||||
|
|
||||||
/* FIXME: Is this correct? */
|
/* FIXME: Is this correct? */
|
||||||
static LOGFONTW DefaultGuiFont =
|
static LOGFONTW DefaultGuiFont =
|
||||||
{ 14, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
|
{ 14, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
|
||||||
0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, L"MS Sans Serif" };
|
0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, L"MS Sans Serif" };
|
||||||
|
|
||||||
//static UINT align_DefaultGuiFont = 1;
|
#define NB_STOCK_OBJECTS (DEFAULT_GUI_FONT + 1)
|
||||||
|
|
||||||
static HGDIOBJ *StockObjects[NB_STOCK_OBJECTS]; // we dont assign these statically as WINE does because we might redesign
|
|
||||||
// the way handles work, so it's more dynamic now
|
|
||||||
|
|
||||||
|
|
||||||
HBITMAP hPseudoStockBitmap; /*! 1x1 bitmap for memory DCs */
|
|
||||||
|
|
||||||
|
static HGDIOBJ *StockObjects[NB_STOCK_OBJECTS];
|
||||||
static PGDI_HANDLE_TABLE HandleTable = 0;
|
static PGDI_HANDLE_TABLE HandleTable = 0;
|
||||||
static FAST_MUTEX HandleTableMutex;
|
static FAST_MUTEX HandleTableMutex;
|
||||||
static FAST_MUTEX RefCountHandling;
|
static FAST_MUTEX RefCountHandling;
|
||||||
|
|
||||||
/*! Size of the GDI handle table
|
/*! Size of the GDI handle table
|
||||||
* per http://www.wd-mag.com/articles/1999/9902/9902b/9902b.htm?topic=articles
|
* http://www.windevnet.com/documents/s=7290/wdj9902b/9902b.htm
|
||||||
* gdi handle table can hold 0x4000 handles
|
* gdi handle table can hold 0x4000 handles
|
||||||
*/
|
*/
|
||||||
#define GDI_HANDLE_NUMBER 0x4000
|
#define GDI_HANDLE_NUMBER 0x4000
|
||||||
|
@ -168,9 +156,9 @@ GDIOBJ_iAllocHandleTable (WORD Size)
|
||||||
static PGDI_HANDLE_ENTRY FASTCALL
|
static PGDI_HANDLE_ENTRY FASTCALL
|
||||||
GDIOBJ_iGetHandleEntryForIndex (WORD TableIndex)
|
GDIOBJ_iGetHandleEntryForIndex (WORD TableIndex)
|
||||||
{
|
{
|
||||||
//DPRINT("GDIOBJ_iGetHandleEntryForIndex: TableIndex: %d,\n handle: %x, ptr: %x\n", TableIndex, HandleTable->Handles [TableIndex], &(HandleTable->Handles [TableIndex]) );
|
/*DPRINT("GDIOBJ_iGetHandleEntryForIndex: TableIndex: %d,\n handle: %x, ptr: %x\n", TableIndex, HandleTable->Handles [TableIndex], &(HandleTable->Handles [TableIndex]) );*/
|
||||||
//DPRINT("GIG: HandleTable: %x, Handles: %x, \n TableIndex: %x, pt: %x\n", HandleTable, HandleTable->Handles, TableIndex, ((PGDI_HANDLE_ENTRY)HandleTable->Handles+TableIndex));
|
/*DPRINT("GIG: HandleTable: %x, Handles: %x, \n TableIndex: %x, pt: %x\n", HandleTable, HandleTable->Handles, TableIndex, ((PGDI_HANDLE_ENTRY)HandleTable->Handles+TableIndex));*/
|
||||||
//DPRINT("GIG: Hndl: %x, mag: %x\n", ((PGDI_HANDLE_ENTRY)HandleTable->Handles+TableIndex), ((PGDI_HANDLE_ENTRY)HandleTable->Handles+TableIndex)->wMagic);
|
/*DPRINT("GIG: Hndl: %x\n", ((PGDI_HANDLE_ENTRY)HandleTable->Handles+TableIndex));*/
|
||||||
return ((PGDI_HANDLE_ENTRY)HandleTable->Handles+TableIndex);
|
return ((PGDI_HANDLE_ENTRY)HandleTable->Handles+TableIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,17 +169,17 @@ GDIOBJ_iGetHandleEntryForIndex (WORD TableIndex)
|
||||||
static WORD FASTCALL
|
static WORD FASTCALL
|
||||||
GDIOBJ_iGetNextOpenHandleIndex (void)
|
GDIOBJ_iGetNextOpenHandleIndex (void)
|
||||||
{
|
{
|
||||||
WORD tableIndex;
|
WORD tableIndex;
|
||||||
|
|
||||||
ExAcquireFastMutexUnsafe (&HandleTableMutex);
|
ExAcquireFastMutexUnsafe (&HandleTableMutex);
|
||||||
for (tableIndex = 1; tableIndex < HandleTable->wTableSize; tableIndex++)
|
for (tableIndex = 1; tableIndex < HandleTable->wTableSize; tableIndex++)
|
||||||
{
|
|
||||||
if (HandleTable->Handles [tableIndex].wMagic == 0)
|
|
||||||
{
|
{
|
||||||
HandleTable->Handles [tableIndex].wMagic = GO_MAGIC_DONTCARE;
|
if (NULL == HandleTable->Handles[tableIndex].pObject)
|
||||||
break;
|
{
|
||||||
|
HandleTable->Handles[tableIndex].pObject = (PGDIOBJ) -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
ExReleaseFastMutexUnsafe (&HandleTableMutex);
|
ExReleaseFastMutexUnsafe (&HandleTableMutex);
|
||||||
|
|
||||||
return (tableIndex < HandleTable->wTableSize) ? tableIndex : 0;
|
return (tableIndex < HandleTable->wTableSize) ? tableIndex : 0;
|
||||||
|
@ -202,19 +190,20 @@ GDIOBJ_iGetNextOpenHandleIndex (void)
|
||||||
*
|
*
|
||||||
* \param Size - size of the GDI object. This shouldn't to include the size of GDIOBJHDR.
|
* \param Size - size of the GDI object. This shouldn't to include the size of GDIOBJHDR.
|
||||||
* The actual amount of allocated memory is sizeof(GDIOBJHDR)+Size
|
* The actual amount of allocated memory is sizeof(GDIOBJHDR)+Size
|
||||||
* \param Magic - object magic (see GDI Magic)
|
* \param ObjectType - type of object \ref GDI object types
|
||||||
|
* \param CleanupProcPtr - Routine to be called on destruction of object
|
||||||
*
|
*
|
||||||
* \return Handle of the allocated object.
|
* \return Handle of the allocated object.
|
||||||
*
|
*
|
||||||
* \note Use GDIOBJ_Lock() to obtain pointer to the new object.
|
* \note Use GDIOBJ_Lock() to obtain pointer to the new object.
|
||||||
*/
|
*/
|
||||||
HGDIOBJ FASTCALL
|
HGDIOBJ FASTCALL
|
||||||
GDIOBJ_AllocObj(WORD Size, WORD Magic)
|
GDIOBJ_AllocObj(WORD Size, DWORD ObjectType, GDICLEANUPPROC CleanupProc)
|
||||||
{
|
{
|
||||||
PGDIOBJHDR newObject;
|
PGDIOBJHDR newObject;
|
||||||
PGDI_HANDLE_ENTRY handleEntry;
|
PGDI_HANDLE_ENTRY handleEntry;
|
||||||
|
|
||||||
DPRINT("GDIOBJ_AllocObj: size: %d, magic: %x\n", Size, Magic);
|
DPRINT("GDIOBJ_AllocObj: size: %d, type: 0x%08x\n", Size, ObjectType);
|
||||||
newObject = ExAllocatePool (PagedPool, Size + sizeof (GDIOBJHDR));
|
newObject = ExAllocatePool (PagedPool, Size + sizeof (GDIOBJHDR));
|
||||||
if (newObject == NULL)
|
if (newObject == NULL)
|
||||||
{
|
{
|
||||||
|
@ -226,22 +215,23 @@ GDIOBJ_AllocObj(WORD Size, WORD Magic)
|
||||||
newObject->wTableIndex = GDIOBJ_iGetNextOpenHandleIndex ();
|
newObject->wTableIndex = GDIOBJ_iGetNextOpenHandleIndex ();
|
||||||
newObject->dwCount = 0;
|
newObject->dwCount = 0;
|
||||||
handleEntry = GDIOBJ_iGetHandleEntryForIndex (newObject->wTableIndex);
|
handleEntry = GDIOBJ_iGetHandleEntryForIndex (newObject->wTableIndex);
|
||||||
handleEntry->wMagic = Magic;
|
handleEntry->CleanupProc = CleanupProc;
|
||||||
handleEntry->hProcessId = PsGetCurrentProcessId ();
|
handleEntry->hProcessId = PsGetCurrentProcessId ();
|
||||||
handleEntry->pObject = newObject;
|
handleEntry->pObject = newObject;
|
||||||
handleEntry->lockfile = NULL;
|
handleEntry->lockfile = NULL;
|
||||||
handleEntry->lockline = 0;
|
handleEntry->lockline = 0;
|
||||||
DPRINT("GDIOBJ_AllocObj: object handle %d\n", newObject->wTableIndex );
|
DPRINT("GDIOBJ_AllocObj: object handle %d\n", newObject->wTableIndex );
|
||||||
return GDI_INDEX2HANDLE(newObject->wTableIndex);
|
return GDI_HANDLE_CREATE(newObject->wTableIndex, ObjectType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Free memory allocated for the GDI object. For each object type this function calls the
|
* Free memory allocated for the GDI object. For each object type this function calls the
|
||||||
* appropriate cleanup routine.
|
* appropriate cleanup routine.
|
||||||
*
|
*
|
||||||
* \param hObj - handle of the object to be deleted.
|
* \param hObj - handle of the object to be deleted.
|
||||||
* \param Magic - object magic or GO_MAGIC_DONTCARE.
|
* \param ObjectType - one of the \ref GDI object types
|
||||||
* \param Flag - if set to GDIOBJFLAG_IGNOREPID then the routine doesn't check if the process that
|
* or GDI_OBJECT_TYPE_DONTCARE.
|
||||||
|
* \param Flag - if set to GDIOBJFLAG_IGNOREPID then the routine doesn't check if the process that
|
||||||
* tries to delete the object is the same one that created it.
|
* tries to delete the object is the same one that created it.
|
||||||
*
|
*
|
||||||
* \return Returns TRUE if succesful.
|
* \return Returns TRUE if succesful.
|
||||||
|
@ -250,114 +240,94 @@ GDIOBJ_AllocObj(WORD Size, WORD Magic)
|
||||||
* \note This function deferres object deletion if it is still in use.
|
* \note This function deferres object deletion if it is still in use.
|
||||||
*/
|
*/
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
GDIOBJ_FreeObj(HGDIOBJ hObj, WORD Magic, DWORD Flag)
|
GDIOBJ_FreeObj(HGDIOBJ hObj, DWORD ObjectType, DWORD Flag)
|
||||||
{
|
{
|
||||||
PGDIOBJHDR objectHeader;
|
PGDIOBJHDR objectHeader;
|
||||||
PGDI_HANDLE_ENTRY handleEntry;
|
PGDI_HANDLE_ENTRY handleEntry;
|
||||||
PGDIOBJ Obj;
|
PGDIOBJ Obj;
|
||||||
BOOL bRet = TRUE;
|
BOOL bRet = TRUE;
|
||||||
|
|
||||||
handleEntry = GDIOBJ_iGetHandleEntryForIndex ( GDI_HANDLE2INDEX(hObj) );
|
handleEntry = GDIOBJ_iGetHandleEntryForIndex(GDI_HANDLE_GET_INDEX(hObj));
|
||||||
DPRINT("GDIOBJ_FreeObj: hObj: %d, magic: %x, handleEntry: %x\n", (WORD)hObj & 0xffff, Magic, handleEntry );
|
DPRINT("GDIOBJ_FreeObj: hObj: 0x%08x, handleEntry: %x\n", hObj, handleEntry );
|
||||||
|
|
||||||
if (handleEntry == 0 || (handleEntry->wMagic != Magic && Magic != GO_MAGIC_DONTCARE )
|
if (NULL == handleEntry
|
||||||
|| ((handleEntry->hProcessId != PsGetCurrentProcessId()) && !(Flag & GDIOBJFLAG_IGNOREPID))){
|
|| (GDI_HANDLE_GET_TYPE(hObj) != ObjectType && ObjectType != GDI_OBJECT_TYPE_DONTCARE)
|
||||||
|
|| ((handleEntry->hProcessId != PsGetCurrentProcessId()) && !(Flag & GDIOBJFLAG_IGNOREPID)))
|
||||||
|
{
|
||||||
|
DPRINT("Can't Delete hObj: 0x%08x, type: 0x%08x, pid:%d\n currpid:%d, flag:%d, hmm:%d\n", hObj, ObjectType, handleEntry->hProcessId, PsGetCurrentProcessId(), (Flag&GDIOBJFLAG_IGNOREPID), ((handleEntry->hProcessId != PsGetCurrentProcessId()) && !(Flag&GDIOBJFLAG_IGNOREPID)) );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
DPRINT("Can't Delete hObj: %d, magic: %x, pid:%d\n currpid:%d, flag:%d, hmm:%d\n",(WORD)hObj & 0xffff, handleEntry->wMagic, handleEntry->hProcessId, PsGetCurrentProcessId(), (Flag&GDIOBJFLAG_IGNOREPID), ((handleEntry->hProcessId != PsGetCurrentProcessId()) && !(Flag&GDIOBJFLAG_IGNOREPID)) );
|
objectHeader = handleEntry->pObject;
|
||||||
return FALSE;
|
ASSERT(objectHeader);
|
||||||
|
DPRINT("FreeObj: locks: %x\n", objectHeader->dwCount );
|
||||||
|
if (!(Flag & GDIOBJFLAG_IGNORELOCK))
|
||||||
|
{
|
||||||
|
/* check that the reference count is zero. if not then set flag
|
||||||
|
* and delete object when releaseobj is called */
|
||||||
|
ExAcquireFastMutex(&RefCountHandling);
|
||||||
|
if ((objectHeader->dwCount & ~0x80000000) > 0 )
|
||||||
|
{
|
||||||
|
DPRINT("GDIOBJ_FreeObj: delayed object deletion: count %d\n", objectHeader->dwCount);
|
||||||
|
objectHeader->dwCount |= 0x80000000;
|
||||||
|
ExReleaseFastMutex(&RefCountHandling);
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
ExReleaseFastMutex(&RefCountHandling);
|
||||||
|
}
|
||||||
|
|
||||||
objectHeader = handleEntry->pObject;
|
/* allow object to delete internal data */
|
||||||
ASSERT(objectHeader);
|
if (NULL != handleEntry->CleanupProc)
|
||||||
DPRINT("FreeObj: locks: %x\n", objectHeader->dwCount );
|
{
|
||||||
if( !(Flag & GDIOBJFLAG_IGNORELOCK) ){
|
Obj = (PGDIOBJ)((PCHAR)handleEntry->pObject + sizeof(GDIOBJHDR));
|
||||||
// check that the reference count is zero. if not then set flag
|
bRet = (*(handleEntry->CleanupProc))(Obj);
|
||||||
// and delete object when releaseobj is called
|
}
|
||||||
ExAcquireFastMutex(&RefCountHandling);
|
ExFreePool (handleEntry->pObject);
|
||||||
if( ( objectHeader->dwCount & ~0x80000000 ) > 0 ){
|
memset(handleEntry, 0, sizeof(GDI_HANDLE_ENTRY));
|
||||||
DPRINT("GDIOBJ_FreeObj: delayed object deletion: count %d\n", objectHeader->dwCount);
|
|
||||||
objectHeader->dwCount |= 0x80000000;
|
|
||||||
ExReleaseFastMutex(&RefCountHandling);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
ExReleaseFastMutex(&RefCountHandling);
|
|
||||||
}
|
|
||||||
|
|
||||||
//allow object to delete internal data
|
return bRet;
|
||||||
Obj = (PGDIOBJ)((PCHAR)handleEntry->pObject + sizeof(GDIOBJHDR));
|
|
||||||
switch( handleEntry->wMagic ){
|
|
||||||
case GO_REGION_MAGIC:
|
|
||||||
bRet = RGNDATA_InternalDelete( (PROSRGNDATA) Obj );
|
|
||||||
break;
|
|
||||||
case GO_BITMAP_MAGIC:
|
|
||||||
bRet = Bitmap_InternalDelete( (PBITMAPOBJ) Obj );
|
|
||||||
break;
|
|
||||||
case GO_DC_MAGIC:
|
|
||||||
bRet = DC_InternalDeleteDC( (PDC) Obj );
|
|
||||||
break;
|
|
||||||
case GO_PEN_MAGIC:
|
|
||||||
case GO_PALETTE_MAGIC:
|
|
||||||
case GO_DISABLED_DC_MAGIC:
|
|
||||||
case GO_META_DC_MAGIC:
|
|
||||||
case GO_METAFILE_MAGIC:
|
|
||||||
case GO_METAFILE_DC_MAGIC:
|
|
||||||
case GO_ENHMETAFILE_MAGIC:
|
|
||||||
case GO_ENHMETAFILE_DC_MAGIC:
|
|
||||||
|
|
||||||
case GO_BRUSH_MAGIC:
|
|
||||||
case GO_FONT_MAGIC:
|
|
||||||
break;
|
|
||||||
case GO_DCE_MAGIC:
|
|
||||||
bRet = DCE_InternalDelete( (PDCE) Obj );
|
|
||||||
break;
|
|
||||||
case GO_ICONCURSOR_MAGIC:
|
|
||||||
bRet = IconCursor_InternalDelete( (PICONCURSOROBJ) Obj );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ExFreePool (handleEntry->pObject);
|
|
||||||
memset ( handleEntry, 0, sizeof(GDI_HANDLE_ENTRY) );
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Lock multiple objects. Use this function when you need to lock multiple objects and some of them may be
|
* Lock multiple objects. Use this function when you need to lock multiple objects and some of them may be
|
||||||
* duplicates. You should use this function to avoid trying to lock the same object twice!
|
* duplicates. You should use this function to avoid trying to lock the same object twice!
|
||||||
*
|
*
|
||||||
* \param pList pointer to the list that contains handles to the objects. You should set hObj and Magic fields.
|
* \param pList pointer to the list that contains handles to the objects. You should set hObj and ObjectType fields.
|
||||||
* \param nObj number of objects to lock
|
* \param nObj number of objects to lock
|
||||||
* \return for each entry in pList this function sets pObj field to point to the object.
|
* \return for each entry in pList this function sets pObj field to point to the object.
|
||||||
*
|
*
|
||||||
* \note this function uses an O(n^2) algoritm because we shouldn't need to call it with more than 3 or 4 objects.
|
* \note this function uses an O(n^2) algoritm because we shouldn't need to call it with more than 3 or 4 objects.
|
||||||
*/
|
*/
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
GDIOBJ_LockMultipleObj( PGDIMULTILOCK pList, INT nObj )
|
GDIOBJ_LockMultipleObj(PGDIMULTILOCK pList, INT nObj)
|
||||||
{
|
{
|
||||||
INT i, j;
|
INT i, j;
|
||||||
ASSERT( pList );
|
ASSERT( pList );
|
||||||
// FIXME - check for "invalid" handles
|
/* FIXME - check for "invalid" handles */
|
||||||
//go through the list checking for duplicate objects
|
/* go through the list checking for duplicate objects */
|
||||||
for( i = 0; i < nObj; i++ )
|
for (i = 0; i < nObj; i++)
|
||||||
{
|
{
|
||||||
(pList+i)->pObj = NULL;
|
pList[i].pObj = NULL;
|
||||||
for( j = 0; j < i; j++ )
|
for (j = 0; j < i; j++)
|
||||||
{
|
{
|
||||||
if( ((pList+i)->hObj == (pList+j)->hObj)
|
if (pList[i].hObj == pList[j].hObj)
|
||||||
&& ((pList+i)->Magic == (pList+j)->Magic)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
//already locked, so just copy the pointer to the object
|
/* already locked, so just copy the pointer to the object */
|
||||||
(pList+i)->pObj = (pList+j)->pObj;
|
pList[i].pObj = pList[j].pObj;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( (pList+i)->pObj == NULL )
|
|
||||||
{
|
if (NULL == pList[i].pObj)
|
||||||
//object hasn't been locked, so lock it.
|
{
|
||||||
if ( (pList+i)->hObj )
|
/* object hasn't been locked, so lock it. */
|
||||||
(pList+i)->pObj = GDIOBJ_LockObj( (pList+i)->hObj, (pList+i)->Magic );
|
if (NULL != pList[i].hObj)
|
||||||
}
|
{
|
||||||
|
pList[i].pObj = GDIOBJ_LockObj(pList[i].hObj, pList[i].ObjectType);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,33 +335,35 @@ GDIOBJ_LockMultipleObj( PGDIMULTILOCK pList, INT nObj )
|
||||||
* Unlock multiple objects. Use this function when you need to unlock multiple objects and some of them may be
|
* Unlock multiple objects. Use this function when you need to unlock multiple objects and some of them may be
|
||||||
* duplicates.
|
* duplicates.
|
||||||
*
|
*
|
||||||
* \param pList pointer to the list that contains handles to the objects. You should set hObj and Magic fields.
|
* \param pList pointer to the list that contains handles to the objects. You should set hObj and ObjectType fields.
|
||||||
* \param nObj number of objects to lock
|
* \param nObj number of objects to lock
|
||||||
*
|
*
|
||||||
* \note this function uses O(n^2) algoritm because we shouldn't need to call it with more than 3 or 4 objects.
|
* \note this function uses O(n^2) algoritm because we shouldn't need to call it with more than 3 or 4 objects.
|
||||||
*/
|
*/
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
GDIOBJ_UnlockMultipleObj( PGDIMULTILOCK pList, INT nObj )
|
GDIOBJ_UnlockMultipleObj(PGDIMULTILOCK pList, INT nObj)
|
||||||
{
|
{
|
||||||
INT i, j;
|
INT i, j;
|
||||||
ASSERT( pList );
|
ASSERT(pList);
|
||||||
//go through the list checking for duplicate objects
|
|
||||||
for( i = 0; i < nObj; i++ )
|
/* go through the list checking for duplicate objects */
|
||||||
|
for (i = 0; i < nObj; i++)
|
||||||
{
|
{
|
||||||
if( (pList+i)->pObj != NULL )
|
if (NULL != pList[i].pObj)
|
||||||
{
|
{
|
||||||
for( j = i+1; j < nObj; j++ )
|
for (j = i + 1; j < nObj; j++)
|
||||||
{
|
{
|
||||||
if( ((pList+i)->pObj == (pList+j)->pObj) )
|
if ((pList[i].pObj == pList[j].pObj))
|
||||||
{
|
{
|
||||||
//set the pointer to zero for all duplicates
|
/* set the pointer to zero for all duplicates */
|
||||||
(pList+j)->pObj = NULL;
|
pList[j].pObj = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GDIOBJ_UnlockObj( (pList+i)->hObj, (pList+i)->Magic );
|
GDIOBJ_UnlockObj(pList[i].hObj, pList[i].ObjectType);
|
||||||
(pList+i)->pObj = NULL;
|
pList[i].pObj = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -407,36 +379,29 @@ GDIOBJ_MarkObjectGlobal(HGDIOBJ ObjectHandle)
|
||||||
{
|
{
|
||||||
PGDI_HANDLE_ENTRY handleEntry;
|
PGDI_HANDLE_ENTRY handleEntry;
|
||||||
|
|
||||||
if (ObjectHandle == NULL)
|
if (NULL == ObjectHandle)
|
||||||
return;
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
handleEntry = GDIOBJ_iGetHandleEntryForIndex ( GDI_HANDLE2INDEX(ObjectHandle) );
|
handleEntry = GDIOBJ_iGetHandleEntryForIndex(GDI_HANDLE_GET_INDEX(ObjectHandle));
|
||||||
if (handleEntry == 0)
|
if (NULL == handleEntry)
|
||||||
return;
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
handleEntry->hProcessId = (HANDLE)0xFFFFFFFF;
|
handleEntry->hProcessId = (HANDLE)0xFFFFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Get the type (magic value) of the object.
|
* Get the type of the object.
|
||||||
* \param ObjectHandle - handle of the object.
|
* \param ObjectHandle - handle of the object.
|
||||||
* \return GDI Magic value.
|
* \return One of the \ref GDI object types
|
||||||
*/
|
*/
|
||||||
WORD FASTCALL
|
DWORD FASTCALL
|
||||||
GDIOBJ_GetHandleMagic (HGDIOBJ ObjectHandle)
|
GDIOBJ_GetObjectType(HGDIOBJ ObjectHandle)
|
||||||
{
|
{
|
||||||
PGDI_HANDLE_ENTRY handleEntry;
|
return GDI_HANDLE_GET_TYPE(ObjectHandle);
|
||||||
|
|
||||||
if (ObjectHandle == NULL)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
handleEntry = GDIOBJ_iGetHandleEntryForIndex ( GDI_HANDLE2INDEX(ObjectHandle) );
|
|
||||||
if (handleEntry == 0 ||
|
|
||||||
(handleEntry->hProcessId != (HANDLE)0xFFFFFFFF &&
|
|
||||||
handleEntry->hProcessId != PsGetCurrentProcessId ()))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return handleEntry->wMagic;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -461,42 +426,35 @@ InitGdiObjectHandleTable (VOID)
|
||||||
VOID FASTCALL
|
VOID FASTCALL
|
||||||
CreateStockObjects(void)
|
CreateStockObjects(void)
|
||||||
{
|
{
|
||||||
// Create GDI Stock Objects from the logical structures we've defined
|
unsigned Object;
|
||||||
|
|
||||||
|
/* Create GDI Stock Objects from the logical structures we've defined */
|
||||||
|
|
||||||
StockObjects[WHITE_BRUSH] = NtGdiCreateBrushIndirect(&WhiteBrush);
|
StockObjects[WHITE_BRUSH] = NtGdiCreateBrushIndirect(&WhiteBrush);
|
||||||
GDIOBJ_MarkObjectGlobal(StockObjects[WHITE_BRUSH]);
|
|
||||||
StockObjects[LTGRAY_BRUSH] = NtGdiCreateBrushIndirect(&LtGrayBrush);
|
StockObjects[LTGRAY_BRUSH] = NtGdiCreateBrushIndirect(&LtGrayBrush);
|
||||||
GDIOBJ_MarkObjectGlobal(StockObjects[LTGRAY_BRUSH]);
|
|
||||||
StockObjects[GRAY_BRUSH] = NtGdiCreateBrushIndirect(&GrayBrush);
|
StockObjects[GRAY_BRUSH] = NtGdiCreateBrushIndirect(&GrayBrush);
|
||||||
GDIOBJ_MarkObjectGlobal(StockObjects[GRAY_BRUSH]);
|
|
||||||
StockObjects[DKGRAY_BRUSH] = NtGdiCreateBrushIndirect(&DkGrayBrush);
|
StockObjects[DKGRAY_BRUSH] = NtGdiCreateBrushIndirect(&DkGrayBrush);
|
||||||
GDIOBJ_MarkObjectGlobal(StockObjects[DKGRAY_BRUSH]);
|
|
||||||
StockObjects[BLACK_BRUSH] = NtGdiCreateBrushIndirect(&BlackBrush);
|
StockObjects[BLACK_BRUSH] = NtGdiCreateBrushIndirect(&BlackBrush);
|
||||||
GDIOBJ_MarkObjectGlobal(StockObjects[BLACK_BRUSH]);
|
|
||||||
StockObjects[NULL_BRUSH] = NtGdiCreateBrushIndirect(&NullBrush);
|
StockObjects[NULL_BRUSH] = NtGdiCreateBrushIndirect(&NullBrush);
|
||||||
GDIOBJ_MarkObjectGlobal(StockObjects[NULL_BRUSH]);
|
|
||||||
|
|
||||||
StockObjects[WHITE_PEN] = NtGdiCreatePenIndirect(&WhitePen);
|
StockObjects[WHITE_PEN] = NtGdiCreatePenIndirect(&WhitePen);
|
||||||
GDIOBJ_MarkObjectGlobal(StockObjects[WHITE_PEN]);
|
|
||||||
StockObjects[BLACK_PEN] = NtGdiCreatePenIndirect(&BlackPen);
|
StockObjects[BLACK_PEN] = NtGdiCreatePenIndirect(&BlackPen);
|
||||||
GDIOBJ_MarkObjectGlobal(StockObjects[BLACK_PEN]);
|
|
||||||
StockObjects[NULL_PEN] = NtGdiCreatePenIndirect(&NullPen);
|
StockObjects[NULL_PEN] = NtGdiCreatePenIndirect(&NullPen);
|
||||||
GDIOBJ_MarkObjectGlobal(StockObjects[NULL_PEN]);
|
|
||||||
|
|
||||||
(void) TextIntCreateFontIndirect(&OEMFixedFont, (HFONT*)&StockObjects[OEM_FIXED_FONT]);
|
(void) TextIntCreateFontIndirect(&OEMFixedFont, (HFONT*)&StockObjects[OEM_FIXED_FONT]);
|
||||||
GDIOBJ_MarkObjectGlobal(StockObjects[OEM_FIXED_FONT]);
|
|
||||||
(void) TextIntCreateFontIndirect(&AnsiFixedFont, (HFONT*)&StockObjects[ANSI_FIXED_FONT]);
|
(void) TextIntCreateFontIndirect(&AnsiFixedFont, (HFONT*)&StockObjects[ANSI_FIXED_FONT]);
|
||||||
GDIOBJ_MarkObjectGlobal(StockObjects[ANSI_FIXED_FONT]);
|
|
||||||
(void) TextIntCreateFontIndirect(&SystemFont, (HFONT*)&StockObjects[SYSTEM_FONT]);
|
(void) TextIntCreateFontIndirect(&SystemFont, (HFONT*)&StockObjects[SYSTEM_FONT]);
|
||||||
GDIOBJ_MarkObjectGlobal(StockObjects[SYSTEM_FONT]);
|
|
||||||
(void) TextIntCreateFontIndirect(&DeviceDefaultFont, (HFONT*)&StockObjects[DEVICE_DEFAULT_FONT]);
|
(void) TextIntCreateFontIndirect(&DeviceDefaultFont, (HFONT*)&StockObjects[DEVICE_DEFAULT_FONT]);
|
||||||
GDIOBJ_MarkObjectGlobal(StockObjects[DEVICE_DEFAULT_FONT]);
|
|
||||||
(void) TextIntCreateFontIndirect(&SystemFixedFont, (HFONT*)&StockObjects[SYSTEM_FIXED_FONT]);
|
(void) TextIntCreateFontIndirect(&SystemFixedFont, (HFONT*)&StockObjects[SYSTEM_FIXED_FONT]);
|
||||||
GDIOBJ_MarkObjectGlobal(StockObjects[SYSTEM_FIXED_FONT]);
|
|
||||||
(void) TextIntCreateFontIndirect(&DefaultGuiFont, (HFONT*)&StockObjects[DEFAULT_GUI_FONT]);
|
(void) TextIntCreateFontIndirect(&DefaultGuiFont, (HFONT*)&StockObjects[DEFAULT_GUI_FONT]);
|
||||||
GDIOBJ_MarkObjectGlobal(StockObjects[DEFAULT_GUI_FONT]);
|
|
||||||
|
|
||||||
StockObjects[DEFAULT_PALETTE] = (HGDIOBJ*)PALETTE_Init();
|
StockObjects[DEFAULT_PALETTE] = (HGDIOBJ*)PALETTE_Init();
|
||||||
|
|
||||||
|
for (Object = 0; Object < NB_STOCK_OBJECTS; Object++)
|
||||||
|
{
|
||||||
|
GDIOBJ_MarkObjectGlobal(StockObjects[Object]);
|
||||||
|
GDI_HANDLE_SET_STOCKOBJ(StockObjects[Object]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -505,12 +463,9 @@ CreateStockObjects(void)
|
||||||
* \return Handle to the object.
|
* \return Handle to the object.
|
||||||
*/
|
*/
|
||||||
HGDIOBJ STDCALL
|
HGDIOBJ STDCALL
|
||||||
NtGdiGetStockObject(INT Object)
|
NtGdiGetStockObject(INT Object)
|
||||||
{
|
{
|
||||||
// check when adding new objects
|
return ((Object < 0) || (NB_STOCK_OBJECTS <= Object)) ? NULL : StockObjects[Object];
|
||||||
if( (Object < 0) || (Object >= NB_STOCK_OBJECTS) )
|
|
||||||
return NULL;
|
|
||||||
return StockObjects[Object];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -521,7 +476,7 @@ NtGdiGetStockObject(INT Object)
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
NtGdiDeleteObject(HGDIOBJ hObject)
|
NtGdiDeleteObject(HGDIOBJ hObject)
|
||||||
{
|
{
|
||||||
return GDIOBJ_FreeObj( hObject, GO_MAGIC_DONTCARE, GDIOBJFLAG_DEFAULT );
|
return GDIOBJ_FreeObj(hObject, GDI_OBJECT_TYPE_DONTCARE, GDIOBJFLAG_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -535,7 +490,6 @@ CleanupForProcess (struct _EPROCESS *Process, INT Pid)
|
||||||
PGDI_HANDLE_ENTRY handleEntry;
|
PGDI_HANDLE_ENTRY handleEntry;
|
||||||
PGDIOBJHDR objectHeader;
|
PGDIOBJHDR objectHeader;
|
||||||
PEPROCESS CurrentProcess;
|
PEPROCESS CurrentProcess;
|
||||||
//NTSTATUS Status;
|
|
||||||
|
|
||||||
CurrentProcess = PsGetCurrentProcess();
|
CurrentProcess = PsGetCurrentProcess();
|
||||||
if (CurrentProcess != Process)
|
if (CurrentProcess != Process)
|
||||||
|
@ -545,13 +499,15 @@ CleanupForProcess (struct _EPROCESS *Process, INT Pid)
|
||||||
|
|
||||||
for(i = 1; i < GDI_HANDLE_NUMBER; i++)
|
for(i = 1; i < GDI_HANDLE_NUMBER; i++)
|
||||||
{
|
{
|
||||||
handleEntry = GDIOBJ_iGetHandleEntryForIndex((WORD) i & 0xffff);
|
handleEntry = GDIOBJ_iGetHandleEntryForIndex(i);
|
||||||
if (NULL != handleEntry && 0 != handleEntry->wMagic &&
|
if (NULL != handleEntry && NULL != handleEntry->pObject &&
|
||||||
(INT)handleEntry->hProcessId == Pid)
|
(INT)handleEntry->hProcessId == Pid)
|
||||||
{
|
{
|
||||||
objectHeader = (PGDIOBJHDR) handleEntry->pObject;
|
objectHeader = (PGDIOBJHDR) handleEntry->pObject;
|
||||||
DPRINT("\nNtGdiCleanup: %d, magic: %x \n process: %d, locks: %d", i, handleEntry->wMagic, handleEntry->hProcessId, objectHeader->dwCount);
|
DPRINT("\nNtGdiCleanup: %d, process: %d, locks: %d", i, handleEntry->hProcessId, objectHeader->dwCount);
|
||||||
GDIOBJ_FreeObj( GDI_INDEX2HANDLE(i), GO_MAGIC_DONTCARE, GDIOBJFLAG_IGNOREPID|GDIOBJFLAG_IGNORELOCK );
|
GDIOBJ_FreeObj(GDI_HANDLE_CREATE(i, GDI_OBJECT_TYPE_DONTCARE),
|
||||||
|
GDI_OBJECT_TYPE_DONTCARE,
|
||||||
|
GDIOBJFLAG_IGNOREPID|GDIOBJFLAG_IGNORELOCK );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -563,72 +519,57 @@ CleanupForProcess (struct _EPROCESS *Process, INT Pid)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
* Internal function. Dumps all the objects for the given process.
|
|
||||||
* \param If process == 0 dump all the objects.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
VOID STDCALL
|
|
||||||
NtGdiDumpGdiObjects( INT Process )
|
|
||||||
{
|
|
||||||
DWORD i;
|
|
||||||
PGDI_HANDLE_ENTRY handleEntry;
|
|
||||||
PGDIOBJHDR objectHeader;
|
|
||||||
|
|
||||||
for( i=1; i < GDI_HANDLE_NUMBER; i++ ){
|
|
||||||
handleEntry = GDIOBJ_iGetHandleEntryForIndex ((WORD) i & 0xffff);
|
|
||||||
if( handleEntry && handleEntry->wMagic != 0 ){
|
|
||||||
objectHeader = (PGDIOBJHDR) handleEntry->pObject;
|
|
||||||
DPRINT("\nHandle: %d, magic: %x \n process: %d, locks: %d", i, handleEntry->wMagic, handleEntry->hProcessId, objectHeader->dwCount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#define GDIOBJ_TRACKLOCKS
|
#define GDIOBJ_TRACKLOCKS
|
||||||
|
|
||||||
#ifdef GDIOBJ_LockObj
|
#ifdef GDIOBJ_LockObj
|
||||||
#undef GDIOBJ_LockObj
|
#undef GDIOBJ_LockObj
|
||||||
PGDIOBJ FASTCALL
|
PGDIOBJ FASTCALL
|
||||||
GDIOBJ_LockObjDbg ( const char* file, int line, HGDIOBJ hObj, WORD Magic )
|
GDIOBJ_LockObjDbg (const char* file, int line, HGDIOBJ hObj, DWORD ObjectType)
|
||||||
{
|
{
|
||||||
PGDIOBJ rc;
|
PGDIOBJ rc;
|
||||||
PGDI_HANDLE_ENTRY handleEntry
|
PGDI_HANDLE_ENTRY handleEntry
|
||||||
= GDIOBJ_iGetHandleEntryForIndex ( GDI_HANDLE2INDEX(hObj) );
|
= GDIOBJ_iGetHandleEntryForIndex(GDI_HANDLE_GET_INDEX(hObj));
|
||||||
if ( handleEntry == 0
|
if (NULL == handleEntry
|
||||||
|| (handleEntry->wMagic != Magic && Magic != GO_MAGIC_DONTCARE )
|
|| (GDI_HANDLE_GET_TYPE(hObj) != ObjectType && ObjectType != GDI_OBJECT_TYPE_DONTCARE)
|
||||||
|| (handleEntry->hProcessId != (HANDLE)0xFFFFFFFF
|
|| (handleEntry->hProcessId != (HANDLE)0xFFFFFFFF
|
||||||
&& handleEntry->hProcessId != PsGetCurrentProcessId ()
|
&& handleEntry->hProcessId != PsGetCurrentProcessId ()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int reason = 0;
|
int reason = 0;
|
||||||
if ( handleEntry == 0 )
|
if (NULL == handleEntry)
|
||||||
reason = 1;
|
{
|
||||||
else if ( handleEntry->wMagic != Magic && Magic != GO_MAGIC_DONTCARE )
|
reason = 1;
|
||||||
reason = 2;
|
}
|
||||||
else if ( handleEntry->hProcessId != (HANDLE)0xFFFFFFFF
|
else if (GDI_HANDLE_GET_TYPE(hObj) != ObjectType && ObjectType != GDI_OBJECT_TYPE_DONTCARE)
|
||||||
&& handleEntry->hProcessId != PsGetCurrentProcessId () )
|
{
|
||||||
reason = 3;
|
reason = 2;
|
||||||
|
}
|
||||||
|
else if (handleEntry->hProcessId != (HANDLE)0xFFFFFFFF
|
||||||
|
&& handleEntry->hProcessId != PsGetCurrentProcessId())
|
||||||
|
{
|
||||||
|
reason = 3;
|
||||||
|
}
|
||||||
|
|
||||||
DPRINT1("GDIOBJ_LockObj failed for %d, magic: %d, reqMagic %d reason %d\n",
|
DPRINT1("GDIOBJ_LockObj failed for 0x%08x, reqtype 0x%08x reason %d\n",
|
||||||
(WORD)((size_t)hObj&0xffff), handleEntry->wMagic, Magic, reason );
|
hObj, ObjectType, reason );
|
||||||
DPRINT1("\tcalled from: %s:%i\n", file, line );
|
DPRINT1("\tcalled from: %s:%i\n", file, line );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if ( handleEntry->lockfile )
|
if (NULL != handleEntry->lockfile)
|
||||||
{
|
{
|
||||||
DPRINT1("Caution! GDIOBJ_LockObj trying to lock object (0x%x) second time\n", hObj );
|
DPRINT1("Caution! GDIOBJ_LockObj trying to lock object (0x%x) second time\n", hObj );
|
||||||
DPRINT1("\tcalled from: %s:%i\n", file, line );
|
DPRINT1("\tcalled from: %s:%i\n", file, line );
|
||||||
DPRINT1("\tpreviously locked from: %s:%i\n", handleEntry->lockfile, handleEntry->lockline );
|
DPRINT1("\tpreviously locked from: %s:%i\n", handleEntry->lockfile, handleEntry->lockline );
|
||||||
}
|
}
|
||||||
//DbgPrint("(%s:%i) GDIOBJ_LockObj(0x%x,0x%x)\n", file, line, hObj, Magic );
|
DPRINT("(%s:%i) GDIOBJ_LockObj(0x%08x,0x%08x)\n", file, line, hObj, ObjectType);
|
||||||
rc = GDIOBJ_LockObj(hObj,Magic);
|
rc = GDIOBJ_LockObj(hObj, ObjectType);
|
||||||
if ( rc && !handleEntry->lockfile )
|
if (rc && NULL == handleEntry->lockfile)
|
||||||
{
|
{
|
||||||
handleEntry->lockfile = file;
|
handleEntry->lockfile = file;
|
||||||
handleEntry->lockline = line;
|
handleEntry->lockline = line;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
#endif//GDIOBJ_LockObj
|
#endif//GDIOBJ_LockObj
|
||||||
|
@ -636,26 +577,26 @@ GDIOBJ_LockObjDbg ( const char* file, int line, HGDIOBJ hObj, WORD Magic )
|
||||||
#ifdef GDIOBJ_UnlockObj
|
#ifdef GDIOBJ_UnlockObj
|
||||||
#undef GDIOBJ_UnlockObj
|
#undef GDIOBJ_UnlockObj
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
GDIOBJ_UnlockObjDbg ( const char* file, int line, HGDIOBJ hObj, WORD Magic )
|
GDIOBJ_UnlockObjDbg (const char* file, int line, HGDIOBJ hObj, DWORD ObjectType)
|
||||||
{
|
{
|
||||||
PGDI_HANDLE_ENTRY handleEntry
|
PGDI_HANDLE_ENTRY handleEntry
|
||||||
= GDIOBJ_iGetHandleEntryForIndex ( GDI_HANDLE2INDEX(hObj) );
|
= GDIOBJ_iGetHandleEntryForIndex (GDI_HANDLE_GET_INDEX(hObj));
|
||||||
if ( handleEntry == 0
|
if (NULL == handleEntry
|
||||||
|| (handleEntry->wMagic != Magic && Magic != GO_MAGIC_DONTCARE )
|
|| (GDI_HANDLE_GET_TYPE(hObj) != ObjectType && ObjectType != GDI_OBJECT_TYPE_DONTCARE)
|
||||||
|| (handleEntry->hProcessId != (HANDLE)0xFFFFFFFF
|
|| (handleEntry->hProcessId != (HANDLE)0xFFFFFFFF
|
||||||
&& handleEntry->hProcessId != PsGetCurrentProcessId ()
|
&& handleEntry->hProcessId != PsGetCurrentProcessId ()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
DPRINT1("GDIBOJ_UnlockObj failed for %d, magic: %d, reqMagic\n",
|
DPRINT1("GDIBOJ_UnlockObj failed for 0x%08x, reqtype 0x%08x\n",
|
||||||
(WORD)((size_t)hObj & 0xffff), handleEntry->wMagic, Magic );
|
hObj, ObjectType);
|
||||||
DPRINT1("\tcalled from: %s:%i\n", file, line );
|
DPRINT1("\tcalled from: %s:%i\n", file, line);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
//DbgPrint("(%s:%i) GDIOBJ_UnlockObj(0x%x,0x%x)\n", file, line, hObj, Magic );
|
DPRINT("(%s:%i) GDIOBJ_UnlockObj(0x%08x,0x%08x)\n", file, line, hObj, ObjectType);
|
||||||
handleEntry->lockfile = NULL;
|
handleEntry->lockfile = NULL;
|
||||||
handleEntry->lockline = 0;
|
handleEntry->lockline = 0;
|
||||||
return GDIOBJ_UnlockObj(hObj,Magic);
|
return GDIOBJ_UnlockObj(hObj, ObjectType);
|
||||||
}
|
}
|
||||||
#endif//GDIOBJ_LockObj
|
#endif//GDIOBJ_LockObj
|
||||||
|
|
||||||
|
@ -663,39 +604,39 @@ GDIOBJ_UnlockObjDbg ( const char* file, int line, HGDIOBJ hObj, WORD Magic )
|
||||||
* Return pointer to the object by handle.
|
* Return pointer to the object by handle.
|
||||||
*
|
*
|
||||||
* \param hObj Object handle
|
* \param hObj Object handle
|
||||||
* \param Magic one of the magic numbers defined in \ref GDI Magic
|
* \param ObjectType one of the object types defined in \ref GDI object types
|
||||||
* \return Pointer to the object.
|
* \return Pointer to the object.
|
||||||
*
|
*
|
||||||
* \note Process can only get pointer to the objects it created or global objects.
|
* \note Process can only get pointer to the objects it created or global objects.
|
||||||
*
|
*
|
||||||
* \todo Don't allow to lock the objects twice! Synchronization!
|
* \todo Don't allow to lock the objects twice! Synchronization!
|
||||||
*/
|
*/
|
||||||
PGDIOBJ FASTCALL
|
PGDIOBJ FASTCALL
|
||||||
GDIOBJ_LockObj( HGDIOBJ hObj, WORD Magic )
|
GDIOBJ_LockObj(HGDIOBJ hObj, DWORD ObjectType)
|
||||||
{
|
{
|
||||||
PGDI_HANDLE_ENTRY handleEntry
|
PGDI_HANDLE_ENTRY handleEntry
|
||||||
= GDIOBJ_iGetHandleEntryForIndex ( GDI_HANDLE2INDEX(hObj) );
|
= GDIOBJ_iGetHandleEntryForIndex(GDI_HANDLE_GET_INDEX(hObj));
|
||||||
PGDIOBJHDR objectHeader;
|
PGDIOBJHDR objectHeader;
|
||||||
|
|
||||||
DPRINT("GDIOBJ_LockObj: hObj: %d, magic: %x, \n handleEntry: %x, mag %x\n", hObj, Magic, handleEntry, handleEntry->wMagic);
|
DPRINT("GDIOBJ_LockObj: hObj: 0x%08x, type: 0x%08x, handleEntry: %x\n", hObj, ObjectType, handleEntry);
|
||||||
if ( handleEntry == 0
|
if (NULL == handleEntry
|
||||||
|| (handleEntry->wMagic != Magic && Magic != GO_MAGIC_DONTCARE )
|
|| (GDI_HANDLE_GET_TYPE(hObj) != ObjectType && ObjectType != GDI_OBJECT_TYPE_DONTCARE)
|
||||||
|| (handleEntry->hProcessId != (HANDLE)0xFFFFFFFF
|
|| (handleEntry->hProcessId != (HANDLE)0xFFFFFFFF
|
||||||
&& handleEntry->hProcessId != PsGetCurrentProcessId ()
|
&& handleEntry->hProcessId != PsGetCurrentProcessId()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
DPRINT1("GDIBOJ_LockObj failed for %d, magic: %d, reqMagic\n",
|
DPRINT1("GDIBOJ_LockObj failed for 0x%08x, type 0x%08x\n",
|
||||||
(WORD)((size_t)hObj & 0xffff), handleEntry->wMagic, Magic);
|
hObj, ObjectType);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
objectHeader = (PGDIOBJHDR) handleEntry->pObject;
|
objectHeader = (PGDIOBJHDR) handleEntry->pObject;
|
||||||
ASSERT(objectHeader);
|
ASSERT(objectHeader);
|
||||||
if( objectHeader->dwCount > 0 )
|
if(0 < objectHeader->dwCount)
|
||||||
{
|
{
|
||||||
DbgPrint("Caution! GDIOBJ_LockObj trying to lock object (0x%x) second time\n", hObj );
|
DPRINT1("Caution! GDIOBJ_LockObj trying to lock object (0x%x) second time\n", hObj);
|
||||||
DbgPrint("\t called from: %x\n", __builtin_return_address(0));
|
DPRINT1("\t called from: %x\n", __builtin_return_address(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
ExAcquireFastMutex(&RefCountHandling);
|
ExAcquireFastMutex(&RefCountHandling);
|
||||||
|
@ -709,7 +650,7 @@ GDIOBJ_LockObj( HGDIOBJ hObj, WORD Magic )
|
||||||
* as soon as you don't need to have access to it's data.
|
* as soon as you don't need to have access to it's data.
|
||||||
|
|
||||||
* \param hObj Object handle
|
* \param hObj Object handle
|
||||||
* \param Magic one of the magic numbers defined in \ref GDI Magic
|
* \param ObjectType one of the object types defined in \ref GDI object types
|
||||||
*
|
*
|
||||||
* \note This function performs delayed cleanup. If the object is locked when GDI_FreeObj() is called
|
* \note This function performs delayed cleanup. If the object is locked when GDI_FreeObj() is called
|
||||||
* then \em this function frees the object when reference count is zero.
|
* then \em this function frees the object when reference count is zero.
|
||||||
|
@ -718,18 +659,18 @@ GDIOBJ_LockObj( HGDIOBJ hObj, WORD Magic )
|
||||||
*/
|
*/
|
||||||
#undef GDIOBJ_UnlockObj
|
#undef GDIOBJ_UnlockObj
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
GDIOBJ_UnlockObj( HGDIOBJ hObj, WORD Magic )
|
GDIOBJ_UnlockObj(HGDIOBJ hObj, DWORD ObjectType)
|
||||||
{
|
{
|
||||||
PGDI_HANDLE_ENTRY handleEntry
|
PGDI_HANDLE_ENTRY handleEntry
|
||||||
= GDIOBJ_iGetHandleEntryForIndex ( GDI_HANDLE2INDEX(hObj) );
|
= GDIOBJ_iGetHandleEntryForIndex(GDI_HANDLE_GET_INDEX(hObj));
|
||||||
PGDIOBJHDR objectHeader;
|
PGDIOBJHDR objectHeader;
|
||||||
|
|
||||||
DPRINT("GDIOBJ_UnlockObj: hObj: %d, magic: %x, \n handleEntry: %x\n", hObj, Magic, handleEntry);
|
DPRINT("GDIOBJ_UnlockObj: hObj: 0x%08x, type: 0x%08x, handleEntry: %x\n", hObj, ObjectType, handleEntry);
|
||||||
if ( handleEntry == 0
|
if (NULL == handleEntry
|
||||||
|| (handleEntry->wMagic != Magic && Magic != GO_MAGIC_DONTCARE )
|
|| (GDI_HANDLE_GET_TYPE(hObj) != ObjectType && ObjectType != GDI_OBJECT_TYPE_DONTCARE)
|
||||||
|| (handleEntry->hProcessId != (HANDLE)0xFFFFFFFF
|
|| (handleEntry->hProcessId != (HANDLE)0xFFFFFFFF
|
||||||
&& handleEntry->hProcessId != PsGetCurrentProcessId ()
|
&& handleEntry->hProcessId != PsGetCurrentProcessId ()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
DPRINT1( "GDIOBJ_UnLockObj: failed\n");
|
DPRINT1( "GDIOBJ_UnLockObj: failed\n");
|
||||||
|
@ -740,26 +681,26 @@ GDIOBJ_UnlockObj( HGDIOBJ hObj, WORD Magic )
|
||||||
ASSERT(objectHeader);
|
ASSERT(objectHeader);
|
||||||
|
|
||||||
ExAcquireFastMutex(&RefCountHandling);
|
ExAcquireFastMutex(&RefCountHandling);
|
||||||
if( ( objectHeader->dwCount & ~0x80000000 ) == 0 )
|
if (0 == (objectHeader->dwCount & ~0x80000000))
|
||||||
{
|
{
|
||||||
ExReleaseFastMutex(&RefCountHandling);
|
ExReleaseFastMutex(&RefCountHandling);
|
||||||
DPRINT( "GDIOBJ_UnLockObj: unlock object (0x%x) that is not locked\n", hObj );
|
DPRINT1( "GDIOBJ_UnLockObj: unlock object (0x%x) that is not locked\n", hObj );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
objectHeader = (PGDIOBJHDR) handleEntry->pObject;
|
|
||||||
ASSERT(objectHeader);
|
|
||||||
objectHeader->dwCount--;
|
objectHeader->dwCount--;
|
||||||
|
|
||||||
if( objectHeader->dwCount == 0x80000000 )
|
if( objectHeader->dwCount == 0x80000000 )
|
||||||
{
|
{
|
||||||
//delayed object release
|
//delayed object release
|
||||||
objectHeader->dwCount = 0;
|
objectHeader->dwCount = 0;
|
||||||
ExReleaseFastMutex(&RefCountHandling);
|
ExReleaseFastMutex(&RefCountHandling);
|
||||||
DPRINT("GDIOBJ_UnlockObj: delayed delete\n");
|
DPRINT("GDIOBJ_UnlockObj: delayed delete\n");
|
||||||
return GDIOBJ_FreeObj( hObj, Magic, GDIOBJFLAG_DEFAULT );
|
return GDIOBJ_FreeObj(hObj, ObjectType, GDIOBJFLAG_DEFAULT);
|
||||||
}
|
}
|
||||||
ExReleaseFastMutex(&RefCountHandling);
|
ExReleaseFastMutex(&RefCountHandling);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: line.c,v 1.20 2003/08/19 11:48:50 weiden Exp $ */
|
/* $Id: line.c,v 1.21 2003/08/20 07:45:02 gvg Exp $ */
|
||||||
|
|
||||||
// Some code from the WINE project source (www.winehq.com)
|
// Some code from the WINE project source (www.winehq.com)
|
||||||
|
|
||||||
|
@ -62,12 +62,12 @@ NtGdiArc(HDC hDC,
|
||||||
int XEndArc,
|
int XEndArc,
|
||||||
int YEndArc)
|
int YEndArc)
|
||||||
{
|
{
|
||||||
DC *dc = DC_HandleToPtr(hDC);
|
DC *dc = DC_LockDc(hDC);
|
||||||
if(!dc) return FALSE;
|
if(!dc) return FALSE;
|
||||||
|
|
||||||
if(PATH_IsPathOpen(dc->w.path))
|
if(PATH_IsPathOpen(dc->w.path))
|
||||||
{
|
{
|
||||||
DC_ReleasePtr ( hDC );
|
DC_UnlockDc ( hDC );
|
||||||
return PATH_Arc(hDC, LeftRect, TopRect, RightRect, BottomRect,
|
return PATH_Arc(hDC, LeftRect, TopRect, RightRect, BottomRect,
|
||||||
XStartArc, YStartArc, XEndArc, YEndArc);
|
XStartArc, YStartArc, XEndArc, YEndArc);
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ NtGdiArc(HDC hDC,
|
||||||
// EngArc(dc, LeftRect, TopRect, RightRect, BottomRect, UNIMPLEMENTED
|
// EngArc(dc, LeftRect, TopRect, RightRect, BottomRect, UNIMPLEMENTED
|
||||||
// XStartArc, YStartArc, XEndArc, YEndArc);
|
// XStartArc, YStartArc, XEndArc, YEndArc);
|
||||||
|
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ NtGdiArcTo(HDC hDC,
|
||||||
if ( !NtGdiLineTo(hDC, XRadial1, YRadial1) )
|
if ( !NtGdiLineTo(hDC, XRadial1, YRadial1) )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
//dc = DC_HandleToPtr(hDC);
|
//dc = DC_LockDc(hDC);
|
||||||
|
|
||||||
//if(!dc) return FALSE;
|
//if(!dc) return FALSE;
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ NtGdiArcTo(HDC hDC,
|
||||||
result = NtGdiArc(hDC, LeftRect, TopRect, RightRect, BottomRect,
|
result = NtGdiArc(hDC, LeftRect, TopRect, RightRect, BottomRect,
|
||||||
XRadial1, YRadial1, XRadial2, YRadial2);
|
XRadial1, YRadial1, XRadial2, YRadial2);
|
||||||
|
|
||||||
//DC_ReleasePtr( hDC );
|
//DC_UnlockDc( hDC );
|
||||||
|
|
||||||
// If no error occured, the current position is moved to the ending point of the arc.
|
// If no error occured, the current position is moved to the ending point of the arc.
|
||||||
if(result)
|
if(result)
|
||||||
|
@ -128,13 +128,13 @@ INT
|
||||||
STDCALL
|
STDCALL
|
||||||
NtGdiGetArcDirection(HDC hDC)
|
NtGdiGetArcDirection(HDC hDC)
|
||||||
{
|
{
|
||||||
PDC dc = DC_HandleToPtr (hDC);
|
PDC dc = DC_LockDc (hDC);
|
||||||
int ret = 0; // default to failure
|
int ret = 0; // default to failure
|
||||||
|
|
||||||
if ( dc )
|
if ( dc )
|
||||||
{
|
{
|
||||||
ret = IntGetArcDirection ( dc );
|
ret = IntGetArcDirection ( dc );
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -146,7 +146,7 @@ NtGdiLineTo(HDC hDC,
|
||||||
int XEnd,
|
int XEnd,
|
||||||
int YEnd)
|
int YEnd)
|
||||||
{
|
{
|
||||||
DC *dc = DC_HandleToPtr(hDC);
|
DC *dc = DC_LockDc(hDC);
|
||||||
SURFOBJ *SurfObj;
|
SURFOBJ *SurfObj;
|
||||||
BOOL Ret;
|
BOOL Ret;
|
||||||
BRUSHOBJ PenBrushObj;
|
BRUSHOBJ PenBrushObj;
|
||||||
|
@ -162,15 +162,15 @@ NtGdiLineTo(HDC hDC,
|
||||||
|
|
||||||
if (PATH_IsPathOpen(dc->w.path))
|
if (PATH_IsPathOpen(dc->w.path))
|
||||||
{
|
{
|
||||||
DC_ReleasePtr(hDC);
|
DC_UnlockDc(hDC);
|
||||||
Ret = PATH_LineTo(hDC, XEnd, YEnd);
|
Ret = PATH_LineTo(hDC, XEnd, YEnd);
|
||||||
if (Ret)
|
if (Ret)
|
||||||
{
|
{
|
||||||
// FIXME - PATH_LineTo should maybe do this...
|
// FIXME - PATH_LineTo should maybe do this...
|
||||||
dc = DC_HandleToPtr(hDC);
|
dc = DC_LockDc(hDC);
|
||||||
dc->w.CursPosX = XEnd;
|
dc->w.CursPosX = XEnd;
|
||||||
dc->w.CursPosY = YEnd;
|
dc->w.CursPosY = YEnd;
|
||||||
DC_ReleasePtr(hDC);
|
DC_UnlockDc(hDC);
|
||||||
}
|
}
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
@ -218,7 +218,7 @@ NtGdiLineTo(HDC hDC,
|
||||||
dc->w.CursPosX = XEnd;
|
dc->w.CursPosX = XEnd;
|
||||||
dc->w.CursPosY = YEnd;
|
dc->w.CursPosY = YEnd;
|
||||||
}
|
}
|
||||||
DC_ReleasePtr(hDC);
|
DC_UnlockDc(hDC);
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
@ -230,7 +230,7 @@ NtGdiMoveToEx(HDC hDC,
|
||||||
int Y,
|
int Y,
|
||||||
LPPOINT Point)
|
LPPOINT Point)
|
||||||
{
|
{
|
||||||
DC *dc = DC_HandleToPtr( hDC );
|
DC *dc = DC_LockDc( hDC );
|
||||||
BOOL PathIsOpen;
|
BOOL PathIsOpen;
|
||||||
|
|
||||||
if ( !dc ) return FALSE;
|
if ( !dc ) return FALSE;
|
||||||
|
@ -245,7 +245,7 @@ NtGdiMoveToEx(HDC hDC,
|
||||||
|
|
||||||
PathIsOpen = PATH_IsPathOpen(dc->w.path);
|
PathIsOpen = PATH_IsPathOpen(dc->w.path);
|
||||||
|
|
||||||
DC_ReleasePtr ( hDC );
|
DC_UnlockDc ( hDC );
|
||||||
|
|
||||||
if ( PathIsOpen )
|
if ( PathIsOpen )
|
||||||
return PATH_MoveTo ( hDC );
|
return PATH_MoveTo ( hDC );
|
||||||
|
@ -259,14 +259,14 @@ NtGdiPolyBezier(HDC hDC,
|
||||||
CONST LPPOINT pt,
|
CONST LPPOINT pt,
|
||||||
DWORD Count)
|
DWORD Count)
|
||||||
{
|
{
|
||||||
DC *dc = DC_HandleToPtr(hDC);
|
DC *dc = DC_LockDc(hDC);
|
||||||
BOOL ret = FALSE; // default to FAILURE
|
BOOL ret = FALSE; // default to FAILURE
|
||||||
|
|
||||||
if ( !dc ) return FALSE;
|
if ( !dc ) return FALSE;
|
||||||
|
|
||||||
if ( PATH_IsPathOpen(dc->w.path) )
|
if ( PATH_IsPathOpen(dc->w.path) )
|
||||||
{
|
{
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
return PATH_PolyBezier ( hDC, pt, Count );
|
return PATH_PolyBezier ( hDC, pt, Count );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,7 +283,7 @@ NtGdiPolyBezier(HDC hDC,
|
||||||
ExFreePool(Pts);
|
ExFreePool(Pts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ NtGdiPolyBezierTo(HDC hDC,
|
||||||
CONST LPPOINT pt,
|
CONST LPPOINT pt,
|
||||||
DWORD Count)
|
DWORD Count)
|
||||||
{
|
{
|
||||||
DC *dc = DC_HandleToPtr(hDC);
|
DC *dc = DC_LockDc(hDC);
|
||||||
BOOL ret = FALSE; // default to failure
|
BOOL ret = FALSE; // default to failure
|
||||||
|
|
||||||
if ( !dc ) return ret;
|
if ( !dc ) return ret;
|
||||||
|
@ -318,7 +318,7 @@ NtGdiPolyBezierTo(HDC hDC,
|
||||||
dc->w.CursPosX = pt[Count-1].x;
|
dc->w.CursPosX = pt[Count-1].x;
|
||||||
dc->w.CursPosY = pt[Count-1].y;
|
dc->w.CursPosY = pt[Count-1].y;
|
||||||
}
|
}
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ IntPolyline(PDC dc,
|
||||||
if ( PATH_IsPathOpen ( dc->w.path ) )
|
if ( PATH_IsPathOpen ( dc->w.path ) )
|
||||||
return PATH_Polyline ( dc, pt, Count );
|
return PATH_Polyline ( dc, pt, Count );
|
||||||
|
|
||||||
reg = (PROSRGNDATA)GDIOBJ_LockObj(dc->w.hGCClipRgn, GO_REGION_MAGIC);
|
reg = RGNDATA_LockRgn(dc->w.hGCClipRgn);
|
||||||
|
|
||||||
//FIXME: Do somthing with reg...
|
//FIXME: Do somthing with reg...
|
||||||
|
|
||||||
|
@ -385,7 +385,7 @@ IntPolyline(PDC dc,
|
||||||
}
|
}
|
||||||
|
|
||||||
//Clean up
|
//Clean up
|
||||||
GDIOBJ_UnlockObj ( dc->w.hGCClipRgn, GO_REGION_MAGIC );
|
RGNDATA_UnlockRgn(dc->w.hGCClipRgn);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -396,14 +396,14 @@ NtGdiPolyline(HDC hDC,
|
||||||
CONST LPPOINT pt,
|
CONST LPPOINT pt,
|
||||||
int Count)
|
int Count)
|
||||||
{
|
{
|
||||||
DC *dc = DC_HandleToPtr(hDC);
|
DC *dc = DC_LockDc(hDC);
|
||||||
BOOL ret = FALSE; // default to failure
|
BOOL ret = FALSE; // default to failure
|
||||||
|
|
||||||
if ( dc )
|
if ( dc )
|
||||||
{
|
{
|
||||||
ret = IntPolyline ( dc, pt, Count );
|
ret = IntPolyline ( dc, pt, Count );
|
||||||
|
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -415,7 +415,7 @@ NtGdiPolylineTo(HDC hDC,
|
||||||
CONST LPPOINT pt,
|
CONST LPPOINT pt,
|
||||||
DWORD Count)
|
DWORD Count)
|
||||||
{
|
{
|
||||||
DC *dc = DC_HandleToPtr(hDC);
|
DC *dc = DC_LockDc(hDC);
|
||||||
BOOL ret = FALSE; // default to failure
|
BOOL ret = FALSE; // default to failure
|
||||||
|
|
||||||
if ( !dc ) return ret;
|
if ( !dc ) return ret;
|
||||||
|
@ -441,7 +441,7 @@ NtGdiPolylineTo(HDC hDC,
|
||||||
dc->w.CursPosX = pt[Count-1].x;
|
dc->w.CursPosX = pt[Count-1].x;
|
||||||
dc->w.CursPosY = pt[Count-1].y;
|
dc->w.CursPosY = pt[Count-1].y;
|
||||||
}
|
}
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -463,7 +463,7 @@ NtGdiSetArcDirection(HDC hDC,
|
||||||
PDC dc;
|
PDC dc;
|
||||||
INT nOldDirection = 0; // default to FAILURE
|
INT nOldDirection = 0; // default to FAILURE
|
||||||
|
|
||||||
dc = DC_HandleToPtr (hDC);
|
dc = DC_LockDc (hDC);
|
||||||
if ( !dc ) return 0;
|
if ( !dc ) return 0;
|
||||||
|
|
||||||
if ( ArcDirection == AD_COUNTERCLOCKWISE || ArcDirection == AD_CLOCKWISE )
|
if ( ArcDirection == AD_COUNTERCLOCKWISE || ArcDirection == AD_CLOCKWISE )
|
||||||
|
@ -472,7 +472,7 @@ NtGdiSetArcDirection(HDC hDC,
|
||||||
dc->w.ArcDirection = ArcDirection;
|
dc->w.ArcDirection = ArcDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
return nOldDirection;
|
return nOldDirection;
|
||||||
}
|
}
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: objconv.c,v 1.11 2003/08/17 17:32:58 royce Exp $ */
|
/* $Id: objconv.c,v 1.12 2003/08/20 07:45:02 gvg Exp $ */
|
||||||
|
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
@ -60,10 +60,10 @@ HPenToBrushObj ( BRUSHOBJ *brush, HPEN hpen )
|
||||||
PENOBJ *pen;
|
PENOBJ *pen;
|
||||||
ASSERT ( hpen );
|
ASSERT ( hpen );
|
||||||
ASSERT ( brush );
|
ASSERT ( brush );
|
||||||
pen = (PPENOBJ)GDIOBJ_LockObj ( hpen, GO_PEN_MAGIC );
|
pen = PENOBJ_LockPen(hpen);
|
||||||
ASSERT ( pen );
|
ASSERT ( pen );
|
||||||
PenToBrushObj ( brush, pen );
|
PenToBrushObj ( brush, pen );
|
||||||
GDIOBJ_UnlockObj ( hpen, GO_PEN_MAGIC );
|
PENOBJ_UnlockPen(hpen);
|
||||||
return brush;
|
return brush;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: path.c,v 1.14 2003/08/19 11:48:50 weiden Exp $ */
|
/* $Id: path.c,v 1.15 2003/08/20 07:45:02 gvg Exp $ */
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
|
@ -69,13 +69,13 @@ BOOL
|
||||||
STDCALL
|
STDCALL
|
||||||
NtGdiCloseFigure ( HDC hDC )
|
NtGdiCloseFigure ( HDC hDC )
|
||||||
{
|
{
|
||||||
PDC dc = DC_HandleToPtr ( hDC );
|
PDC dc = DC_LockDc ( hDC );
|
||||||
BOOL ret = FALSE; // default to failure
|
BOOL ret = FALSE; // default to failure
|
||||||
|
|
||||||
if ( dc )
|
if ( dc )
|
||||||
{
|
{
|
||||||
ret = IntCloseFigure ( dc );
|
ret = IntCloseFigure ( dc );
|
||||||
DC_ReleasePtr ( hDC );
|
DC_UnlockDc ( hDC );
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: region.c,v 1.34 2003/08/19 11:48:50 weiden Exp $ */
|
/* $Id: region.c,v 1.35 2003/08/20 07:45:02 gvg Exp $ */
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
|
@ -338,7 +338,7 @@ HRGN STDCALL REGION_CropRgn(HRGN hDst, HRGN hSrc, const PRECT lpRect, PPOINT lpP
|
||||||
{
|
{
|
||||||
PROSRGNDATA objSrc, rgnDst;
|
PROSRGNDATA objSrc, rgnDst;
|
||||||
HRGN hNewDst, hRet = NULL;
|
HRGN hNewDst, hRet = NULL;
|
||||||
GDIMULTILOCK Lock[2] = {{hDst, 0, GO_REGION_MAGIC}, {hSrc, 0, GO_REGION_MAGIC}};
|
GDIMULTILOCK Lock[2] = {{hDst, 0, GDI_OBJECT_TYPE_REGION}, {hSrc, 0, GDI_OBJECT_TYPE_REGION}};
|
||||||
|
|
||||||
if( !hDst )
|
if( !hDst )
|
||||||
{
|
{
|
||||||
|
@ -1381,7 +1381,7 @@ BOOL STDCALL REGION_LPTODP(HDC hdc, HRGN hDest, HRGN hSrc)
|
||||||
PROSRGNDATA srcObj = NULL;
|
PROSRGNDATA srcObj = NULL;
|
||||||
PROSRGNDATA destObj = NULL;
|
PROSRGNDATA destObj = NULL;
|
||||||
|
|
||||||
DC * dc = DC_HandleToPtr(hdc);
|
DC * dc = DC_LockDc(hdc);
|
||||||
RECT tmpRect;
|
RECT tmpRect;
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
|
|
||||||
|
@ -1429,7 +1429,7 @@ BOOL STDCALL REGION_LPTODP(HDC hdc, HRGN hDest, HRGN hSrc)
|
||||||
RGNDATA_UnlockRgn( hDest );
|
RGNDATA_UnlockRgn( hDest );
|
||||||
|
|
||||||
done:
|
done:
|
||||||
DC_ReleasePtr( hdc );
|
DC_UnlockDc( hdc );
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1439,8 +1439,9 @@ HRGN FASTCALL RGNDATA_AllocRgn(INT n)
|
||||||
PROSRGNDATA pReg;
|
PROSRGNDATA pReg;
|
||||||
BOOL bRet;
|
BOOL bRet;
|
||||||
|
|
||||||
if((hReg = (HRGN)GDIOBJ_AllocObj(sizeof(ROSRGNDATA), GO_REGION_MAGIC))){
|
if((hReg = (HRGN)GDIOBJ_AllocObj(sizeof(ROSRGNDATA), GDI_OBJECT_TYPE_REGION,
|
||||||
if( (pReg = GDIOBJ_LockObj( hReg, GO_REGION_MAGIC )) ){
|
(GDICLEANUPPROC) RGNDATA_InternalDelete))){
|
||||||
|
if( (pReg = RGNDATA_LockRgn(hReg)) ){
|
||||||
|
|
||||||
if ((pReg->Buffer = ExAllocatePool(PagedPool, n * sizeof(RECT)))){
|
if ((pReg->Buffer = ExAllocatePool(PagedPool, n * sizeof(RECT)))){
|
||||||
EMPTY_REGION(pReg);
|
EMPTY_REGION(pReg);
|
||||||
|
@ -1448,7 +1449,7 @@ HRGN FASTCALL RGNDATA_AllocRgn(INT n)
|
||||||
pReg->rdh.nCount = n;
|
pReg->rdh.nCount = n;
|
||||||
pReg->rdh.nRgnSize = n*sizeof(RECT);
|
pReg->rdh.nRgnSize = n*sizeof(RECT);
|
||||||
|
|
||||||
bRet = GDIOBJ_UnlockObj( hReg, GO_REGION_MAGIC );
|
bRet = RGNDATA_UnlockRgn(hReg);
|
||||||
ASSERT(bRet);
|
ASSERT(bRet);
|
||||||
|
|
||||||
return hReg;
|
return hReg;
|
||||||
|
@ -1456,7 +1457,7 @@ HRGN FASTCALL RGNDATA_AllocRgn(INT n)
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
GDIOBJ_FreeObj( hReg, GO_REGION_MAGIC, GDIOBJFLAG_DEFAULT );
|
RGNDATA_FreeRgn(hReg);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1478,7 +1479,7 @@ NtGdiCombineRgn(HRGN hDest,
|
||||||
INT CombineMode)
|
INT CombineMode)
|
||||||
{
|
{
|
||||||
INT result = ERROR;
|
INT result = ERROR;
|
||||||
GDIMULTILOCK Lock[3] = {{hDest, 0, GO_REGION_MAGIC}, {hSrc1, 0, GO_REGION_MAGIC}, {hSrc2, 0, GO_REGION_MAGIC}};
|
GDIMULTILOCK Lock[3] = {{hDest, 0, GDI_OBJECT_TYPE_REGION}, {hSrc1, 0, GDI_OBJECT_TYPE_REGION}, {hSrc2, 0, GDI_OBJECT_TYPE_REGION}};
|
||||||
PROSRGNDATA destRgn, src1Rgn, src2Rgn;
|
PROSRGNDATA destRgn, src1Rgn, src2Rgn;
|
||||||
|
|
||||||
if ( !GDIOBJ_LockMultipleObj(Lock, sizeof(Lock)/sizeof(Lock[0])) )
|
if ( !GDIOBJ_LockMultipleObj(Lock, sizeof(Lock)/sizeof(Lock[0])) )
|
||||||
|
@ -1838,7 +1839,7 @@ NtGdiPaintRgn(HDC hDC,
|
||||||
{
|
{
|
||||||
//RECT box;
|
//RECT box;
|
||||||
HRGN tmpVisRgn; //, prevVisRgn;
|
HRGN tmpVisRgn; //, prevVisRgn;
|
||||||
DC *dc = DC_HandleToPtr(hDC);
|
DC *dc = DC_LockDc(hDC);
|
||||||
PROSRGNDATA visrgn;
|
PROSRGNDATA visrgn;
|
||||||
CLIPOBJ* ClipRegion;
|
CLIPOBJ* ClipRegion;
|
||||||
BOOL bRet = FALSE;
|
BOOL bRet = FALSE;
|
||||||
|
@ -1850,7 +1851,7 @@ NtGdiPaintRgn(HDC hDC,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if(!(tmpVisRgn = NtGdiCreateRectRgn(0, 0, 0, 0))){
|
if(!(tmpVisRgn = NtGdiCreateRectRgn(0, 0, 0, 0))){
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1858,7 +1859,7 @@ NtGdiPaintRgn(HDC hDC,
|
||||||
// Transform region into device co-ords
|
// Transform region into device co-ords
|
||||||
if(!REGION_LPTODP(hDC, tmpVisRgn, hRgn) || NtGdiOffsetRgn(tmpVisRgn, dc->w.DCOrgX, dc->w.DCOrgY) == ERROR) {
|
if(!REGION_LPTODP(hDC, tmpVisRgn, hRgn) || NtGdiOffsetRgn(tmpVisRgn, dc->w.DCOrgX, dc->w.DCOrgY) == ERROR) {
|
||||||
NtGdiDeleteObject( tmpVisRgn );
|
NtGdiDeleteObject( tmpVisRgn );
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
@ -1887,7 +1888,7 @@ NtGdiPaintRgn(HDC hDC,
|
||||||
RGNDATA_UnlockRgn( tmpVisRgn );
|
RGNDATA_UnlockRgn( tmpVisRgn );
|
||||||
|
|
||||||
// Fill the region
|
// Fill the region
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: text.c,v 1.43 2003/08/19 11:48:50 weiden Exp $ */
|
/* $Id: text.c,v 1.44 2003/08/20 07:45:02 gvg Exp $ */
|
||||||
|
|
||||||
|
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
|
@ -719,7 +719,7 @@ NtGdiGetTextExtentExPoint(HDC hDC,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
dc = DC_HandleToPtr(hDC);
|
dc = DC_LockDc(hDC);
|
||||||
if (NULL == dc)
|
if (NULL == dc)
|
||||||
{
|
{
|
||||||
if (NULL != Dx)
|
if (NULL != Dx)
|
||||||
|
@ -731,7 +731,7 @@ NtGdiGetTextExtentExPoint(HDC hDC,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
TextObj = TEXTOBJ_LockText(dc->w.hFont);
|
TextObj = TEXTOBJ_LockText(dc->w.hFont);
|
||||||
DC_ReleasePtr(hDC);
|
DC_UnlockDc(hDC);
|
||||||
Result = TextIntGetTextExtentPoint(TextObj, String, Count, MaxExtent,
|
Result = TextIntGetTextExtentPoint(TextObj, String, Count, MaxExtent,
|
||||||
NULL == UnsafeFit ? NULL : &Fit, Dx, &Size);
|
NULL == UnsafeFit ? NULL : &Fit, Dx, &Size);
|
||||||
TEXTOBJ_UnlockText(dc->w.hFont);
|
TEXTOBJ_UnlockText(dc->w.hFont);
|
||||||
|
@ -812,7 +812,7 @@ NtGdiGetTextExtentPoint32(HDC hDC,
|
||||||
BOOLEAN Result;
|
BOOLEAN Result;
|
||||||
PTEXTOBJ TextObj;
|
PTEXTOBJ TextObj;
|
||||||
|
|
||||||
dc = DC_HandleToPtr(hDC);
|
dc = DC_LockDc(hDC);
|
||||||
|
|
||||||
if (NULL == dc)
|
if (NULL == dc)
|
||||||
{
|
{
|
||||||
|
@ -852,7 +852,7 @@ NtGdiGetTextExtentPoint32(HDC hDC,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
dc = DC_HandleToPtr(hDC);
|
dc = DC_LockDc(hDC);
|
||||||
if (NULL == dc)
|
if (NULL == dc)
|
||||||
{
|
{
|
||||||
ExFreePool(String);
|
ExFreePool(String);
|
||||||
|
@ -860,13 +860,13 @@ NtGdiGetTextExtentPoint32(HDC hDC,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
TextObj = TEXTOBJ_LockText(dc->w.hFont);
|
TextObj = TEXTOBJ_LockText(dc->w.hFont);
|
||||||
DC_ReleasePtr(hDC);
|
DC_UnlockDc(hDC);
|
||||||
Result = TextIntGetTextExtentPoint (
|
Result = TextIntGetTextExtentPoint (
|
||||||
TextObj, String, Count, 0, NULL, NULL, &Size);
|
TextObj, String, Count, 0, NULL, NULL, &Size);
|
||||||
dc = DC_HandleToPtr(hDC);
|
dc = DC_LockDc(hDC);
|
||||||
ASSERT(dc); // it succeeded earlier, it should now, too
|
ASSERT(dc); // it succeeded earlier, it should now, too
|
||||||
TEXTOBJ_UnlockText(dc->w.hFont);
|
TEXTOBJ_UnlockText(dc->w.hFont);
|
||||||
DC_ReleasePtr(hDC);
|
DC_UnlockDc(hDC);
|
||||||
|
|
||||||
ExFreePool(String);
|
ExFreePool(String);
|
||||||
if (! Result)
|
if (! Result)
|
||||||
|
@ -906,7 +906,7 @@ NtGdiGetTextMetrics(HDC hDC,
|
||||||
FT_Face Face;
|
FT_Face Face;
|
||||||
ULONG Error;
|
ULONG Error;
|
||||||
|
|
||||||
dc = DC_HandleToPtr(hDC);
|
dc = DC_LockDc(hDC);
|
||||||
if (NULL == dc || NULL == tm)
|
if (NULL == dc || NULL == tm)
|
||||||
{
|
{
|
||||||
Status = STATUS_INVALID_PARAMETER;
|
Status = STATUS_INVALID_PARAMETER;
|
||||||
|
@ -948,7 +948,7 @@ NtGdiGetTextMetrics(HDC hDC,
|
||||||
ASSERT(FALSE);
|
ASSERT(FALSE);
|
||||||
Status = STATUS_INVALID_HANDLE;
|
Status = STATUS_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
DC_ReleasePtr(hDC);
|
DC_UnlockDc(hDC);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NT_SUCCESS(Status);
|
return NT_SUCCESS(Status);
|
||||||
|
@ -986,14 +986,14 @@ NtGdiSetTextAlign(HDC hDC,
|
||||||
UINT prevAlign;
|
UINT prevAlign;
|
||||||
DC *dc;
|
DC *dc;
|
||||||
|
|
||||||
dc = DC_HandleToPtr(hDC);
|
dc = DC_LockDc(hDC);
|
||||||
if (!dc)
|
if (!dc)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
prevAlign = dc->w.textAlign;
|
prevAlign = dc->w.textAlign;
|
||||||
dc->w.textAlign = Mode;
|
dc->w.textAlign = Mode;
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
return prevAlign;
|
return prevAlign;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1003,7 +1003,7 @@ NtGdiSetTextColor(HDC hDC,
|
||||||
COLORREF color)
|
COLORREF color)
|
||||||
{
|
{
|
||||||
COLORREF oldColor;
|
COLORREF oldColor;
|
||||||
PDC dc = DC_HandleToPtr(hDC);
|
PDC dc = DC_LockDc(hDC);
|
||||||
|
|
||||||
if (!dc)
|
if (!dc)
|
||||||
{
|
{
|
||||||
|
@ -1012,7 +1012,7 @@ NtGdiSetTextColor(HDC hDC,
|
||||||
|
|
||||||
oldColor = dc->w.textColor;
|
oldColor = dc->w.textColor;
|
||||||
dc->w.textColor = color;
|
dc->w.textColor = color;
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
return oldColor;
|
return oldColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1035,7 +1035,7 @@ NtGdiTextOut(HDC hDC,
|
||||||
{
|
{
|
||||||
// Fixme: Call EngTextOut, which does the real work (calling DrvTextOut where appropriate)
|
// Fixme: Call EngTextOut, which does the real work (calling DrvTextOut where appropriate)
|
||||||
|
|
||||||
DC *dc = DC_HandleToPtr(hDC);
|
DC *dc = DC_LockDc(hDC);
|
||||||
SURFOBJ *SurfObj = (SURFOBJ*)AccessUserObject((ULONG) dc->Surface);
|
SURFOBJ *SurfObj = (SURFOBJ*)AccessUserObject((ULONG) dc->Surface);
|
||||||
int error, glyph_index, n, i;
|
int error, glyph_index, n, i;
|
||||||
FT_Face face;
|
FT_Face face;
|
||||||
|
@ -1202,7 +1202,7 @@ NtGdiTextOut(HDC hDC,
|
||||||
TEXTOBJ_UnlockText( dc->w.hFont );
|
TEXTOBJ_UnlockText( dc->w.hFont );
|
||||||
BRUSHOBJ_UnlockBrush(hBrush);
|
BRUSHOBJ_UnlockBrush(hBrush);
|
||||||
NtGdiDeleteObject( hBrush );
|
NtGdiDeleteObject( hBrush );
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
@ -1211,7 +1211,7 @@ fail:
|
||||||
BRUSHOBJ_UnlockBrush(hBrush);
|
BRUSHOBJ_UnlockBrush(hBrush);
|
||||||
NtGdiDeleteObject( hBrush );
|
NtGdiDeleteObject( hBrush );
|
||||||
}
|
}
|
||||||
DC_ReleasePtr( hDC );
|
DC_UnlockDc( hDC );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue