ReactOS 0.4.15-dev-8222-g9164419
dcattr.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * PURPOSE: Functions for creation and destruction of DCs
5 * FILE: win32ss/gdi/ntgdi/dcattr.c
6 * PROGRAMER: Timo Kreuzer (timo.kreuzer@rectos.org)
7 */
8
9#include <win32k.h>
10
11#define NDEBUG
12#include <debug.h>
13
14#define GDIDCATTRFREE 8
15
17{
22
23typedef struct _GDI_DC_ATTR_ENTRY
24{
27
28
29BOOL
32{
33 PPROCESSINFO ppi;
34 PDC_ATTR pdcattr;
35
37 ASSERT(ppi);
38
39 pdcattr = GdiPoolAllocate(ppi->pPoolDcAttr);
40 if (!pdcattr)
41 {
42 DPRINT1("Could not allocate DC attr\n");
43 return FALSE;
44 }
45
46 /* Copy the content from the kernel mode dc attr */
47 pdc->pdcattr = pdcattr;
48 *pdc->pdcattr = pdc->dcattr;
49
50 /* Set the object attribute in the handle table */
51 GDIOBJ_vSetObjectAttr(&pdc->BaseObject, pdcattr);
52
53 DPRINT("DC_AllocDcAttr: pdc=%p, pdc->pdcattr=%p\n", pdc, pdc->pdcattr);
54 return TRUE;
55}
56
57VOID
60{
61 PPROCESSINFO ppi;
62
63 if (pdc->pdcattr == &pdc->dcattr)
64 {
65 // Internal DC object!
66 return;
67 }
68
69 /* Reset the object attribute in the handle table */
70 GDIOBJ_vSetObjectAttr(&pdc->BaseObject, NULL);
71
73 ASSERT(ppi);
74 GdiPoolFree(ppi->pPoolDcAttr, pdc->pdcattr);
75
76 /* Reset to kmode dcattr */
77 pdc->pdcattr = &pdc->dcattr;
78}
#define DPRINT1
Definition: precomp.h:8
struct _GDI_DC_ATTR_FREELIST * PGDI_DC_ATTR_FREELIST
struct _GDI_DC_ATTR_FREELIST GDI_DC_ATTR_FREELIST
struct _GDI_DC_ATTR_ENTRY GDI_DC_ATTR_ENTRY
VOID NTAPI DC_vFreeDcAttr(PDC pdc)
Definition: dcattr.c:59
#define GDIDCATTRFREE
Definition: dcattr.c:14
struct _GDI_DC_ATTR_ENTRY * PGDI_DC_ATTR_ENTRY
BOOL NTAPI DC_bAllocDcAttr(PDC pdc)
Definition: dcattr.c:31
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
VOID NTAPI GdiPoolFree(PGDI_POOL pPool, PVOID pvAlloc)
Definition: gdipool.c:233
PVOID NTAPI GdiPoolAllocate(PGDI_POOL pPool)
Definition: gdipool.c:122
#define ASSERT(a)
Definition: mode.c:44
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
#define DPRINT
Definition: sndvol32.h:73
Definition: polytest.cpp:41
Definition: dcattr.c:24
DC_ATTR Attr[GDIDCATTRFREE]
Definition: dcattr.c:25
PVOID AttrList[GDIDCATTRFREE]
Definition: dcattr.c:20
LIST_ENTRY Entry
Definition: dcattr.c:18
Definition: typedefs.h:120
struct _GDI_POOL * pPoolDcAttr
Definition: win32.h:291
#define NTAPI
Definition: typedefs.h:36
VOID NTAPI GDIOBJ_vSetObjectAttr(POBJ pobj, PVOID pvObjAttr)
Definition: gdiobj.c:1096