ReactOS 0.4.15-dev-7942-gd23573b
cunknown.cpp
Go to the documentation of this file.
1/*
2 ReactOS Kernel-Mode COM
3 IUnknown implementations
4
5 LICENSE
6 Please see COPYING in the top-level directory for license information.
7
8 AUTHORS
9 Andrew Greenwood
10*/
11
12#include <stdunk.h>
13
14inline
17 size_t size,
18 POOL_TYPE pool_type,
19 ULONG tag)
20{
22
23 result = ExAllocatePoolWithTag(pool_type, size, tag);
24
25 if (result)
27
28 return result;
29}
30
33operator new(
34 size_t size,
35 POOL_TYPE pool_type)
36{
37 return KCOM_New(size, pool_type, 'wNcP');
38}
39
42operator new(
43 size_t size,
44 POOL_TYPE pool_type,
45 ULONG tag)
46{
47 return KCOM_New(size, pool_type, tag);
48}
49
50void
52operator delete(
53 PVOID ptr)
54{
56}
57
58void
60operator delete(
62{
64}
65
66CUnknown::CUnknown(PUNKNOWN outer_unknown)
67{
68 m_ref_count = 0;
69
70 if ( outer_unknown )
71 m_outer_unknown = outer_unknown;
72 else
73 m_outer_unknown = PUNKNOWN(dynamic_cast<PNONDELEGATINGUNKNOWN>(this));
74}
75
76CUnknown::~CUnknown()
77{
78}
79
81CUnknown::NonDelegatingAddRef()
82{
84 return m_ref_count;
85}
86
88CUnknown::NonDelegatingRelease()
89{
91 {
92 m_ref_count ++;
93 delete this;
94 return 0;
95 }
96
97 return m_ref_count;
98}
99
101CUnknown::NonDelegatingQueryInterface(
102 IN REFIID iid,
103 PVOID* ppVoid)
104{
105 /* FIXME */
106 #if 0
107 if ( IsEqualGUID(iid, IID_IUnknown) ) /* TODO: Aligned? */
108 *ppVoid = PVOID(PUNKNOWN(this));
109 else
110 *ppVoid = NULL;
111 #endif
112
113 if ( *ppVoid )
114 {
115 PUNKNOWN(*ppVoid)->AddRef();
116 return STATUS_SUCCESS;
117 }
118
120}
121
122#if __GNUC__
123extern "C" void __cxa_pure_virtual() { ASSERT(FALSE); }
124#endif
#define __cdecl
Definition: accygwin.h:79
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
LONG NTSTATUS
Definition: precomp.h:26
#define STDMETHODIMP_(t)
Definition: basetyps.h:44
const GUID IID_IUnknown
IUnknown * PUNKNOWN
Definition: com_apitest.h:45
PVOID KCOM_New(size_t size, POOL_TYPE pool_type, ULONG tag)
Definition: cunknown.cpp:16
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
GLsizeiptr size
Definition: glext.h:5919
GLuint64EXT * result
Definition: glext.h:11304
ULONG AddRef()
#define ASSERT(a)
Definition: mode.c:44
static PVOID ptr
Definition: dispmode.c:27
EXTERN_C void __cxa_pure_virtual(void)
Definition: msctfime.cpp:20
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define STATUS_SUCCESS
Definition: shellext.h:65
INonDelegatingUnknown * PNONDELEGATINGUNKNOWN
Definition: stdunk.h:30
PUNKNOWN m_outer_unknown
Definition: stdunk.h:120
LONG m_ref_count
Definition: stdunk.h:119
Definition: ecma_167.h:138
INT POOL_TYPE
Definition: typedefs.h:78
void * PVOID
Definition: typedefs.h:50
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135