ReactOS  0.4.14-dev-297-g23e575c
baseobj.hpp
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #define GDIOBJ_POOL_TAG(type) ('00hG' + (((type) & 0x1f) << 24))
5 
6 #define BASEOBJECT CBASEOBJECT
7 
8 class BASEOBJECT : private _BASEOBJECT
9 {
10 public:
11 
12  enum OWNER
13  {
17  };
18 
19 protected:
20 
22  _In_ GDILOOBJTYPE loobjtype)
23  {
24  /* Initialize the object */
25  _BASEOBJECT::hHmgr = (HGDIOBJ)(ULONG_PTR)loobjtype;
26  this->cExclusiveLock = 0;
27  this->ulShareCount = 1;
28  this->BaseFlags = 0;//fl & 0xffff;
29  DBG_INITLOG(&this->slhLog);
30  DBG_LOGEVENT(&this->slhLog, EVENT_ALLOCATE, 0);
31  #if DBG_ENABLE_GDIOBJ_BACKTRACES
32  DbgCaptureStackBackTace(this->apvBackTrace, 1, GDI_OBJECT_STACK_LEVELS);
33  #endif /* GDI_DEBUG */
34  }
35 
36  static
37  BASEOBJECT*
39  HGDIOBJ hobj,
40  GDIOBJTYPE objtype);
41 
42  static
43  BASEOBJECT*
45  HGDIOBJ hobj,
46  GDILOOBJTYPE loobjtype);
47 
48  static
49  BASEOBJECT*
51  HGDIOBJ hobj,
52  GDILOOBJTYPE loobjtype,
53  OWNER owner)
54  {
56  return reinterpret_cast<CBASEOBJECT*>(GDIOBJ_ShareLockObj(hobj, loobjtype));
57  }
58 
59  VOID
61  _In_opt_ PVOID pvUserAttr)
62  {
63  GDIOBJ_vSetObjectAttr((POBJ)this, pvUserAttr);
64  }
65 
66 
67 public:
68 
69  static
70  inline
71  PVOID
73  _In_ GDIOBJTYPE objtype,
75  {
77  }
78 
79  VOID
81  VOID)
82  {
83  if (this->cExclusiveLock > 0)
84  {
86  }
87  else
88  {
90  }
91  }
92 
93  inline
94  HGDIOBJ
96  VOID)
97  {
98  return _BASEOBJECT::hHmgr;
99  }
100 
101  HGDIOBJ
103  OWNER owner)
104  {
105  return GDIOBJ_hInsertObject(this, owner);
106  }
107 
108 };
109 
110 
ULONG NTAPI DbgCaptureStackBackTace(_Out_writes_(cFramesToCapture) PVOID *ppvFrames, _In_ ULONG cFramesToSkip, _In_ ULONG cFramesToCapture)
ULONG ulShareCount
Definition: gdiobj.h:42
static PVOID pvAllocate(_In_ GDIOBJTYPE objtype, _In_ SIZE_T cjSize)
Definition: baseobj.hpp:72
#define DBG_INITLOG(pslh)
Definition: gdidebug.h:110
VOID NTAPI GDIOBJ_vDereferenceObject(POBJ pobj)
Definition: gdiobj.c:628
USHORT cExclusiveLock
Definition: gdiobj.h:45
HGDIOBJ hHmgr
Definition: gdiobj.h:40
#define _In_opt_
Definition: no_sal2.h:213
USHORT BaseFlags
Definition: gdiobj.h:46
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define DBG_LOGEVENT(pslh, type, val)
Definition: gdidebug.h:109
PGDIOBJ NTAPI GDIOBJ_ShareLockObj(HGDIOBJ hObj, DWORD ExpectedType)
Definition: gdiobj.c:1440
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
static BASEOBJECT * LockExclusive(HGDIOBJ hobj, GDIOBJTYPE objtype)
#define GDIOBJ_POOL_TAG(type)
Definition: baseobj.hpp:4
VOID NTAPI GDIOBJ_vSetObjectAttr(POBJ pobj, PVOID pvObjAttr)
Definition: gdiobj.c:1093
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
BASEOBJECT(_In_ GDILOOBJTYPE loobjtype)
Definition: baseobj.hpp:21
VOID NTAPI GDIOBJ_vUnlockObject(POBJ pobj)
Definition: gdiobj.c:877
#define GDI_OBJ_HMGR_POWNED
Definition: ntgdihdl.h:117
#define GDI_OBJECT_STACK_LEVELS
Definition: gdiobj.h:8
#define _In_
Definition: no_sal2.h:204
void * HGDIOBJ
Definition: windef.h:252
ULONG_PTR SIZE_T
Definition: typedefs.h:78
#define GDI_OBJ_HMGR_PUBLIC
Definition: ntgdihdl.h:116
static BASEOBJECT * LockShared(HGDIOBJ hobj, GDILOOBJTYPE loobjtype, OWNER owner)
Definition: baseobj.hpp:50
enum GDIObjType GDIOBJTYPE
#define GDI_OBJ_HMGR_NONE
Definition: ntgdihdl.h:118
_In_ ULONG cjSize
Definition: winddi.h:3634
HGDIOBJ hInsertObject(OWNER owner)
Definition: baseobj.hpp:102
enum GDILoObjType GDILOOBJTYPE
VOID vSetObjectAttr(_In_opt_ PVOID pvUserAttr)
Definition: baseobj.hpp:60
VOID vUnlock(VOID)
Definition: baseobj.hpp:80
HGDIOBJ NTAPI GDIOBJ_hInsertObject(POBJ pobj, ULONG ulOwner)
Definition: gdiobj.c:909