ReactOS
0.4.15-dev-8632-gbc8c7d1
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
16
typedef
struct
_GDI_DC_ATTR_FREELIST
17
{
18
LIST_ENTRY
Entry
;
19
DWORD
nEntries
;
20
PVOID
AttrList
[
GDIDCATTRFREE
];
21
}
GDI_DC_ATTR_FREELIST
, *
PGDI_DC_ATTR_FREELIST
;
22
23
typedef
struct
_GDI_DC_ATTR_ENTRY
24
{
25
DC_ATTR
Attr
[
GDIDCATTRFREE
];
26
}
GDI_DC_ATTR_ENTRY
, *
PGDI_DC_ATTR_ENTRY
;
27
28
29
BOOL
30
NTAPI
31
DC_bAllocDcAttr
(
PDC
pdc)
32
{
33
PPROCESSINFO
ppi;
34
PDC_ATTR
pdcattr;
35
36
ppi =
PsGetCurrentProcessWin32Process
();
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
57
VOID
58
NTAPI
59
DC_vFreeDcAttr
(
PDC
pdc)
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
72
ppi =
PsGetCurrentProcessWin32Process
();
73
ASSERT
(ppi);
74
GdiPoolFree
(ppi->
pPoolDcAttr
, pdc->pdcattr);
75
76
/* Reset to kmode dcattr */
77
pdc->pdcattr = &pdc->dcattr;
78
}
DPRINT1
#define DPRINT1
Definition:
precomp.h:8
PGDI_DC_ATTR_FREELIST
struct _GDI_DC_ATTR_FREELIST * PGDI_DC_ATTR_FREELIST
GDI_DC_ATTR_FREELIST
struct _GDI_DC_ATTR_FREELIST GDI_DC_ATTR_FREELIST
GDI_DC_ATTR_ENTRY
struct _GDI_DC_ATTR_ENTRY GDI_DC_ATTR_ENTRY
DC_vFreeDcAttr
VOID NTAPI DC_vFreeDcAttr(PDC pdc)
Definition:
dcattr.c:59
GDIDCATTRFREE
#define GDIDCATTRFREE
Definition:
dcattr.c:14
PGDI_DC_ATTR_ENTRY
struct _GDI_DC_ATTR_ENTRY * PGDI_DC_ATTR_ENTRY
DC_bAllocDcAttr
BOOL NTAPI DC_bAllocDcAttr(PDC pdc)
Definition:
dcattr.c:31
NULL
#define NULL
Definition:
types.h:112
TRUE
#define TRUE
Definition:
types.h:120
FALSE
#define FALSE
Definition:
types.h:117
BOOL
unsigned int BOOL
Definition:
ntddk_ex.h:94
DWORD
unsigned long DWORD
Definition:
ntddk_ex.h:95
GdiPoolFree
VOID NTAPI GdiPoolFree(PGDI_POOL pPool, PVOID pvAlloc)
Definition:
gdipool.c:233
GdiPoolAllocate
PVOID NTAPI GdiPoolAllocate(PGDI_POOL pPool)
Definition:
gdipool.c:122
void
Definition:
nsiface.idl:2307
ASSERT
#define ASSERT(a)
Definition:
mode.c:44
PsGetCurrentProcessWin32Process
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition:
process.c:1183
DPRINT
#define DPRINT
Definition:
sndvol32.h:73
DC
Definition:
polytest.cpp:41
_DC_ATTR
Definition:
ntgdihdl.h:292
_GDI_DC_ATTR_ENTRY
Definition:
dcattr.c:24
_GDI_DC_ATTR_ENTRY::Attr
DC_ATTR Attr[GDIDCATTRFREE]
Definition:
dcattr.c:25
_GDI_DC_ATTR_FREELIST
Definition:
dcattr.c:17
_GDI_DC_ATTR_FREELIST::nEntries
DWORD nEntries
Definition:
dcattr.c:19
_GDI_DC_ATTR_FREELIST::AttrList
PVOID AttrList[GDIDCATTRFREE]
Definition:
dcattr.c:20
_GDI_DC_ATTR_FREELIST::Entry
LIST_ENTRY Entry
Definition:
dcattr.c:18
_LIST_ENTRY
Definition:
typedefs.h:120
_PROCESSINFO
Definition:
win32.h:253
_PROCESSINFO::pPoolDcAttr
struct _GDI_POOL * pPoolDcAttr
Definition:
win32.h:291
NTAPI
#define NTAPI
Definition:
typedefs.h:36
win32k.h
GDIOBJ_vSetObjectAttr
VOID NTAPI GDIOBJ_vSetObjectAttr(POBJ pobj, PVOID pvObjAttr)
Definition:
gdiobj.c:1096
win32ss
gdi
ntgdi
dcattr.c
Generated on Mon Sep 9 2024 06:14:29 for ReactOS by
1.9.6