aboutsummaryrefslogtreecommitdiff
path: root/src/burn/engine/variable.h
blob: 022683b459f16fbdd20859e9fbff75a9118c90ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#pragma once
// 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.


#if defined(__cplusplus)
extern "C" {
#endif


// constants

const LPCWSTR VARIABLE_DATE = L"Date";
const LPCWSTR VARIABLE_LOGONUSER = L"LogonUser";
const LPCWSTR VARIABLE_INSTALLERNAME = L"InstallerName";
const LPCWSTR VARIABLE_INSTALLERVERSION = L"InstallerVersion";
const LPCWSTR VARIABLE_INSTALLERINFORMATIONALVERSION = L"InstallerInformationalVersion";
const LPCWSTR VARIABLE_REBOOTPENDING = L"RebootPending";


// typedefs

typedef HRESULT (*PFN_INITIALIZEVARIABLE)(
    __in DWORD_PTR dwpData,
    __inout BURN_VARIANT* pValue
    );


// constants

enum BURN_VARIABLE_INTERNAL_TYPE
{
    BURN_VARIABLE_INTERNAL_TYPE_NORMAL, // the BA can set this variable.
    BURN_VARIABLE_INTERNAL_TYPE_OVERRIDABLE_BUILTIN, // the BA can't set this variable, but the unelevated process can serialize it to the elevated process.
    BURN_VARIABLE_INTERNAL_TYPE_BUILTIN, // the BA can't set this variable, and the unelevated process can't serialize it to the elevated process.
};


// structs

typedef struct _BURN_VARIABLE
{
    LPWSTR sczName;
    BURN_VARIANT Value;
    BOOL fHidden;
    BOOL fPersisted;

    // used for late initialization of built-in variables
    BURN_VARIABLE_INTERNAL_TYPE internalType;
    PFN_INITIALIZEVARIABLE pfnInitialize;
    DWORD_PTR dwpInitializeData;
} BURN_VARIABLE;

typedef struct _BURN_VARIABLES
{
    CRITICAL_SECTION csAccess;
    DWORD dwMaxVariables;
    DWORD cVariables;
    BURN_VARIABLE* rgVariables;
} BURN_VARIABLES;


// function declarations

HRESULT VariableInitialize(
    __in BURN_VARIABLES* pVariables
    );
HRESULT VariablesParseFromXml(
    __in BURN_VARIABLES* pVariables,
    __in IXMLDOMNode* pixnBundle
    );
void VariablesUninitialize(
    __in BURN_VARIABLES* pVariables
    );
void VariablesDump(
    __in BURN_VARIABLES* pVariables
    );
HRESULT VariableGetNumeric(
    __in BURN_VARIABLES* pVariables,
    __in_z LPCWSTR wzVariable,
    __out LONGLONG* pllValue
    );
HRESULT VariableGetString(
    __in BURN_VARIABLES* pVariables,
    __in_z LPCWSTR wzVariable,
    __out_z LPWSTR* psczValue
    );
HRESULT VariableGetVersion(
    __in BURN_VARIABLES* pVariables,
    __in_z LPCWSTR wzVariable,
    __in VERUTIL_VERSION** ppValue
    );
HRESULT VariableGetVariant(
    __in BURN_VARIABLES* pVariables,
    __in_z LPCWSTR wzVariable,
    __in BURN_VARIANT* pValue
    );
HRESULT VariableGetFormatted(
    __in BURN_VARIABLES* pVariables,
    __in_z LPCWSTR wzVariable,
    __out_z LPWSTR* psczValue,
    __out BOOL* pfContainsHiddenVariable
    );
HRESULT VariableSetNumeric(
    __in BURN_VARIABLES* pVariables,
    __in_z LPCWSTR wzVariable,
    __in LONGLONG llValue,
    __in BOOL fOverwriteBuiltIn
    );
HRESULT VariableSetString(
    __in BURN_VARIABLES* pVariables,
    __in_z LPCWSTR wzVariable,
    __in_z_opt LPCWSTR wzValue,
    __in BOOL fOverwriteBuiltIn,
    __in BOOL fFormatted
    );
HRESULT VariableSetVersion(
    __in BURN_VARIABLES* pVariables,
    __in_z LPCWSTR wzVariable,
    __in VERUTIL_VERSION* pValue,
    __in BOOL fOverwriteBuiltIn
    );
HRESULT VariableSetVariant(
    __in BURN_VARIABLES* pVariables,
    __in_z LPCWSTR wzVariable,
    __in BURN_VARIANT* pVariant
    );
HRESULT VariableFormatString(
    __in BURN_VARIABLES* pVariables,
    __in_z LPCWSTR wzIn,
    __out_z_opt LPWSTR* psczOut,
    __out_opt SIZE_T* pcchOut
    );
HRESULT VariableFormatStringObfuscated(
    __in BURN_VARIABLES* pVariables,
    __in_z LPCWSTR wzIn,
    __out_z_opt LPWSTR* psczOut,
    __out_opt SIZE_T* pcchOut
    );
HRESULT VariableEscapeString(
    __in_z LPCWSTR wzIn,
    __out_z LPWSTR* psczOut
    );
HRESULT VariableSerialize(
    __in BURN_VARIABLES* pVariables,
    __in BOOL fPersisting,
    __inout BYTE** ppbBuffer,
    __inout SIZE_T* piBuffer
    );
HRESULT VariableDeserialize(
    __in BURN_VARIABLES* pVariables,
    __in BOOL fWasPersisted,
    __in_bcount(cbBuffer) BYTE* pbBuffer,
    __in SIZE_T cbBuffer,
    __inout SIZE_T* piBuffer
    );
HRESULT VariableStrAlloc(
    __in BOOL fZeroOnRealloc,
    __deref_out_ecount_part(cch, 0) LPWSTR* ppwz,
    __in DWORD_PTR cch
    );
HRESULT VariableStrAllocString(
    __in BOOL fZeroOnRealloc,
    __deref_out_ecount_z(cchSource + 1) LPWSTR* ppwz,
    __in_z LPCWSTR wzSource,
    __in DWORD_PTR cchSource
    );
HRESULT VariableStrAllocConcat(
    __in BOOL fZeroOnRealloc,
    __deref_out_z LPWSTR* ppwz,
    __in_z LPCWSTR wzSource,
    __in DWORD_PTR cchSource
    );
HRESULT __cdecl VariableStrAllocFormatted(
    __in BOOL fZeroOnRealloc,
    __deref_out_z LPWSTR* ppwz,
    __in __format_string LPCWSTR wzFormat,
    ...
    );
HRESULT VariableIsHidden(
    __in BURN_VARIABLES* pVariables,
    __in_z LPCWSTR wzVariable,
    __out BOOL* pfHidden
    );
BOOL VariableIsHiddenCommandLine(
    __in BURN_VARIABLES* pVariables,
    __in_z LPCWSTR wzVariable
    );

#if defined(__cplusplus)
}
#endif