aboutsummaryrefslogtreecommitdiff
path: root/src/balutil/inc/balutil.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/balutil/inc/balutil.h')
-rw-r--r--src/balutil/inc/balutil.h165
1 files changed, 165 insertions, 0 deletions
diff --git a/src/balutil/inc/balutil.h b/src/balutil/inc/balutil.h
new file mode 100644
index 00000000..0fbaab97
--- /dev/null
+++ b/src/balutil/inc/balutil.h
@@ -0,0 +1,165 @@
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
9extern "C" {
10#endif
11
12#define BalExitOnFailure(x, f, ...) if (FAILED(x)) { BalLogError(x, f, __VA_ARGS__); ExitTrace(x, f, __VA_ARGS__); goto LExit; }
13#define BalExitOnRootFailure(x, f, ...) if (FAILED(x)) { BalLogError(x, f, __VA_ARGS__); Dutil_RootFailure(__FILE__, __LINE__, x); ExitTrace(x, f, __VA_ARGS__); goto LExit; }
14#define BalExitOnNullWithLastError(p, x, f, ...) if (NULL == p) { DWORD Dutil_er = ::GetLastError(); x = HRESULT_FROM_WIN32(Dutil_er); if (!FAILED(x)) { x = E_FAIL; } BalLogError(x, f, __VA_ARGS__); ExitTrace(x, f, __VA_ARGS__); goto LExit; }
15
16#define FACILITY_WIX 500
17
18const LPCWSTR BAL_MANIFEST_FILENAME = L"BootstrapperApplicationData.xml";
19
20static const HRESULT E_WIXSTDBA_CONDITION_FAILED = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIX, 1);
21
22static const HRESULT E_MBAHOST_NET452_ON_WIN7RTM = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIX, 1000);
23
24
25/*******************************************************************
26 BalInitialize - remembers the engine interface to enable logging and
27 other functions.
28
29********************************************************************/
30DAPI_(void) BalInitialize(
31 __in IBootstrapperEngine* pEngine
32 );
33
34/*******************************************************************
35 BalInitializeFromCreateArgs - convenience function to call BalBootstrapperEngineCreate
36 then pass it along to BalInitialize.
37
38********************************************************************/
39DAPI_(HRESULT) BalInitializeFromCreateArgs(
40 __in const BOOTSTRAPPER_CREATE_ARGS* pArgs,
41 __out IBootstrapperEngine** ppEngine
42 );
43
44/*******************************************************************
45 BalUninitialize - cleans up utility layer internals.
46
47********************************************************************/
48DAPI_(void) BalUninitialize();
49
50/*******************************************************************
51 BalManifestLoad - loads the Application manifest into an XML document.
52
53********************************************************************/
54DAPI_(HRESULT) BalManifestLoad(
55 __in HMODULE hUXModule,
56 __out IXMLDOMDocument** ppixdManifest
57 );
58
59/*******************************************************************
60BalEvaluateCondition - evaluates a condition using variables in the engine.
61
62********************************************************************/
63DAPI_(HRESULT) BalEvaluateCondition(
64 __in_z LPCWSTR wzCondition,
65 __out BOOL* pf
66 );
67
68/*******************************************************************
69BalFormatString - formats a string using variables in the engine.
70
71 Note: Use StrFree() to release psczOut.
72********************************************************************/
73DAPI_(HRESULT) BalFormatString(
74 __in_z LPCWSTR wzFormat,
75 __inout LPWSTR* psczOut
76 );
77
78/*******************************************************************
79BalGetNumericVariable - gets a number from a variable in the engine.
80
81 Note: Returns E_NOTFOUND if variable does not exist.
82********************************************************************/
83DAPI_(HRESULT) BalGetNumericVariable(
84 __in_z LPCWSTR wzVariable,
85 __out LONGLONG* pllValue
86 );
87
88/*******************************************************************
89BalSetNumericVariable - sets a numeric variable in the engine.
90
91********************************************************************/
92DAPI_(HRESULT) BalSetNumericVariable(
93 __in_z LPCWSTR wzVariable,
94 __in LONGLONG llValue
95 );
96
97/*******************************************************************
98BalStringVariableExists - checks if a string variable exists in the engine.
99
100********************************************************************/
101DAPI_(BOOL) BalStringVariableExists(
102 __in_z LPCWSTR wzVariable
103 );
104
105/*******************************************************************
106BalGetStringVariable - gets a string from a variable in the engine.
107
108 Note: Use StrFree() to release psczValue.
109********************************************************************/
110DAPI_(HRESULT) BalGetStringVariable(
111 __in_z LPCWSTR wzVariable,
112 __inout LPWSTR* psczValue
113 );
114
115/*******************************************************************
116BalSetStringVariable - sets a string variable in the engine.
117
118********************************************************************/
119DAPI_(HRESULT) BalSetStringVariable(
120 __in_z LPCWSTR wzVariable,
121 __in_z_opt LPCWSTR wzValue
122 );
123
124/*******************************************************************
125 BalLog - logs a message with the engine.
126
127********************************************************************/
128DAPIV_(HRESULT) BalLog(
129 __in BOOTSTRAPPER_LOG_LEVEL level,
130 __in_z __format_string LPCSTR szFormat,
131 ...
132 );
133
134/*******************************************************************
135 BalLogError - logs an error message with the engine.
136
137********************************************************************/
138DAPIV_(HRESULT) BalLogError(
139 __in HRESULT hr,
140 __in_z __format_string LPCSTR szFormat,
141 ...
142 );
143
144/*******************************************************************
145BalLogId - logs a message with the engine with a string embedded in a
146 MESSAGETABLE resource.
147
148********************************************************************/
149DAPIV_(HRESULT) BalLogId(
150 __in BOOTSTRAPPER_LOG_LEVEL level,
151 __in DWORD dwLogId,
152 __in HMODULE hModule,
153 ...
154 );
155
156DAPI_(HRESULT) BalLogIdArgs(
157 __in BOOTSTRAPPER_LOG_LEVEL level,
158 __in DWORD dwLogId,
159 __in HMODULE hModule,
160 __in va_list args
161 );
162
163#ifdef __cplusplus
164}
165#endif