Skip to content
/ wix Public

Commit c258b72

Browse files
committed
Support dual-purpose packages in Burn.
Fixes wixtoolset/issues#8958
1 parent a3d3963 commit c258b72

File tree

174 files changed

+3552
-651
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

174 files changed

+3552
-651
lines changed

src/api/burn/WixToolset.BootstrapperApplicationApi/BootstrapperCommand.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public struct Command
2020
[MarshalAs(UnmanagedType.I4)] internal int cbSize;
2121
[MarshalAs(UnmanagedType.U4)] private readonly LaunchAction action;
2222
[MarshalAs(UnmanagedType.U4)] private readonly Display display;
23+
[MarshalAs(UnmanagedType.U4)] private readonly BundleScope scope;
2324
private readonly IntPtr wzCommandLine;
2425
[MarshalAs(UnmanagedType.I4)] private readonly int nCmdShow;
2526
[MarshalAs(UnmanagedType.U4)] private readonly ResumeType resume;
@@ -39,6 +40,7 @@ public IBootstrapperCommand GetBootstrapperCommand()
3940
return new BootstrapperCommand(
4041
this.action,
4142
this.display,
43+
this.scope,
4244
Marshal.PtrToStringUni(this.wzCommandLine),
4345
this.nCmdShow,
4446
this.resume,
@@ -62,6 +64,7 @@ public sealed class BootstrapperCommand : IBootstrapperCommand
6264
public BootstrapperCommand(
6365
LaunchAction action,
6466
Display display,
67+
BundleScope scope,
6568
string commandLine,
6669
int cmdShow,
6770
ResumeType resume,
@@ -74,6 +77,7 @@ public BootstrapperCommand(
7477
{
7578
this.Action = action;
7679
this.Display = display;
80+
this.Scope = scope;
7781
this.CommandLine = commandLine;
7882
this.CmdShow = cmdShow;
7983
this.Resume = resume;
@@ -91,6 +95,9 @@ public BootstrapperCommand(
9195
/// <inheritdoc/>
9296
public Display Display { get; }
9397

98+
/// <inheritdoc/>
99+
public BundleScope Scope { get; }
100+
94101
/// <inheritdoc/>
95102
public string CommandLine { get; }
96103

src/api/burn/WixToolset.BootstrapperApplicationApi/Engine.cs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace WixToolset.BootstrapperApplicationApi
1212
/// </summary>
1313
public sealed class Engine : IEngine
1414
{
15-
private IBootstrapperEngine engine;
15+
private readonly IBootstrapperEngine engine;
1616

1717
internal Engine(IBootstrapperEngine engine)
1818
{
@@ -24,8 +24,7 @@ public int PackageCount
2424
{
2525
get
2626
{
27-
int count;
28-
this.engine.GetPackageCount(out count);
27+
this.engine.GetPackageCount(out var count);
2928

3029
return count;
3130
}
@@ -110,8 +109,7 @@ public string EscapeString(string input)
110109
/// <inheritdoc/>
111110
public bool EvaluateCondition(string condition)
112111
{
113-
bool value;
114-
this.engine.EvaluateCondition(condition, out value);
112+
this.engine.EvaluateCondition(condition, out var value);
115113

116114
return value;
117115
}
@@ -247,9 +245,9 @@ public void Log(LogLevel level, string message)
247245
}
248246

249247
/// <inheritdoc/>
250-
public void Plan(LaunchAction action)
248+
public void Plan(LaunchAction action, BundleScope plannedScope)
251249
{
252-
this.engine.Plan(action);
250+
this.engine.Plan(action, plannedScope);
253251
}
254252

255253
/// <inheritdoc/>
@@ -327,16 +325,16 @@ public void SetVariableVersion(string name, string value)
327325
/// <inheritdoc/>
328326
public int SendEmbeddedError(int errorCode, string message, int uiHint)
329327
{
330-
int result = 0;
331-
this.engine.SendEmbeddedError(errorCode, message, uiHint, out result);
328+
this.engine.SendEmbeddedError(errorCode, message, uiHint, out var result);
329+
332330
return result;
333331
}
334332

335333
/// <inheritdoc/>
336334
public int SendEmbeddedProgress(int progressPercentage, int overallPercentage)
337335
{
338-
int result = 0;
339-
this.engine.SendEmbeddedProgress(progressPercentage, overallPercentage, out result);
336+
this.engine.SendEmbeddedProgress(progressPercentage, overallPercentage, out var result);
337+
340338
return result;
341339
}
342340

src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperCommand.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ public interface IBootstrapperCommand
1919
/// </summary>
2020
Display Display { get; }
2121

22+
/// <summary>
23+
/// Gets the bundle scope if set at the command line.
24+
/// </summary>
25+
BundleScope Scope { get; }
26+
2227
/// <summary>
2328
/// Gets the command line arguments.
2429
/// </summary>

src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperEngine.cs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,11 @@ IntPtr hwndParent
178178
);
179179

180180
/// <summary>
181-
/// See <see cref="IEngine.Plan(LaunchAction)"/>.
181+
/// See <see cref="IEngine.Plan(LaunchAction, BundleScope)"/>.
182182
/// </summary>
183183
void Plan(
184-
[MarshalAs(UnmanagedType.U4)] LaunchAction action
184+
[MarshalAs(UnmanagedType.U4)] LaunchAction action,
185+
[MarshalAs(UnmanagedType.U4)] BundleScope plannedScope
185186
);
186187

187188
/// <summary>
@@ -343,6 +344,28 @@ public enum LaunchAction
343344
UpdateReplaceEmbedded,
344345
}
345346

347+
/// <summary>
348+
/// The scope of the bundle when the chain contains per-user-or-machine or per-machone-or-user packages.
349+
/// </summary>
350+
public enum BundleScope
351+
{
352+
/// <summary>
353+
/// Let Burn choose the scope. Per-user-or-machine packages will be
354+
/// planned as per-machine packages.
355+
/// </summary>
356+
Default,
357+
358+
/// <summary>
359+
/// Set per-machine scope for per-user-or-machine packages.
360+
/// </summary>
361+
PerMachine,
362+
363+
/// <summary>
364+
/// Set per-user scope for per-user-or-machine packages.
365+
/// </summary>
366+
PerUser,
367+
}
368+
346369
/// <summary>
347370
/// The message log level.
348371
/// </summary>

src/api/burn/WixToolset.BootstrapperApplicationApi/IEngine.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ public interface IEngine
139139
/// Determine the installation sequencing and costing.
140140
/// </summary>
141141
/// <param name="action">The action to perform when planning.</param>
142-
void Plan(LaunchAction action);
142+
/// <param name="plannedScope">The bundle scope for per-user-or-machine packages.</param>
143+
void Plan(LaunchAction action, BundleScope plannedScope);
143144

144145
/// <summary>
145146
/// Set the update information for a bundle.

src/api/burn/balutil/BalBootstrapperEngine.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,8 @@ class CBalBootstrapperEngine : public IBootstrapperEngine
11881188
}
11891189

11901190
virtual STDMETHODIMP Plan(
1191-
__in BOOTSTRAPPER_ACTION action
1191+
__in BOOTSTRAPPER_ACTION action,
1192+
__in BOOTSTRAPPER_SCOPE plannedScope
11921193
)
11931194
{
11941195
HRESULT hr = S_OK;
@@ -1199,17 +1200,21 @@ class CBalBootstrapperEngine : public IBootstrapperEngine
11991200
PIPE_RPC_RESULT rpc = { };
12001201

12011202
// Init send structs.
1202-
args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
1203+
args.dwApiVersion = WIX_7_BOOTSTRAPPER_APPLICATION_API_VERSION;
12031204
args.action = action;
1205+
args.plannedScope = plannedScope;
12041206

1205-
results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
1207+
results.dwApiVersion = WIX_7_BOOTSTRAPPER_APPLICATION_API_VERSION;
12061208

12071209
// Send args.
12081210
hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion);
12091211
ExitOnFailure(hr, "Failed to write API version of Plan args.");
12101212

12111213
hr = BuffWriteNumberToBuffer(&bufferArgs, static_cast<DWORD>(args.action));
1212-
ExitOnFailure(hr, "Failed to write parent window of Plan args.");
1214+
ExitOnFailure(hr, "Failed to write action of Plan args.");
1215+
1216+
hr = BuffWriteNumberToBuffer(&bufferArgs, static_cast<DWORD>(args.plannedScope));
1217+
ExitOnFailure(hr, "Failed to write planned scope of Plan args.");
12131218

12141219
// Send results.
12151220
hr = BuffWriteNumberToBuffer(&bufferResults, results.dwApiVersion);

src/api/burn/balutil/inc/BootstrapperApplicationBase.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class CBootstrapperApplicationBase : public IBootstrapperApplication
1616
public: // IUnknown
1717
virtual STDMETHODIMP QueryInterface(
1818
__in REFIID riid,
19-
__out LPVOID *ppvObject
19+
__out LPVOID* ppvObject
2020
)
2121
{
2222
if (!ppvObject)
@@ -478,12 +478,14 @@ class CBootstrapperApplicationBase : public IBootstrapperApplication
478478
__in DWORD dwCode,
479479
__in_z LPCWSTR wzError,
480480
__in DWORD dwUIHint,
481-
__in DWORD /*cData*/,
481+
__in DWORD cData,
482482
__in_ecount_z_opt(cData) LPCWSTR* /*rgwzData*/,
483483
__in int /*nRecommendation*/,
484484
__inout int* pResult
485485
)
486486
{
487+
UNREFERENCED_PARAMETER(cData);
488+
487489
BalRetryErrorOccurred(wzPackageId, dwCode);
488490

489491
if (BOOTSTRAPPER_DISPLAY_EMBEDDED == m_commandDisplay)
@@ -781,12 +783,14 @@ class CBootstrapperApplicationBase : public IBootstrapperApplication
781783
__in INSTALLMESSAGE /*messageType*/,
782784
__in DWORD /*dwUIHint*/,
783785
__in_z LPCWSTR /*wzMessage*/,
784-
__in DWORD /*cData*/,
786+
__in DWORD cData,
785787
__in_ecount_z_opt(cData) LPCWSTR* /*rgwzData*/,
786788
__in int /*nRecommendation*/,
787789
__inout int* pResult
788790
)
789791
{
792+
UNREFERENCED_PARAMETER(cData);
793+
790794
if (CheckCanceled())
791795
{
792796
*pResult = IDCANCEL;
@@ -797,13 +801,15 @@ class CBootstrapperApplicationBase : public IBootstrapperApplication
797801

798802
virtual STDMETHODIMP OnExecuteFilesInUse(
799803
__in_z LPCWSTR /*wzPackageId*/,
800-
__in DWORD /*cFiles*/,
804+
__in DWORD cFiles,
801805
__in_ecount_z(cFiles) LPCWSTR* /*rgwzFiles*/,
802806
__in int /*nRecommendation*/,
803807
__in BOOTSTRAPPER_FILES_IN_USE_TYPE /*source*/,
804808
__inout int* pResult
805809
)
806810
{
811+
UNREFERENCED_PARAMETER(cFiles);
812+
807813
if (CheckCanceled())
808814
{
809815
*pResult = IDCANCEL;

src/api/burn/balutil/inc/IBootstrapperEngine.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ DECLARE_INTERFACE_IID_(IBootstrapperEngine, IUnknown, "6480D616-27A0-44D7-905B-8
108108
) = 0;
109109

110110
STDMETHOD(Plan)(
111-
__in BOOTSTRAPPER_ACTION action
111+
__in BOOTSTRAPPER_ACTION action,
112+
__in BOOTSTRAPPER_SCOPE plannedScope
112113
) = 0;
113114

114115
STDMETHOD(Elevate)(

src/api/burn/inc/BootstrapperApplicationTypes.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ extern "C" {
1010
const LPCWSTR BOOTSTRAPPER_APPLICATION_COMMANDLINE_SWITCH_API_VERSION = L"burn.ba.apiver";
1111
const LPCWSTR BOOTSTRAPPER_APPLICATION_COMMANDLINE_SWITCH_PIPE_NAME = L"burn.ba.pipe";
1212
const DWORD WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION = 5;
13+
const DWORD WIX_7_BOOTSTRAPPER_APPLICATION_API_VERSION = 7;
1314

1415
enum BOOTSTRAPPER_DISPLAY
1516
{
@@ -27,6 +28,15 @@ enum BOOTSTRAPPER_REGISTRATION_TYPE
2728
BOOTSTRAPPER_REGISTRATION_TYPE_FULL,
2829
};
2930

31+
enum BOOTSTRAPPER_PACKAGE_SCOPE
32+
{
33+
BOOTSTRAPPER_PACKAGE_SCOPE_INVALID,
34+
BOOTSTRAPPER_PACKAGE_SCOPE_PER_MACHINE,
35+
BOOTSTRAPPER_PACKAGE_SCOPE_PER_MACHINE_OR_PER_USER,
36+
BOOTSTRAPPER_PACKAGE_SCOPE_PER_USER_OR_PER_MACHINE,
37+
BOOTSTRAPPER_PACKAGE_SCOPE_PER_USER,
38+
};
39+
3040
enum BOOTSTRAPPER_RESUME_TYPE
3141
{
3242
BOOTSTRAPPER_RESUME_TYPE_NONE,
@@ -353,6 +363,7 @@ struct BOOTSTRAPPER_COMMAND
353363
DWORD cbSize;
354364
BOOTSTRAPPER_ACTION action;
355365
BOOTSTRAPPER_DISPLAY display;
366+
BOOTSTRAPPER_SCOPE commandLineScope;
356367

357368
LPWSTR wzCommandLine;
358369
INT32 nCmdShow;

src/api/burn/inc/BootstrapperEngineTypes.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ enum BOOTSTRAPPER_ACTION
3030
BOOTSTRAPPER_ACTION_UPDATE_REPLACE_EMBEDDED,
3131
};
3232

33+
enum BOOTSTRAPPER_SCOPE
34+
{
35+
BOOTSTRAPPER_SCOPE_DEFAULT,
36+
BOOTSTRAPPER_SCOPE_PER_MACHINE,
37+
BOOTSTRAPPER_SCOPE_PER_USER,
38+
};
39+
3340
enum BOOTSTRAPPER_ACTION_STATE
3441
{
3542
BOOTSTRAPPER_ACTION_STATE_NONE,
@@ -183,7 +190,7 @@ typedef struct _BAENGINE_ESCAPESTRING_RESULTS
183190
{
184191
DWORD dwApiVersion;
185192
LPWSTR wzOut;
186-
// Should be initialized to the size of wzOut.
193+
// Should be initialized to the count of wzOut.
187194
DWORD cchOut;
188195
} BAENGINE_ESCAPESTRING_RESULTS;
189196

@@ -306,6 +313,7 @@ typedef struct _BAENGINE_PLAN_ARGS
306313
{
307314
DWORD dwApiVersion;
308315
BOOTSTRAPPER_ACTION action;
316+
BOOTSTRAPPER_SCOPE plannedScope;
309317
} BAENGINE_PLAN_ARGS;
310318

311319
typedef struct _BAENGINE_PLAN_RESULTS

0 commit comments

Comments
 (0)