xref: /reactos/sdk/include/ddk/punknown.h (revision 40462c92)
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     IUnknown
29 */
30 
31 #ifndef __IUnknown_INTERFACE_DEFINED__
32 #define __IUnknown_INTERFACE_DEFINED__
33 
34 DEFINE_GUID(IID_IUnknown,
35     0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x46);
36 
37 #undef INTERFACE
38 #define INTERFACE IUnknown
39 
40 DECLARE_INTERFACE(IUnknown) {
41   STDMETHOD_(NTSTATUS, QueryInterface)( THIS_
42     _In_ REFIID,
43     _COM_Outptr_ PVOID*) PURE;
44 
45   STDMETHOD_(ULONG, AddRef)( THIS ) PURE;
46 
47   STDMETHOD_(ULONG, Release)( THIS ) PURE;
48 };
49 
50 #endif /* __IUnknown_INTERFACE_DEFINED__ */
51 
52 #undef INTERFACE
53 
54 typedef IUnknown *PUNKNOWN;
55 
56 /* ===============================================================
57     IUnknown definition
58     Boilerplate code macro for use in subclassed interfaces
59 */
60 
61 #define DEFINE_ABSTRACT_UNKNOWN()             \
62   STDMETHOD_(NTSTATUS, QueryInterface)( THIS_ \
63     REFIID InterfaceId,                       \
64     PVOID* Interface) PURE;                   \
65                                               \
66   STDMETHOD_(ULONG, AddRef)(THIS) PURE;       \
67                                               \
68   STDMETHOD_(ULONG, Release)(THIS) PURE;
69 
70 /* ===============================================================
71     Constructor callback definition
72 */
73 
74 typedef HRESULT
75 (NTAPI *PFNCREATEINSTANCE)(
76   _Out_ PUNKNOWN* Unknown,
77   _In_ REFCLSID ClassId,
78   _In_ PUNKNOWN OuterUnknown,
79   _In_ POOL_TYPE PoolType);
80 
81 #endif /* _UNKNOWN_H_ */
82