diff options
Diffstat (limited to 'src/api/burn/bextutil/inc/bextutil.h')
-rw-r--r-- | src/api/burn/bextutil/inc/bextutil.h | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/src/api/burn/bextutil/inc/bextutil.h b/src/api/burn/bextutil/inc/bextutil.h new file mode 100644 index 00000000..ac9c0062 --- /dev/null +++ b/src/api/burn/bextutil/inc/bextutil.h | |||
@@ -0,0 +1,106 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | #include "dutil.h" | ||
6 | |||
7 | |||
8 | #ifdef __cplusplus | ||
9 | extern "C" { | ||
10 | #endif | ||
11 | |||
12 | #define BextExitOnFailureSource(d, x, f, ...) if (FAILED(x)) { BextLogError(x, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } | ||
13 | #define BextExitOnRootFailureSource(d, x, f, ...) if (FAILED(x)) { BextLogError(x, f, __VA_ARGS__); Dutil_RootFailure(__FILE__, __LINE__, x); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } | ||
14 | #define BextExitOnLastErrorSource(d, x, f, ...) { x = ::GetLastError(); x = HRESULT_FROM_WIN32(x); if (FAILED(x)) { BextLogError(x, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } } | ||
15 | #define BextExitOnNullSource(d, p, x, e, f, ...) if (NULL == p) { x = e; BextLogError(x, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } | ||
16 | #define BextExitOnNullWithLastErrorSource(d, p, x, f, ...) if (NULL == p) { DWORD Dutil_er = ::GetLastError(); x = HRESULT_FROM_WIN32(Dutil_er); if (!FAILED(x)) { x = E_FAIL; } BextLogError(x, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } | ||
17 | #define BextExitWithLastErrorSource(d, x, f, ...) { DWORD Dutil_er = ::GetLastError(); x = HRESULT_FROM_WIN32(Dutil_er); if (!FAILED(x)) { x = E_FAIL; } BextLogError(x, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } | ||
18 | |||
19 | #define BextExitOnFailure(x, f, ...) BextExitOnFailureSource(DUTIL_SOURCE_DEFAULT, x, f, __VA_ARGS__) | ||
20 | #define BextExitOnRootFailure(x, f, ...) BextExitOnRootFailureSource(DUTIL_SOURCE_DEFAULT, x, f, __VA_ARGS__) | ||
21 | #define BextExitOnLastError(x, f, ...) BextExitOnLastErrorSource(DUTIL_SOURCE_DEFAULT, x, f, __VA_ARGS__) | ||
22 | #define BextExitOnNull(p, x, e, f, ...) BextExitOnNullSource(DUTIL_SOURCE_DEFAULT, p, x, e, f, __VA_ARGS__) | ||
23 | #define BextExitOnNullWithLastError(p, x, f, ...) BextExitOnNullWithLastErrorSource(DUTIL_SOURCE_DEFAULT, p, x, f, __VA_ARGS__) | ||
24 | #define BextExitWithLastError(x, f, ...) BextExitWithLastErrorSource(DUTIL_SOURCE_DEFAULT, x, f, __VA_ARGS__) | ||
25 | |||
26 | const LPCWSTR BUNDLE_EXTENSION_MANIFEST_FILENAME = L"BundleExtensionData.xml"; | ||
27 | |||
28 | |||
29 | /******************************************************************* | ||
30 | BextInitialize - remembers the engine interface to enable logging and | ||
31 | other functions. | ||
32 | |||
33 | ********************************************************************/ | ||
34 | DAPI_(void) BextInitialize( | ||
35 | __in IBundleExtensionEngine* pEngine | ||
36 | ); | ||
37 | |||
38 | /******************************************************************* | ||
39 | BextInitializeFromCreateArgs - convenience function to call BextBundleExtensionEngineCreate | ||
40 | then pass it along to BextInitialize. | ||
41 | |||
42 | ********************************************************************/ | ||
43 | DAPI_(HRESULT) BextInitializeFromCreateArgs( | ||
44 | __in const BUNDLE_EXTENSION_CREATE_ARGS* pArgs, | ||
45 | __out IBundleExtensionEngine** ppEngine | ||
46 | ); | ||
47 | |||
48 | /******************************************************************* | ||
49 | BextUninitialize - cleans up utility layer internals. | ||
50 | |||
51 | ********************************************************************/ | ||
52 | DAPI_(void) BextUninitialize(); | ||
53 | |||
54 | /******************************************************************* | ||
55 | BextGetBundleExtensionDataNode - gets the requested BundleExtension node. | ||
56 | |||
57 | ********************************************************************/ | ||
58 | DAPI_(HRESULT) BextGetBundleExtensionDataNode( | ||
59 | __in IXMLDOMDocument* pixdManifest, | ||
60 | __in LPCWSTR wzExtensionId, | ||
61 | __out IXMLDOMNode** ppixnBundleExtension | ||
62 | ); | ||
63 | |||
64 | /******************************************************************* | ||
65 | BextLog - logs a message with the engine. | ||
66 | |||
67 | ********************************************************************/ | ||
68 | DAPIV_(HRESULT) BextLog( | ||
69 | __in BUNDLE_EXTENSION_LOG_LEVEL level, | ||
70 | __in_z __format_string LPCSTR szFormat, | ||
71 | ... | ||
72 | ); | ||
73 | |||
74 | /******************************************************************* | ||
75 | BextLogArgs - logs a message with the engine. | ||
76 | |||
77 | ********************************************************************/ | ||
78 | DAPI_(HRESULT) BextLogArgs( | ||
79 | __in BUNDLE_EXTENSION_LOG_LEVEL level, | ||
80 | __in_z __format_string LPCSTR szFormat, | ||
81 | __in va_list args | ||
82 | ); | ||
83 | |||
84 | /******************************************************************* | ||
85 | BextLogError - logs an error message with the engine. | ||
86 | |||
87 | ********************************************************************/ | ||
88 | DAPIV_(HRESULT) BextLogError( | ||
89 | __in HRESULT hr, | ||
90 | __in_z __format_string LPCSTR szFormat, | ||
91 | ... | ||
92 | ); | ||
93 | |||
94 | /******************************************************************* | ||
95 | BextLogErrorArgs - logs an error message with the engine. | ||
96 | |||
97 | ********************************************************************/ | ||
98 | DAPI_(HRESULT) BextLogErrorArgs( | ||
99 | __in HRESULT hr, | ||
100 | __in_z __format_string LPCSTR szFormat, | ||
101 | __in va_list args | ||
102 | ); | ||
103 | |||
104 | #ifdef __cplusplus | ||
105 | } | ||
106 | #endif | ||