ReactOS 0.4.15-dev-8393-g61b7fb9
stdunk.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
14CUnknown::CUnknown(PUNKNOWN outer_unknown)
15{
16 m_ref_count = 0;
17
18 if ( outer_unknown )
19 m_outer_unknown = outer_unknown;
20 else
21 m_outer_unknown = PUNKNOWN(dynamic_cast<PNONDELEGATINGUNKNOWN>(this));
22}
23
24CUnknown::~CUnknown()
25{
26}
27
29CUnknown::NonDelegatingAddRef()
30{
32 return m_ref_count;
33}
34
36CUnknown::NonDelegatingRelease()
37{
39 {
40 m_ref_count ++;
41 delete this;
42 return 0;
43 }
44
45 return m_ref_count;
46}
47
49CUnknown::NonDelegatingQueryInterface(
50 IN REFIID iid,
51 PVOID* ppVoid)
52{
53 /* FIXME */
54 #if 0
55 if ( IsEqualGUID(iid, IID_IUnknown) ) /* TODO: Aligned? */
56 *ppVoid = PVOID(PUNKNOWN(this));
57 else
58 *ppVoid = NULL;
59 #endif
60
61 if ( *ppVoid )
62 {
63 PUNKNOWN(*ppVoid)->AddRef();
64 return STATUS_SUCCESS;
65 }
66
68}
#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
#define NULL
Definition: types.h:112
ULONG AddRef()
#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
void * PVOID
Definition: typedefs.h:50
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135