ReactOS 0.4.15-dev-7906-g1b85a5f
unknown.c File Reference
#include "precomp.h"
#include <debug.h>
Include dependency graph for unknown.c:

Go to the source code of this file.

Classes

struct  CBaseUnknownImpl
 

Macros

#define NDEBUG
 
#define KS_DECL_CXX(RET_)   extern RET_ __cdecl
 
#define KS_THIS(CLASS_)   CLASS_ * This
 

Functions

NTSTATUS NTAPI INonDelegatedUnknown_fnQueryInterface (INonDelegatedUnknown *iface, IN REFIID refiid, OUT PVOID *Output)
 
ULONG NTAPI INonDelegatedUnknown_fnAddRef (INonDelegatedUnknown *iface)
 
ULONG NTAPI INonDelegatedUnknown_fnRelease (INonDelegatedUnknown *iface)
 
NTSTATUS NTAPI IIndirectedUnknown_fnQueryInterface (IIndirectedUnknown *iface, IN REFIID refiid, OUT PVOID *Output)
 
ULONG NTAPI IIndirectedUnknown_fnAddRef (IIndirectedUnknown *iface)
 
ULONG NTAPI IIndirectedUnknown_fnRelease (IIndirectedUnknown *iface)
 
 KS_DECL_CXX (CBaseUnknownImpl *)
 
 KS_DECL_CXX (VOID)
 

Variables

static INonDelegatedUnknownVtbl vt_INonDelegatedUnknownVtbl
 
static IIndirectedUnknownVtbl vt_IIndirectedUnknownVtbl
 

Macro Definition Documentation

◆ KS_DECL_CXX

#define KS_DECL_CXX (   RET_)    extern RET_ __cdecl

Definition at line 19 of file unknown.c.

◆ KS_THIS

#define KS_THIS (   CLASS_)    CLASS_ * This

Definition at line 20 of file unknown.c.

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file unknown.c.

Function Documentation

◆ IIndirectedUnknown_fnAddRef()

ULONG NTAPI IIndirectedUnknown_fnAddRef ( IIndirectedUnknown *  iface)

Definition at line 100 of file unknown.c.

102{
103 CBaseUnknownImpl * This = (CBaseUnknownImpl*)CONTAINING_RECORD(iface, CBaseUnknownImpl, lpVtblIndirectedUnknown);
104
105 return This->m_UnknownOuter->lpVtbl->AddRef(This->m_UnknownOuter);
106}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

◆ IIndirectedUnknown_fnQueryInterface()

NTSTATUS NTAPI IIndirectedUnknown_fnQueryInterface ( IIndirectedUnknown *  iface,
IN REFIID  refiid,
OUT PVOID Output 
)

Definition at line 88 of file unknown.c.

92{
93 CBaseUnknownImpl * This = (CBaseUnknownImpl*)CONTAINING_RECORD(iface, CBaseUnknownImpl, lpVtblIndirectedUnknown);
94
95 return This->m_UnknownOuter->lpVtbl->QueryInterface(This->m_UnknownOuter, refiid, Output);
96}
@ Output
Definition: arc.h:85

◆ IIndirectedUnknown_fnRelease()

ULONG NTAPI IIndirectedUnknown_fnRelease ( IIndirectedUnknown *  iface)

Definition at line 110 of file unknown.c.

112{
113 CBaseUnknownImpl * This = (CBaseUnknownImpl*)CONTAINING_RECORD(iface, CBaseUnknownImpl, lpVtblIndirectedUnknown);
114
115 return This->m_UnknownOuter->lpVtbl->Release(This->m_UnknownOuter);
116}

◆ INonDelegatedUnknown_fnAddRef()

ULONG NTAPI INonDelegatedUnknown_fnAddRef ( INonDelegatedUnknown *  iface)

Definition at line 58 of file unknown.c.

60{
62
63 return InterlockedIncrement(&This->m_RefCount);
64}
#define InterlockedIncrement
Definition: armddk.h:53

◆ INonDelegatedUnknown_fnQueryInterface()

NTSTATUS NTAPI INonDelegatedUnknown_fnQueryInterface ( INonDelegatedUnknown *  iface,
IN REFIID  refiid,
OUT PVOID Output 
)

Definition at line 40 of file unknown.c.

44{
46
47 if (IsEqualGUIDAligned(refiid, &IID_IUnknown))
48 {
49 *Output = &This->lpVtbl;
50 _InterlockedIncrement(&This->m_RefCount);
51 return STATUS_SUCCESS;
52 }
53 return STATUS_NOINTERFACE;
54}
const GUID IID_IUnknown
long __cdecl _InterlockedIncrement(_Interlocked_operand_ long volatile *_Addend)
#define STATUS_NOINTERFACE
Definition: ntstatus.h:812
#define STATUS_SUCCESS
Definition: shellext.h:65
#define IsEqualGUIDAligned(guid1, guid2)
Definition: wdm.template.h:235

◆ INonDelegatedUnknown_fnRelease()

ULONG NTAPI INonDelegatedUnknown_fnRelease ( INonDelegatedUnknown *  iface)

Definition at line 68 of file unknown.c.

70{
72
73 InterlockedDecrement(&This->m_RefCount);
74
75 /* Return new reference count */
76 return This->m_RefCount;
77}
#define InterlockedDecrement
Definition: armddk.h:52

◆ KS_DECL_CXX() [1/2]

KS_DECL_CXX ( CBaseUnknownImpl )

Definition at line 126 of file unknown.c.

127{
128
130 This->lpVtblIndirectedUnknown = &vt_IIndirectedUnknownVtbl;
131
132 /* class uses class id */
133 This->m_UsingClassId = TRUE;
134
135 /* copy guid */
136 RtlMoveMemory(&This->m_ClassId, lpGUID, sizeof(GUID));
137
138 /* set refcount to zero */
139 This->m_RefCount = 0;
140
141 if (OuterUnknown)
142 {
143 /* use outer unknown */
144 This->m_UnknownOuter = OuterUnknown;
145 }
146 else
147 {
148 /* use unknown from INonDelegatedUnknown */
149 This->m_UnknownOuter = (PUNKNOWN)&This->lpVtbl;
150 }
151
152 /* return result */
153 return This;
154}
IUnknown * PUNKNOWN
Definition: com_apitest.h:45
#define TRUE
Definition: types.h:120
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
static IIndirectedUnknownVtbl vt_IIndirectedUnknownVtbl
Definition: unknown.c:118
static INonDelegatedUnknownVtbl vt_INonDelegatedUnknownVtbl
Definition: unknown.c:79

◆ KS_DECL_CXX() [2/2]

KS_DECL_CXX ( VOID  )

Definition at line 183 of file unknown.c.

184{
185 /* restore vtbl's */
187 This->lpVtblIndirectedUnknown = &vt_IIndirectedUnknownVtbl;
188
189
190 if (OuterUnknown)
191 {
192 /* use outer unknown */
193 This->m_UnknownOuter = OuterUnknown;
194 }
195 else
196 {
197 /* use unknown from INonDelegatedUnknown */
198 This->m_UnknownOuter = (PUNKNOWN)&This->lpVtbl;
199 }
200}

Variable Documentation

◆ vt_IIndirectedUnknownVtbl

IIndirectedUnknownVtbl vt_IIndirectedUnknownVtbl
static
Initial value:
=
{
}
NTSTATUS NTAPI IIndirectedUnknown_fnQueryInterface(IIndirectedUnknown *iface, IN REFIID refiid, OUT PVOID *Output)
Definition: unknown.c:88
ULONG NTAPI IIndirectedUnknown_fnRelease(IIndirectedUnknown *iface)
Definition: unknown.c:110
ULONG NTAPI IIndirectedUnknown_fnAddRef(IIndirectedUnknown *iface)
Definition: unknown.c:100

Definition at line 118 of file unknown.c.

Referenced by KS_DECL_CXX().

◆ vt_INonDelegatedUnknownVtbl

INonDelegatedUnknownVtbl vt_INonDelegatedUnknownVtbl
static
Initial value:
=
{
}
ULONG NTAPI INonDelegatedUnknown_fnRelease(INonDelegatedUnknown *iface)
Definition: unknown.c:68
NTSTATUS NTAPI INonDelegatedUnknown_fnQueryInterface(INonDelegatedUnknown *iface, IN REFIID refiid, OUT PVOID *Output)
Definition: unknown.c:40
ULONG NTAPI INonDelegatedUnknown_fnAddRef(INonDelegatedUnknown *iface)
Definition: unknown.c:58

Definition at line 79 of file unknown.c.

Referenced by KS_DECL_CXX().