bac87bd652c60ee0fb33736d3610d67b93252c28
[reactos.git] / include / ddk / punknown.h
1 /*
2 ReactOS Kernel-Mode COM
3 by Andrew Greenwood
4
5 This file is in the public domain.
6 */
7
8 #ifndef _UNKNOWN_H_
9 #define _UNKNOWN_H_
10
11 #ifdef __cplusplus
12 extern "C" {
13 #include <wdm.h>
14 }
15 #else
16 #include <wdm.h>
17 #endif
18
19 #include <windef.h>
20 #define COM_NO_WINDOWS_H
21 #include <basetyps.h>
22
23 #ifdef PUT_GUIDS_HERE
24 #include <initguid.h>
25 #endif
26
27
28 /* ===============================================================
29 IUnknown
30 */
31
32 #ifndef __IUnknown_INTERFACE_DEFINED__
33 #define __IUnknown_INTERFACE_DEFINED__
34 DEFINE_GUID(
35 IID_IUnknown,
36 0x00000000, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);
37
38 #undef INTERFACE
39 #define INTERFACE IUnknown
40
41 DECLARE_INTERFACE(IUnknown)
42 {
43 STDMETHOD_(NTSTATUS, QueryInterface)( THIS_
44 IN REFIID,
45 OUT PVOID*)
46 PURE;
47
48 STDMETHOD_(ULONG, AddRef)( THIS )
49 PURE;
50
51 STDMETHOD_(ULONG, Release)( THIS )
52 PURE;
53 };
54 #endif
55
56 #undef INTERFACE
57
58 typedef IUnknown *PUNKNOWN;
59
60
61 /* ===============================================================
62 IUnknown definition
63 Boilerplate code macro for use in subclassed interfaces
64 */
65
66 #define DEFINE_ABSTRACT_UNKNOWN() \
67 STDMETHOD_(NTSTATUS, QueryInterface)( THIS_ \
68 REFIID InterfaceId, \
69 PVOID* Interface) \
70 PURE; \
71 \
72 STDMETHOD_(ULONG, AddRef)(THIS) \
73 PURE; \
74 \
75 STDMETHOD_(ULONG, Release)(THIS) \
76 PURE;
77
78
79 /* ===============================================================
80 Constructor callback definition
81 */
82
83 typedef HRESULT (NTAPI *PFNCREATEINSTANCE)(
84 OUT PUNKNOWN* Unknown,
85 IN REFCLSID ClassId,
86 IN PUNKNOWN OuterUnknown,
87 IN POOL_TYPE PoolType);
88
89 #endif