ReactOS
0.4.15-dev-8632-gbc8c7d1
gditools.c
Go to the documentation of this file.
1
2
3
/* SDK/DDK/NDK Headers. */
4
#define WIN32_NO_STATUS
5
#include <
windef.h
>
6
#include <
winbase.h
>
7
#include <
wingdi.h
>
8
#include <
winddi.h
>
9
#include <
prntfont.h
>
10
11
#define NTOS_MODE_USER
12
#include <
ndk/ntndk.h
>
13
14
/* Public Win32K Headers */
15
#include <
ntgdityp.h
>
16
#include <
ntgdi.h
>
17
#include <
ntgdihdl.h
>
18
19
PENTRY
20
GdiQueryTable
(
21
VOID
)
22
{
23
PTEB
pTeb =
NtCurrentTeb
();
24
PPEB
pPeb = pTeb->
ProcessEnvironmentBlock
;
25
return
pPeb->
GdiSharedHandleTable
;
26
}
27
28
BOOL
29
GdiIsHandleValid
(
30
_In_
HGDIOBJ
hobj)
31
{
32
PENTRY
pentHmgr =
GdiQueryTable
();
33
USHORT
Index
= (
ULONG_PTR
)hobj & 0xFFFF;
34
PENTRY
pentry = &pentHmgr[
Index
];
35
36
if
((pentry->
einfo
.
pobj
==
NULL
) ||
37
((
LONG_PTR
)pentry->
einfo
.
pobj
> 0) ||
38
(pentry->
FullUnique
!= (
USHORT
)((
ULONG_PTR
)hobj >> 16)))
39
{
40
return
FALSE
;
41
}
42
43
return
TRUE
;
44
}
45
46
BOOL
47
GdiIsHandleValidEx
(
48
_In_
HGDIOBJ
hobj,
49
_In_
GDILOOBJTYPE
ObjectType
)
50
{
51
PENTRY
pentHmgr =
GdiQueryTable
();
52
USHORT
Index
= (
ULONG_PTR
)hobj & 0xFFFF;
53
PENTRY
pentry = &pentHmgr[
Index
];
54
55
if
((pentry->
einfo
.
pobj
==
NULL
) ||
56
((
LONG_PTR
)pentry->
einfo
.
pobj
> 0) ||
57
(pentry->
FullUnique
!= (
USHORT
)((
ULONG_PTR
)hobj >> 16)) ||
58
(pentry->
Objt
!= (
UCHAR
)(
ObjectType
>> 16)) ||
59
(pentry->
Flags
!= (
UCHAR
)(
ObjectType
>> 24)))
60
{
61
return
FALSE
;
62
}
63
64
return
TRUE
;
65
}
66
67
PVOID
68
GdiGetHandleUserData
(
69
_In_
HGDIOBJ
hobj)
70
{
71
PENTRY
pentHmgr =
GdiQueryTable
();
72
USHORT
Index
= (
ULONG_PTR
)hobj;
73
PENTRY
pentry = &pentHmgr[
Index
];
74
75
if
(!
GdiIsHandleValid
(hobj))
76
{
77
return
NULL
;
78
}
79
80
return
pentry->
pUser
;
81
}
82
NULL
#define NULL
Definition:
types.h:112
TRUE
#define TRUE
Definition:
types.h:120
FALSE
#define FALSE
Definition:
types.h:117
ULONG_PTR
#define ULONG_PTR
Definition:
config.h:101
BOOL
unsigned int BOOL
Definition:
ntddk_ex.h:94
GDILOOBJTYPE
enum GDILoObjType GDILOOBJTYPE
GdiIsHandleValidEx
BOOL GdiIsHandleValidEx(_In_ HGDIOBJ hobj, _In_ GDILOOBJTYPE ObjectType)
Definition:
gditools.c:47
GdiQueryTable
PENTRY GdiQueryTable(VOID)
Definition:
gditools.c:20
GdiGetHandleUserData
PVOID GdiGetHandleUserData(_In_ HGDIOBJ hobj)
Definition:
gditools.c:68
GdiIsHandleValid
BOOL GdiIsHandleValid(_In_ HGDIOBJ hobj)
Definition:
gditools.c:29
void
Definition:
nsiface.idl:2307
NtCurrentTeb
#define NtCurrentTeb
Definition:
iphlpapi_private.h:4
ObjectType
ObjectType
Definition:
metafile.c:81
_In_
#define _In_
Definition:
ms_sal.h:308
ntgdi.h
ntgdihdl.h
ntgdityp.h
ntndk.h
USHORT
unsigned short USHORT
Definition:
pedump.c:61
prntfont.h
_ENTRY
Definition:
ntgdihdl.h:218
_ENTRY::Objt
UCHAR Objt
Definition:
ntgdihdl.h:236
_ENTRY::pUser
PVOID pUser
Definition:
ntgdihdl.h:238
_ENTRY::Flags
UCHAR Flags
Definition:
ntgdihdl.h:237
_ENTRY::einfo
union _ENTRY::_EINFO einfo
_ENTRY::FullUnique
USHORT FullUnique
Definition:
ntgdihdl.h:235
_PEB
Definition:
btrfs_drv.h:1907
_PEB::GdiSharedHandleTable
PVOID GdiSharedHandleTable
Definition:
ntddk_ex.h:292
_TEB
Definition:
compat.h:836
_TEB::ProcessEnvironmentBlock
PPEB ProcessEnvironmentBlock
Definition:
ntddk_ex.h:337
LONG_PTR
#define LONG_PTR
Definition:
treelist.c:79
ULONG_PTR
uint32_t ULONG_PTR
Definition:
typedefs.h:65
_ENTRY::_EINFO::pobj
struct _BASEOBJECT * pobj
Definition:
ntgdihdl.h:221
Index
_In_ WDFCOLLECTION _In_ ULONG Index
Definition:
wdfcollection.h:182
winbase.h
winddi.h
windef.h
wingdi.h
UCHAR
unsigned char UCHAR
Definition:
xmlstorage.h:181
modules
rostests
apitests
gditools
gditools.c
Generated on Mon Sep 9 2024 06:06:51 for ReactOS by
1.9.6