mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 02:25:17 +00:00
rewrote the gdi handle table that behaves similar 2k/XP and works without global locks
svn path=/trunk/; revision=10829
This commit is contained in:
parent
04ccf93084
commit
eed6b713aa
13 changed files with 189 additions and 219 deletions
|
@ -34,8 +34,8 @@ typedef struct _W32PROCESS
|
|||
struct _WINSTATION_OBJECT* WindowStation;
|
||||
HANDLE hWindowStation;
|
||||
ULONG Flags;
|
||||
WORD GDIObjects;
|
||||
WORD UserObjects;
|
||||
LONG GDIObjects;
|
||||
LONG UserObjects;
|
||||
} W32PROCESS, *PW32PROCESS;
|
||||
|
||||
PW32THREAD STDCALL
|
||||
|
|
|
@ -26,11 +26,12 @@ typedef struct _BITMAPOBJ
|
|||
/* Internal interface */
|
||||
|
||||
#define BITMAPOBJ_AllocBitmap() \
|
||||
((HBITMAP) GDIOBJ_AllocObj (sizeof (BITMAPOBJ), GDI_OBJECT_TYPE_BITMAP, (GDICLEANUPPROC) Bitmap_InternalDelete))
|
||||
((HBITMAP) GDIOBJ_AllocObj (GDI_OBJECT_TYPE_BITMAP))
|
||||
#define BITMAPOBJ_FreeBitmap(hBMObj) \
|
||||
GDIOBJ_FreeObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP, GDIOBJFLAG_DEFAULT)
|
||||
GDIOBJ_FreeObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP)
|
||||
#define BITMAPOBJ_LockBitmap(hBMObj) GDIOBJ_LockObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP)
|
||||
#define BITMAPOBJ_UnlockBitmap(hBMObj) GDIOBJ_UnlockObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP)
|
||||
#define BITMAPOBJ_UnlockBitmap(BMObj) GDIOBJ_UnlockObj((PGDIOBJ) BMObj)
|
||||
BOOL FASTCALL BITMAP_Cleanup(PBITMAPOBJ pBmp);
|
||||
|
||||
INT FASTCALL BITMAPOBJ_GetWidthBytes (INT bmWidth, INT bpp);
|
||||
HBITMAP FASTCALL BITMAPOBJ_CopyBitmap (HBITMAP hBitmap);
|
||||
|
@ -38,7 +39,6 @@ INT FASTCALL DIB_GetDIBWidthBytes (INT width, INT depth);
|
|||
int STDCALL DIB_GetDIBImageBytes (INT width, INT height, INT depth);
|
||||
INT FASTCALL DIB_BitmapInfoSize (const BITMAPINFO * info, WORD coloruse);
|
||||
INT STDCALL BITMAP_GetObject(BITMAPOBJ * bmp, INT count, LPVOID buffer);
|
||||
BOOL FASTCALL Bitmap_InternalDelete( PBITMAPOBJ pBmp );
|
||||
HBITMAP FASTCALL BitmapToSurf(PBITMAPOBJ BitmapObj, HDEV GDIDevice);
|
||||
|
||||
HBITMAP FASTCALL IntCreateCompatibleBitmap(PDC Dc, INT Width, INT Height);
|
||||
|
|
|
@ -68,10 +68,11 @@ typedef struct
|
|||
#define GDIBRUSH_IS_MASKING 0x8000 /* Pattern bitmap is used as transparent mask (?) */
|
||||
#define GDIBRUSH_CACHED_IS_SOLID 0x80000000
|
||||
|
||||
#define BRUSHOBJ_AllocBrush() ((HBRUSH) GDIOBJ_AllocObj (sizeof(GDIBRUSHOBJ), GDI_OBJECT_TYPE_BRUSH, (GDICLEANUPPROC) Brush_InternalDelete))
|
||||
#define BRUSHOBJ_FreeBrush(hBrush) GDIOBJ_FreeObj((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH, GDIOBJFLAG_DEFAULT)
|
||||
#define BRUSHOBJ_AllocBrush() ((HBRUSH) GDIOBJ_AllocObj (GDI_OBJECT_TYPE_BRUSH))
|
||||
#define BRUSHOBJ_FreeBrush(hBrush) GDIOBJ_FreeObj((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH)
|
||||
#define BRUSHOBJ_LockBrush(hBrush) ((PGDIBRUSHOBJ)GDIOBJ_LockObj((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH))
|
||||
#define BRUSHOBJ_UnlockBrush(hBrush) GDIOBJ_UnlockObj((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH)
|
||||
#define BRUSHOBJ_UnlockBrush(BrushObj) GDIOBJ_UnlockObj((PGDIOBJ)BrushObj)
|
||||
BOOL FASTCALL BRUSH_Cleanup(PGDIBRUSHOBJ pBrush);
|
||||
|
||||
#ifdef __USE_W32API
|
||||
typedef struct _PATRECT {
|
||||
|
|
|
@ -140,17 +140,17 @@ typedef struct
|
|||
|
||||
#define DC_LockDc(hDC) \
|
||||
((PDC) GDIOBJ_LockObj ((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC))
|
||||
#define DC_UnlockDc(hDC) \
|
||||
GDIOBJ_UnlockObj ((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC)
|
||||
#define DC_UnlockDc(DC) \
|
||||
GDIOBJ_UnlockObj ((PGDIOBJ) DC)
|
||||
|
||||
HDC FASTCALL RetrieveDisplayHDC(VOID);
|
||||
HDC FASTCALL DC_AllocDC(PUNICODE_STRING Driver);
|
||||
VOID FASTCALL DC_InitDC(HDC DCToInit);
|
||||
HDC FASTCALL DC_FindOpenDC(PUNICODE_STRING Driver);
|
||||
VOID FASTCALL DC_FreeDC(HDC DCToFree);
|
||||
BOOL FASTCALL DC_Cleanup(PDC pDc);
|
||||
HDC FASTCALL DC_GetNextDC (PDC pDC);
|
||||
VOID FASTCALL DC_SetNextDC (PDC pDC, HDC hNextDC);
|
||||
BOOL FASTCALL DC_InternalDeleteDC( PDC DCToDelete );
|
||||
VOID FASTCALL DC_SetOwnership(HDC DC, PEPROCESS Owner);
|
||||
|
||||
VOID FASTCALL DC_UpdateXforms(PDC dc);
|
||||
|
|
|
@ -8,6 +8,25 @@
|
|||
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
/* base address where the handle table is mapped to */
|
||||
#define GDI_HANDLE_TABLE_BASE_ADDRESS (0x400000)
|
||||
|
||||
/* gdi handle table can hold 0x4000 handles */
|
||||
#define GDI_HANDLE_COUNT 0x4000
|
||||
|
||||
#define GDI_GLOBAL_PROCESS (0x0)
|
||||
|
||||
#define GDI_HANDLE_INDEX_MASK (GDI_HANDLE_COUNT - 1)
|
||||
#define GDI_HANDLE_TYPE_MASK 0x007f0000
|
||||
#define GDI_HANDLE_STOCK_MASK 0x00800000
|
||||
|
||||
#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))
|
||||
|
||||
/*! \defgroup GDI object types
|
||||
*
|
||||
* GDI object types
|
||||
|
@ -37,26 +56,18 @@ typedef PVOID PGDIOBJ;
|
|||
|
||||
typedef BOOL (FASTCALL *GDICLEANUPPROC)(PGDIOBJ Obj);
|
||||
|
||||
#define GDIOBJ_USE_FASTMUTEX
|
||||
|
||||
/*!
|
||||
* GDI object header. This is a part of any GDI object
|
||||
*/
|
||||
typedef struct _GDIOBJHDR
|
||||
{
|
||||
DWORD dwCount; /* reference count for the object */
|
||||
HANDLE hProcessId;
|
||||
GDICLEANUPPROC CleanupProc;
|
||||
WORD wTableIndex;
|
||||
WORD Magic;
|
||||
LONG RefCount; /* reference count for the object */
|
||||
struct _W32THREAD *LockingThread; /* only assigned if a thread is holding the lock! */
|
||||
ULONG Type;
|
||||
PPAGED_LOOKASIDE_LIST LookasideList; /* FIXME - remove this */
|
||||
#ifdef GDI_DEBUG
|
||||
const char* lockfile;
|
||||
int lockline;
|
||||
#ifdef GDIOBJ_USE_FASTMUTEX
|
||||
FAST_MUTEX Lock;
|
||||
DWORD RecursiveLockCount;
|
||||
#else
|
||||
DWORD LockTid;
|
||||
DWORD LockCount;
|
||||
#endif
|
||||
} GDIOBJHDR, *PGDIOBJHDR;
|
||||
|
||||
|
@ -67,32 +78,39 @@ typedef struct _GDIMULTILOCK
|
|||
DWORD ObjectType;
|
||||
} GDIMULTILOCK, *PGDIMULTILOCK;
|
||||
|
||||
HGDIOBJ FASTCALL GDIOBJ_AllocObj(WORD Size, DWORD ObjectType, GDICLEANUPPROC CleanupProcPtr);
|
||||
BOOL STDCALL GDIOBJ_FreeObj (HGDIOBJ Obj, DWORD ObjectType, DWORD Flag);
|
||||
PGDIOBJ FASTCALL GDIOBJ_LockObj (HGDIOBJ Obj, DWORD ObjectType);
|
||||
HGDIOBJ FASTCALL GDIOBJ_AllocObj(ULONG ObjectType);
|
||||
BOOL FASTCALL GDIOBJ_FreeObj (HGDIOBJ Obj, DWORD ObjectType);
|
||||
BOOL FASTCALL GDIOBJ_LockMultipleObj(PGDIMULTILOCK pList, INT nObj);
|
||||
BOOL FASTCALL GDIOBJ_UnlockObj (HGDIOBJ Obj, DWORD ObjectType);
|
||||
BOOL FASTCALL GDIOBJ_UnlockMultipleObj(PGDIMULTILOCK pList, INT nObj);
|
||||
DWORD FASTCALL GDIOBJ_GetObjectType(HGDIOBJ ObjectHandle);
|
||||
BOOL FASTCALL GDIOBJ_OwnedByCurrentProcess(HGDIOBJ ObjectHandle);
|
||||
void FASTCALL GDIOBJ_SetOwnership(HGDIOBJ ObjectHandle, PEPROCESS Owner);
|
||||
void FASTCALL GDIOBJ_CopyOwnership(HGDIOBJ CopyFrom, HGDIOBJ CopyTo);
|
||||
BOOL FASTCALL GDIOBJ_ConvertToStockObj(HGDIOBJ *hObj);
|
||||
BOOL FASTCALL GDIOBJ_LockMultipleObj(PGDIMULTILOCK pList, INT nObj);
|
||||
|
||||
#define GDIOBJ_GetObjectType(Handle) \
|
||||
GDI_HANDLE_GET_TYPE(Handle)
|
||||
|
||||
#ifdef GDI_DEBUG
|
||||
|
||||
/* a couple macros for debugging GDIOBJ locking */
|
||||
#define GDIOBJ_LockObj(obj,ty) GDIOBJ_LockObjDbg(__FILE__,__LINE__,obj,ty)
|
||||
#define GDIOBJ_UnlockObj(obj,ty) GDIOBJ_UnlockObjDbg(__FILE__,__LINE__,obj,ty)
|
||||
#define GDIOBJ_UnlockObj(obj) GDIOBJ_UnlockObjDbg(__FILE__,__LINE__,obj)
|
||||
|
||||
#ifdef GDIOBJ_LockObj
|
||||
PGDIOBJ FASTCALL GDIOBJ_LockObjDbg (const char* file, int line, HGDIOBJ Obj, DWORD ObjectType);
|
||||
#endif /* GDIOBJ_LockObj */
|
||||
BOOL FASTCALL GDIOBJ_UnlockObjDbg (const char* file, int line, PGDIOBJ Object);
|
||||
|
||||
#ifdef GDIOBJ_UnlockObj
|
||||
BOOL FASTCALL GDIOBJ_UnlockObjDbg (const char* file, int line, HGDIOBJ Obj, DWORD ObjectType);
|
||||
#endif /* GDIOBJ_UnlockObj */
|
||||
#else /* !GDI_DEBUG */
|
||||
|
||||
PGDIOBJ FASTCALL GDIOBJ_LockObj (HGDIOBJ Obj, DWORD ObjectType);
|
||||
BOOL FASTCALL GDIOBJ_UnlockObj (PGDIOBJ Object);
|
||||
|
||||
#endif /* GDI_DEBUG */
|
||||
|
||||
#define GDIOBJFLAG_DEFAULT (0x0)
|
||||
#define GDIOBJFLAG_IGNOREPID (0x1)
|
||||
#define GDIOBJFLAG_IGNORELOCK (0x2)
|
||||
|
||||
PVOID FASTCALL GDI_MapHandleTable(HANDLE hProcess);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
|
||||
/* Internal interface */
|
||||
|
||||
#define PENOBJ_AllocPen() ((HPEN)GDIOBJ_AllocObj(sizeof(GDIBRUSHOBJ), GDI_OBJECT_TYPE_PEN, NULL))
|
||||
#define PENOBJ_FreePen(hBMObj) GDIOBJ_FreeObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_PEN, GDIOBJFLAG_DEFAULT)
|
||||
#define PENOBJ_AllocPen() ((HPEN)GDIOBJ_AllocObj(GDI_OBJECT_TYPE_PEN))
|
||||
#define PENOBJ_FreePen(hBMObj) GDIOBJ_FreeObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_PEN)
|
||||
#define PENOBJ_LockPen(hBMObj) ((PGDIBRUSHOBJ)GDIOBJ_LockObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_PEN))
|
||||
#define PENOBJ_UnlockPen(hBMObj) GDIOBJ_UnlockObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_PEN)
|
||||
#define PENOBJ_UnlockPen(BMObj) GDIOBJ_UnlockObj((PGDIOBJ) BMObj)
|
||||
|
||||
HPEN STDCALL
|
||||
NtGdiCreatePen(
|
||||
|
|
|
@ -11,12 +11,11 @@ typedef struct _ROSRGNDATA {
|
|||
} ROSRGNDATA, *PROSRGNDATA, *LPROSRGNDATA;
|
||||
|
||||
|
||||
#define RGNDATA_FreeRgn(hRgn) GDIOBJ_FreeObj((HGDIOBJ)hRgn, GDI_OBJECT_TYPE_REGION, GDIOBJFLAG_DEFAULT)
|
||||
#define RGNDATA_FreeRgn(hRgn) GDIOBJ_FreeObj((HGDIOBJ)hRgn, GDI_OBJECT_TYPE_REGION)
|
||||
#define RGNDATA_LockRgn(hRgn) ((PROSRGNDATA)GDIOBJ_LockObj((HGDIOBJ)hRgn, GDI_OBJECT_TYPE_REGION))
|
||||
#define RGNDATA_UnlockRgn(hRgn) GDIOBJ_UnlockObj((HGDIOBJ)hRgn, GDI_OBJECT_TYPE_REGION)
|
||||
#define RGNDATA_UnlockRgn(Rgn) GDIOBJ_UnlockObj((PGDIOBJ)Rgn)
|
||||
HRGN FASTCALL RGNDATA_AllocRgn(INT n);
|
||||
|
||||
BOOL FASTCALL RGNDATA_InternalDelete( PROSRGNDATA Obj );
|
||||
BOOL FASTCALL RGNDATA_Cleanup(PROSRGNDATA pRgn);
|
||||
|
||||
/* User entry points */
|
||||
HRGN STDCALL
|
||||
|
|
|
@ -6,16 +6,16 @@
|
|||
typedef struct
|
||||
{
|
||||
LOGFONTW logfont;
|
||||
HFONT GDIFontHandle;
|
||||
FONTOBJ *Font;
|
||||
} TEXTOBJ, *PTEXTOBJ;
|
||||
|
||||
/* Internal interface */
|
||||
|
||||
#define TEXTOBJ_AllocText() \
|
||||
((HFONT) GDIOBJ_AllocObj (sizeof (TEXTOBJ), GDI_OBJECT_TYPE_FONT, NULL))
|
||||
#define TEXTOBJ_FreeText(hBMObj) GDIOBJ_FreeObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_FONT, GDIOBJFLAG_DEFAULT)
|
||||
((HFONT) GDIOBJ_AllocObj (GDI_OBJECT_TYPE_FONT))
|
||||
#define TEXTOBJ_FreeText(hBMObj) GDIOBJ_FreeObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_FONT)
|
||||
#define TEXTOBJ_LockText(hBMObj) ((PTEXTOBJ) GDIOBJ_LockObj ((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_FONT))
|
||||
#define TEXTOBJ_UnlockText(hBMObj) GDIOBJ_UnlockObj ((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_FONT)
|
||||
#define TEXTOBJ_UnlockText(BMObj) GDIOBJ_UnlockObj ((PGDIOBJ) BMObj)
|
||||
|
||||
NTSTATUS FASTCALL TextIntRealizeFont(HFONT FontHandle);
|
||||
NTSTATUS FASTCALL TextIntCreateFontIndirect(CONST LPLOGFONTW lf, HFONT *NewFont);
|
||||
|
|
|
@ -30,10 +30,21 @@ typedef struct _THRDCARETINFO
|
|||
BYTE Showing;
|
||||
} THRDCARETINFO, *PTHRDCARETINFO;
|
||||
|
||||
void InitStockObjects(void);
|
||||
VOID CreateFrameBrushes(VOID);
|
||||
VOID DeleteFrameBrushes(VOID);
|
||||
void DrawCaret(HWND hWnd, PTHRDCARETINFO CaretInfo);
|
||||
|
||||
LONG WINAPI RegCloseKey(HKEY);
|
||||
LONG WINAPI RegOpenKeyExW(HKEY,LPCWSTR,DWORD,REGSAM,PHKEY);
|
||||
LONG WINAPI RegQueryValueExW(HKEY,LPCWSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD);
|
||||
|
||||
#ifdef __USE_W32API
|
||||
NTSTATUS STDCALL ZwCallbackReturn(PVOID Result,
|
||||
ULONG ResultLength,
|
||||
NTSTATUS Status);
|
||||
#endif
|
||||
|
||||
#define NtUserAnyPopup() \
|
||||
(BOOL)NtUserCallNoParam(NOPARAM_ROUTINE_ANYPOPUP)
|
||||
|
||||
|
@ -61,6 +72,18 @@ void DrawCaret(HWND hWnd, PTHRDCARETINFO CaretInfo);
|
|||
#define NtUserRegisterLogonProcess(hproc, x) \
|
||||
(BOOL)NtUserCallTwoParam((DWORD)hproc, (DWORD)x, TWOPARAM_ROUTINE_REGISTERLOGONPROC)
|
||||
|
||||
#define NtUserGetSysColorBrushes(HBrushes, count) \
|
||||
(BOOL)NtUserCallTwoParam((DWORD)(HBrushes), (DWORD)(count), TWOPARAM_ROUTINE_GETSYSCOLORBRUSHES)
|
||||
|
||||
#define NtUserGetSysColorPens(HPens, count) \
|
||||
(BOOL)NtUserCallTwoParam((DWORD)(HPens), (DWORD)(count), TWOPARAM_ROUTINE_GETSYSCOLORPENS)
|
||||
|
||||
#define NtUserGetSysColors(ColorRefs, count) \
|
||||
(BOOL)NtUserCallTwoParam((DWORD)(ColorRefs), (DWORD)(count), TWOPARAM_ROUTINE_GETSYSCOLORS)
|
||||
|
||||
#define NtUserSetSysColors(ColorRefs, count) \
|
||||
(BOOL)NtUserCallTwoParam((DWORD)(ColorRefs), (DWORD)(count), TWOPARAM_ROUTINE_SETSYSCOLORS)
|
||||
|
||||
#define NtUserSetCaretBlinkTime(uMSeconds) \
|
||||
(BOOL)NtUserCallOneParam((DWORD)uMSeconds, ONEPARAM_ROUTINE_SETCARETBLINKTIME)
|
||||
|
||||
|
@ -100,12 +123,3 @@ void DrawCaret(HWND hWnd, PTHRDCARETINFO CaretInfo);
|
|||
#define NtUserEnableProcessWindowGhosting(bEnable) \
|
||||
NtUserCallOneParam((DWORD)bEnable, ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING)
|
||||
|
||||
LONG WINAPI RegCloseKey(HKEY);
|
||||
LONG WINAPI RegOpenKeyExW(HKEY,LPCWSTR,DWORD,REGSAM,PHKEY);
|
||||
LONG WINAPI RegQueryValueExW(HKEY,LPCWSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD);
|
||||
|
||||
#ifdef __USE_W32API
|
||||
NTSTATUS STDCALL ZwCallbackReturn(PVOID Result,
|
||||
ULONG ResultLength,
|
||||
NTSTATUS Status);
|
||||
#endif
|
||||
|
|
|
@ -7,14 +7,37 @@
|
|||
#include <windows.h>
|
||||
#include <user32/wininternal.h>
|
||||
|
||||
extern COLORREF SysColors[];
|
||||
extern HPEN SysPens[];
|
||||
extern HBRUSH SysBrushes[];
|
||||
|
||||
#define NUM_SYSCOLORS 31
|
||||
|
||||
#define IS_ATOM(x) \
|
||||
(((ULONG_PTR)(x) > 0x0) && ((ULONG_PTR)(x) < 0x10000))
|
||||
|
||||
#define UserHasAnyFrameStyle(Style, ExStyle) \
|
||||
(((Style) & (WS_THICKFRAME | WS_DLGFRAME | WS_BORDER)) || \
|
||||
((ExStyle) & WS_EX_DLGMODALFRAME) || \
|
||||
(!((Style) & (WS_CHILD | WS_POPUP))))
|
||||
|
||||
#define UserHasDlgFrameStyle(Style, ExStyle) \
|
||||
(((ExStyle) & WS_EX_DLGMODALFRAME) || \
|
||||
(((Style) & WS_DLGFRAME) && (!((Style) & WS_THICKFRAME))))
|
||||
|
||||
#define UserHasThickFrameStyle(Style, ExStyle) \
|
||||
(((Style) & WS_THICKFRAME) && \
|
||||
(!(((Style) & (WS_DLGFRAME | WS_BORDER)) == WS_DLGFRAME)))
|
||||
|
||||
#define UserHasThinFrameStyle(Style, ExStyle) \
|
||||
(((Style) & WS_BORDER) || (!((Style) & (WS_CHILD | WS_POPUP))))
|
||||
|
||||
#define UserHasBigFrameStyle(Style, ExStyle) \
|
||||
(((Style) & (WS_THICKFRAME | WS_DLGFRAME)) || \
|
||||
((ExStyle) & WS_EX_DLGMODALFRAME))
|
||||
|
||||
|
||||
BOOL UserDrawSysMenuButton( HWND hWnd, HDC hDC, LPRECT, BOOL down );
|
||||
ULONG
|
||||
UserHasDlgFrameStyle(ULONG Style, ULONG ExStyle);
|
||||
ULONG
|
||||
UserHasThickFrameStyle(ULONG Style, ULONG ExStyle);
|
||||
void
|
||||
UserGetFrameSize(ULONG Style, ULONG ExStyle, SIZE *Size);
|
||||
void
|
||||
|
|
|
@ -76,6 +76,7 @@ Init(VOID)
|
|||
InitializeCriticalSection(&gcsMPH);
|
||||
|
||||
GdiDllInitialize(NULL, DLL_PROCESS_ATTACH, NULL);
|
||||
InitStockObjects();
|
||||
}
|
||||
|
||||
VOID
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: stubs.c,v 1.65 2004/08/15 21:36:28 chorns Exp $
|
||||
/* $Id: stubs.c,v 1.66 2004/09/12 19:21:05 weiden Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS user32.dll
|
||||
|
@ -185,21 +185,6 @@ RealMsgWaitForMultipleObjectsEx(
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
BOOL
|
||||
STDCALL
|
||||
SetSysColors(
|
||||
int cElements,
|
||||
CONST INT *lpaElements,
|
||||
CONST COLORREF *lpaRgbValues)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: defwnd.c,v 1.144 2004/08/15 21:36:29 chorns Exp $
|
||||
/* $Id: defwnd.c,v 1.145 2004/09/12 19:21:06 weiden Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS user32.dll
|
||||
|
@ -41,70 +41,46 @@ void FASTCALL MenuInitSysMenuPopup(HMENU Menu, DWORD Style, DWORD ClsStyle, LONG
|
|||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
||||
/* TODO: widgets will be cached here.
|
||||
static HBITMAP hbClose;
|
||||
static HBITMAP hbCloseD;
|
||||
static HBITMAP hbMinimize;
|
||||
static HBITMAP hbMinimizeD;
|
||||
static HBITMAP hbRestore;
|
||||
static HBITMAP hbRestoreD;
|
||||
static HBITMAP hbMaximize;
|
||||
static HBITMAP hbScrUp;
|
||||
static HBITMAP hbScrDwn;
|
||||
static HBITMAP hbScrLeft;
|
||||
static HBITMAP hbScrRight;
|
||||
*/
|
||||
|
||||
|
||||
static COLORREF SysColors[] =
|
||||
{
|
||||
RGB(212, 208, 200), /* COLOR_SCROLLBAR */
|
||||
RGB(58, 110, 165), /* COLOR_BACKGROUND */
|
||||
RGB(10, 36, 106), /* COLOR_ACTIVECAPTION */
|
||||
RGB(128, 128, 128), /* COLOR_INACTIVECAPTION */
|
||||
RGB(212, 208, 200), /* COLOR_MENU */
|
||||
RGB(255, 255, 255), /* COLOR_WINDOW */
|
||||
RGB(0, 0, 0), /* COLOR_WINDOWFRAME */
|
||||
RGB(0, 0, 0), /* COLOR_MENUTEXT */
|
||||
RGB(0, 0, 0), /* COLOR_WINDOWTEXT */
|
||||
RGB(255, 255, 255), /* COLOR_CAPTIONTEXT */
|
||||
RGB(212, 208, 200), /* COLOR_ACTIVEBORDER */
|
||||
RGB(212, 208, 200), /* COLOR_INACTIVEBORDER */
|
||||
RGB(128, 128, 128), /* COLOR_APPWORKSPACE */
|
||||
RGB(10, 36, 106), /* COLOR_HIGHLIGHT */
|
||||
RGB(255, 255, 255), /* COLOR_HIGHLIGHTTEXT */
|
||||
RGB(212, 208, 200), /* COLOR_BTNFACE */
|
||||
RGB(128, 128, 128), /* COLOR_BTNSHADOW */
|
||||
RGB(128, 128, 128), /* COLOR_GRAYTEXT */
|
||||
RGB(0, 0, 0), /* COLOR_BTNTEXT */
|
||||
RGB(212, 208, 200), /* COLOR_INACTIVECAPTIONTEXT */
|
||||
RGB(255, 255, 255), /* COLOR_BTNHIGHLIGHT */
|
||||
RGB(64, 64, 64), /* COLOR_3DDKSHADOW */
|
||||
RGB(212, 208, 200), /* COLOR_3DLIGHT */
|
||||
RGB(0, 0, 0), /* COLOR_INFOTEXT */
|
||||
RGB(255, 255, 225), /* COLOR_INFOBK */
|
||||
RGB(181, 181, 181), /* COLOR_UNKNOWN */
|
||||
RGB(0, 0, 128), /* COLOR_HOTLIGHT */
|
||||
RGB(166, 202, 240), /* COLOR_GRADIENTACTIVECAPTION */
|
||||
RGB(192, 192, 192), /* COLOR_GRADIENTINACTIVECAPTION */
|
||||
RGB(49, 106, 197), /* COLOR_MENUHILIGHT */
|
||||
RGB(236, 233, 216) /* COLOR_MENUBAR */
|
||||
};
|
||||
|
||||
#define NUM_SYSCOLORS (sizeof(SysColors) / sizeof(SysColors[0]))
|
||||
static COLORREF SysColors[NUM_SYSCOLORS] = {0};
|
||||
static HPEN SysPens[NUM_SYSCOLORS] = {0};
|
||||
static HBRUSH SysBrushes[NUM_SYSCOLORS] = {0};
|
||||
|
||||
/* Bits in the dwKeyData */
|
||||
#define KEYDATA_ALT 0x2000
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
void
|
||||
InitStockObjects(void)
|
||||
{
|
||||
/* FIXME - Instead of copying the stuff to usermode we should map the tables to
|
||||
userland. The current implementation has one big flaw: the system color
|
||||
table doesn't get updated when another process changes them. That's why
|
||||
we should rather map the table into usermode. But it only affects the
|
||||
SysColors table - the pens, brushes and stock objects are not affected
|
||||
as their handles never change. But it'd be faster to map them, too. */
|
||||
if(SysBrushes[0] == NULL)
|
||||
{
|
||||
/* only initialize once */
|
||||
NtUserGetSysColors(SysColors, NUM_SYSCOLORS);
|
||||
NtUserGetSysColorPens(SysPens, NUM_SYSCOLORS);
|
||||
NtUserGetSysColorBrushes(SysBrushes, NUM_SYSCOLORS);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
DWORD STDCALL
|
||||
GetSysColor(int nIndex)
|
||||
{
|
||||
if(nIndex >= 0 && nIndex <= NUM_SYSCOLORS)
|
||||
{
|
||||
return SysColors[nIndex];
|
||||
}
|
||||
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -113,22 +89,13 @@ GetSysColor(int nIndex)
|
|||
HPEN STDCALL
|
||||
GetSysColorPen(int nIndex)
|
||||
{
|
||||
static HPEN SysPens[NUM_SYSCOLORS];
|
||||
if(nIndex >= 0 && nIndex <= NUM_SYSCOLORS)
|
||||
{
|
||||
return SysPens[nIndex];
|
||||
}
|
||||
|
||||
if (nIndex < 0 || NUM_SYSCOLORS < nIndex)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* FIXME should register this object with DeleteObject() so it
|
||||
can't be deleted */
|
||||
if (NULL == SysPens[nIndex])
|
||||
{
|
||||
SysPens[nIndex] = CreatePen(PS_SOLID, 1, SysColors[nIndex]);
|
||||
}
|
||||
|
||||
return SysPens[nIndex];
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -137,89 +104,51 @@ GetSysColorPen(int nIndex)
|
|||
HBRUSH STDCALL
|
||||
GetSysColorBrush(int nIndex)
|
||||
{
|
||||
static HBRUSH SysBrushes[NUM_SYSCOLORS];
|
||||
if(nIndex >= 0 && nIndex <= NUM_SYSCOLORS)
|
||||
{
|
||||
return SysBrushes[nIndex];
|
||||
}
|
||||
|
||||
if (nIndex < 0 || NUM_SYSCOLORS < nIndex)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* FIXME should register this object with DeleteObject() so it
|
||||
can't be deleted */
|
||||
if (NULL == SysBrushes[nIndex])
|
||||
{
|
||||
SysBrushes[nIndex] = (HBRUSH) ((DWORD) CreateSolidBrush(SysColors[nIndex]) | 0x00800000);
|
||||
}
|
||||
|
||||
return SysBrushes[nIndex];
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
/*
|
||||
LRESULT STDCALL
|
||||
DefFrameProcA( HWND hWnd,
|
||||
HWND hWndMDIClient,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam )
|
||||
BOOL
|
||||
STDCALL
|
||||
SetSysColors(
|
||||
int cElements,
|
||||
CONST INT *lpaElements,
|
||||
CONST COLORREF *lpaRgbValues)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return ((LRESULT)0);
|
||||
}
|
||||
*/
|
||||
BOOL Ret;
|
||||
struct
|
||||
{
|
||||
INT *Elements;
|
||||
COLORREF *Colors;
|
||||
} ChangeSysColors;
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
/*
|
||||
LRESULT STDCALL
|
||||
DefFrameProcW(HWND hWnd,
|
||||
HWND hWndMDIClient,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return ((LRESULT)0);
|
||||
}
|
||||
*/
|
||||
|
||||
ULONG
|
||||
UserHasAnyFrameStyle(ULONG Style, ULONG ExStyle)
|
||||
{
|
||||
return ((Style & (WS_THICKFRAME | WS_DLGFRAME | WS_BORDER)) ||
|
||||
(ExStyle & WS_EX_DLGMODALFRAME) ||
|
||||
(!(Style & (WS_CHILD | WS_POPUP))));
|
||||
}
|
||||
|
||||
ULONG
|
||||
UserHasDlgFrameStyle(ULONG Style, ULONG ExStyle)
|
||||
{
|
||||
return ((ExStyle & WS_EX_DLGMODALFRAME) ||
|
||||
((Style & WS_DLGFRAME) && (!(Style & WS_THICKFRAME))));
|
||||
}
|
||||
|
||||
ULONG
|
||||
UserHasThickFrameStyle(ULONG Style, ULONG ExStyle)
|
||||
{
|
||||
return ((Style & WS_THICKFRAME) &&
|
||||
(!((Style & (WS_DLGFRAME | WS_BORDER)) == WS_DLGFRAME)));
|
||||
}
|
||||
|
||||
ULONG
|
||||
UserHasThinFrameStyle(ULONG Style, ULONG ExStyle)
|
||||
{
|
||||
return ((Style & WS_BORDER) || (!(Style & (WS_CHILD | WS_POPUP))));
|
||||
}
|
||||
|
||||
ULONG
|
||||
UserHasBigFrameStyle(ULONG Style, ULONG ExStyle)
|
||||
{
|
||||
return ((Style & (WS_THICKFRAME | WS_DLGFRAME)) ||
|
||||
(ExStyle & WS_EX_DLGMODALFRAME));
|
||||
ChangeSysColors.Elements = (INT*)lpaElements;
|
||||
ChangeSysColors.Colors = (COLORREF*)lpaRgbValues;
|
||||
|
||||
if(cElements > 0)
|
||||
{
|
||||
Ret = NtUserSetSysColors(&ChangeSysColors, cElements);
|
||||
if(Ret)
|
||||
{
|
||||
/* FIXME - just change it in the usermode structure, too, instead of asking win32k again */
|
||||
NtUserGetSysColors(SysColors, NUM_SYSCOLORS);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
Ret = FALSE;
|
||||
}
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue