- Merge aicom-network-fixes up to r36740
[reactos.git] / reactos / drivers / wdm / audio / backpln / stdunk / stdunk.c
1 /*
2 "Unknown" implementation, in C
3 by Andrew Greenwood
4
5 Not quite sure how this is used, but the C++ variant is intended for
6 implementing a NonDelegatingUnknown object
7 */
8
9 #include <stdunk.h>
10
11 STDMETHODCALLTYPE
12 NTSTATUS
13 Unknown_QueryInterface(
14 IUnknown* this,
15 IN REFIID refiid,
16 OUT PVOID* output)
17 {
18 /* TODO */
19 return STATUS_SUCCESS;
20 }
21
22 STDMETHODCALLTYPE
23 ULONG
24 Unknown_AddRef(
25 IUnknown* unknown_this)
26 {
27 struct CUnknown* this = CONTAINING_RECORD(unknown_this, struct CUnknown, IUnknown);
28
29 InterlockedIncrement(&this->m_ref_count);
30 return this->m_ref_count;
31 }
32
33 STDMETHODCALLTYPE
34 ULONG
35 Unknown_Release(
36 IUnknown* unknown_this)
37 {
38 struct CUnknown* this = CONTAINING_RECORD(unknown_this, struct CUnknown, IUnknown);
39
40 InterlockedDecrement(&this->m_ref_count);
41
42 if ( this->m_ref_count == 0 )
43 {
44 ExFreePool(this);
45 return 0;
46 }
47
48 return this->m_ref_count;
49 }
50
51
52 /*
53 The vtable for Unknown
54 */
55
56 const IUnknownVtbl UnknownVtbl =
57 {
58 Unknown_QueryInterface,
59 Unknown_AddRef,
60 Unknown_Release
61 };
62