summaryrefslogtreecommitdiff
path: root/src/api/burn/bextutil/inc/BextBaseBundleExtension.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/burn/bextutil/inc/BextBaseBundleExtension.h')
-rw-r--r--src/api/burn/bextutil/inc/BextBaseBundleExtension.h120
1 files changed, 120 insertions, 0 deletions
diff --git a/src/api/burn/bextutil/inc/BextBaseBundleExtension.h b/src/api/burn/bextutil/inc/BextBaseBundleExtension.h
new file mode 100644
index 00000000..69c338e4
--- /dev/null
+++ b/src/api/burn/bextutil/inc/BextBaseBundleExtension.h
@@ -0,0 +1,120 @@
1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3#include <windows.h>
4
5#include "BundleExtensionEngine.h"
6#include "BundleExtension.h"
7#include "IBundleExtensionEngine.h"
8#include "IBundleExtension.h"
9
10#include "bextutil.h"
11
12class CBextBaseBundleExtension : public IBundleExtension
13{
14public: // IUnknown
15 virtual STDMETHODIMP QueryInterface(
16 __in REFIID riid,
17 __out LPVOID *ppvObject
18 )
19 {
20 if (!ppvObject)
21 {
22 return E_INVALIDARG;
23 }
24
25 *ppvObject = NULL;
26
27 if (::IsEqualIID(__uuidof(IBundleExtension), riid))
28 {
29 *ppvObject = static_cast<IBundleExtension*>(this);
30 }
31 else if (::IsEqualIID(IID_IUnknown, riid))
32 {
33 *ppvObject = static_cast<IUnknown*>(this);
34 }
35 else // no interface for requested iid
36 {
37 return E_NOINTERFACE;
38 }
39
40 AddRef();
41 return S_OK;
42 }
43
44 virtual STDMETHODIMP_(ULONG) AddRef()
45 {
46 return ::InterlockedIncrement(&this->m_cReferences);
47 }
48
49 virtual STDMETHODIMP_(ULONG) Release()
50 {
51 long l = ::InterlockedDecrement(&this->m_cReferences);
52 if (0 < l)
53 {
54 return l;
55 }
56
57 delete this;
58 return 0;
59 }
60
61public: // IBundleExtension
62 virtual STDMETHODIMP Search(
63 __in LPCWSTR /*wzId*/,
64 __in LPCWSTR /*wzVariable*/
65 )
66 {
67 return E_NOTIMPL;
68 }
69
70 virtual STDMETHODIMP BundleExtensionProc(
71 __in BUNDLE_EXTENSION_MESSAGE /*message*/,
72 __in const LPVOID /*pvArgs*/,
73 __inout LPVOID /*pvResults*/,
74 __in_opt LPVOID /*pvContext*/
75 )
76 {
77 return E_NOTIMPL;
78 }
79
80public: //CBextBaseBundleExtension
81 virtual STDMETHODIMP Initialize(
82 __in const BUNDLE_EXTENSION_CREATE_ARGS* pCreateArgs
83 )
84 {
85 HRESULT hr = S_OK;
86
87 hr = StrAllocString(&m_sczBundleExtensionDataPath, pCreateArgs->wzBundleExtensionDataPath, 0);
88 ExitOnFailure(hr, "Failed to copy BundleExtensionDataPath.");
89
90 LExit:
91 return hr;
92 }
93
94protected:
95
96 CBextBaseBundleExtension(
97 __in IBundleExtensionEngine* pEngine
98 )
99 {
100 m_cReferences = 1;
101
102 pEngine->AddRef();
103 m_pEngine = pEngine;
104
105 m_sczBundleExtensionDataPath = NULL;
106 }
107
108 virtual ~CBextBaseBundleExtension()
109 {
110 ReleaseNullObject(m_pEngine);
111 ReleaseStr(m_sczBundleExtensionDataPath);
112 }
113
114protected:
115 IBundleExtensionEngine* m_pEngine;
116 LPWSTR m_sczBundleExtensionDataPath;
117
118private:
119 long m_cReferences;
120};