Skip to content

Commit

Permalink
Rename "bundle id" concept to "bundle code"
Browse files Browse the repository at this point in the history
The "bundle id" always had more in common with the PackageCode from the Windows
Installer. With the introduction of an actual Id attribute on the Bundle
element, there is potential for confusion, so there is finally real motivation
to rename "bundle id" to "bundle code".
  • Loading branch information
robmen committed Dec 30, 2024
1 parent 6edc5d1 commit 523c66a
Show file tree
Hide file tree
Showing 125 changed files with 2,452 additions and 2,302 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ref StrUtil.StrHandle psczOut
[DllImport("mbanative.dll", ExactSpelling = true)]
internal static extern int BalGetRelatedBundleVariableFromEngine(
[MarshalAs(UnmanagedType.Interface)] IBootstrapperEngine pEngine,
[MarshalAs(UnmanagedType.LPWStr)] string wzBundleId,
[MarshalAs(UnmanagedType.LPWStr)] string wzBundleCode,
[MarshalAs(UnmanagedType.LPWStr)] string wzVariable,
ref StrUtil.StrHandle psczOut
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1449,9 +1449,9 @@ int IBootstrapperApplication.OnDetectBegin(bool fCached, RegistrationType regist
return args.HResult;
}

int IBootstrapperApplication.OnDetectForwardCompatibleBundle(string wzBundleId, RelationType relationType, string wzBundleTag, bool fPerMachine, string wzVersion, bool fMissingFromCache, ref bool fCancel)
int IBootstrapperApplication.OnDetectForwardCompatibleBundle(string wzBundleCode, RelationType relationType, string wzBundleTag, bool fPerMachine, string wzVersion, bool fMissingFromCache, ref bool fCancel)
{
DetectForwardCompatibleBundleEventArgs args = new DetectForwardCompatibleBundleEventArgs(wzBundleId, relationType, wzBundleTag, fPerMachine, wzVersion, fMissingFromCache, fCancel);
DetectForwardCompatibleBundleEventArgs args = new DetectForwardCompatibleBundleEventArgs(wzBundleCode, relationType, wzBundleTag, fPerMachine, wzVersion, fMissingFromCache, fCancel);
this.OnDetectForwardCompatibleBundle(args);

fCancel = args.Cancel;
Expand Down Expand Up @@ -1566,19 +1566,19 @@ int IBootstrapperApplication.OnPlanBegin(int cPackages, ref bool fCancel)
return args.HResult;
}

int IBootstrapperApplication.OnPlanRelatedBundle(string wzBundleId, RequestState recommendedState, ref RequestState pRequestedState, ref bool fCancel)
int IBootstrapperApplication.OnPlanRelatedBundle(string wzBundleCode, RequestState recommendedState, ref RequestState pRequestedState, ref bool fCancel)
{
PlanRelatedBundleEventArgs args = new PlanRelatedBundleEventArgs(wzBundleId, recommendedState, pRequestedState, fCancel);
PlanRelatedBundleEventArgs args = new PlanRelatedBundleEventArgs(wzBundleCode, recommendedState, pRequestedState, fCancel);
this.OnPlanRelatedBundle(args);

pRequestedState = args.State;
fCancel = args.Cancel;
return args.HResult;
}

int IBootstrapperApplication.OnPlanRelatedBundleType(string wzBundleId, RelatedBundlePlanType recommendedType, ref RelatedBundlePlanType pRequestedType, ref bool fCancel)
int IBootstrapperApplication.OnPlanRelatedBundleType(string wzBundleCode, RelatedBundlePlanType recommendedType, ref RelatedBundlePlanType pRequestedType, ref bool fCancel)
{
PlanRelatedBundleTypeEventArgs args = new PlanRelatedBundleTypeEventArgs(wzBundleId, recommendedType, pRequestedType, fCancel);
PlanRelatedBundleTypeEventArgs args = new PlanRelatedBundleTypeEventArgs(wzBundleCode, recommendedType, pRequestedType, fCancel);
this.OnPlanRelatedBundleType(args);

pRequestedType = args.Type;
Expand Down Expand Up @@ -2060,9 +2060,9 @@ int IBootstrapperApplication.OnSystemRestorePointComplete(int hrStatus)
return args.HResult;
}

int IBootstrapperApplication.OnPlanForwardCompatibleBundle(string wzBundleId, RelationType relationType, string wzBundleTag, bool fPerMachine, string wzVersion, bool fRecommendedIgnoreBundle, ref bool fCancel, ref bool fIgnoreBundle)
int IBootstrapperApplication.OnPlanForwardCompatibleBundle(string wzBundleCode, RelationType relationType, string wzBundleTag, bool fPerMachine, string wzVersion, bool fRecommendedIgnoreBundle, ref bool fCancel, ref bool fIgnoreBundle)
{
PlanForwardCompatibleBundleEventArgs args = new PlanForwardCompatibleBundleEventArgs(wzBundleId, relationType, wzBundleTag, fPerMachine, wzVersion, fRecommendedIgnoreBundle, fCancel, fIgnoreBundle);
PlanForwardCompatibleBundleEventArgs args = new PlanForwardCompatibleBundleEventArgs(wzBundleCode, relationType, wzBundleTag, fPerMachine, wzVersion, fRecommendedIgnoreBundle, fCancel, fIgnoreBundle);
this.OnPlanForwardCompatibleBundle(args);

fCancel = args.Cancel;
Expand Down Expand Up @@ -2122,9 +2122,9 @@ int IBootstrapperApplication.OnCachePayloadExtractComplete(string wzContainerId,
return args.HResult;
}

int IBootstrapperApplication.OnPlanRestoreRelatedBundle(string wzBundleId, RequestState recommendedState, ref RequestState pRequestedState, ref bool fCancel)
int IBootstrapperApplication.OnPlanRestoreRelatedBundle(string wzBundleCode, RequestState recommendedState, ref RequestState pRequestedState, ref bool fCancel)
{
PlanRestoreRelatedBundleEventArgs args = new PlanRestoreRelatedBundleEventArgs(wzBundleId, recommendedState, pRequestedState, fCancel);
PlanRestoreRelatedBundleEventArgs args = new PlanRestoreRelatedBundleEventArgs(wzBundleCode, recommendedState, pRequestedState, fCancel);
this.OnPlanRestoreRelatedBundle(args);

pRequestedState = args.State;
Expand Down
4 changes: 2 additions & 2 deletions src/api/burn/WixToolset.BootstrapperApplicationApi/Engine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,12 @@ public string GetVariableVersion(string name)
}

/// <inheritdoc/>
public string GetRelatedBundleVariable(string bundleId, string name)
public string GetRelatedBundleVariable(string bundleCode, string name)
{
StrUtil.StrHandle handle = new StrUtil.StrHandle();
try
{
int ret = BalUtil.BalGetRelatedBundleVariableFromEngine(this.engine, bundleId, name, ref handle);
int ret = BalUtil.BalGetRelatedBundleVariableFromEngine(this.engine, bundleCode, name, ref handle);
if (ret != NativeMethods.S_OK)
{
throw new Win32Exception(ret);
Expand Down
50 changes: 35 additions & 15 deletions src/api/burn/WixToolset.BootstrapperApplicationApi/EventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,10 @@ public class DetectForwardCompatibleBundleEventArgs : CancellableHResultEventArg
/// This class is for events raised by the engine.
/// It is not intended to be instantiated by user code.
/// </summary>
public DetectForwardCompatibleBundleEventArgs(string bundleId, RelationType relationType, string bundleTag, bool perMachine, string version, bool missingFromCache, bool cancelRecommendation)
public DetectForwardCompatibleBundleEventArgs(string bundleCode, RelationType relationType, string bundleTag, bool perMachine, string version, bool missingFromCache, bool cancelRecommendation)
: base(cancelRecommendation)
{
this.BundleId = bundleId;
this.BundleCode = bundleCode;
this.RelationType = relationType;
this.BundleTag = bundleTag;
this.PerMachine = perMachine;
Expand All @@ -339,7 +339,11 @@ public DetectForwardCompatibleBundleEventArgs(string bundleId, RelationType rela
/// <summary>
/// Gets the identity of the forward compatible bundle detected.
/// </summary>
public string BundleId { get; private set; }
public string BundleCode { get; private set; }

/// <inheritdoc cref="BundleCode" />
[Obsolete("Use BundleCode instead.")]
public string BundleId => this.BundleCode;

/// <summary>
/// Gets the relationship type of the forward compatible bundle.
Expand Down Expand Up @@ -807,18 +811,22 @@ public class PlanRelatedBundleEventArgs : CancellableHResultEventArgs
/// This class is for events raised by the engine.
/// It is not intended to be instantiated by user code.
/// </summary>
public PlanRelatedBundleEventArgs(string bundleId, RequestState recommendedState, RequestState state, bool cancelRecommendation)
public PlanRelatedBundleEventArgs(string bundleCode, RequestState recommendedState, RequestState state, bool cancelRecommendation)
: base(cancelRecommendation)
{
this.BundleId = bundleId;
this.BundleCode = bundleCode;
this.RecommendedState = recommendedState;
this.State = state;
}

/// <summary>
/// Gets the identity of the bundle to plan for.
/// </summary>
public string BundleId { get; private set; }
public string BundleCode { get; private set; }

/// <inheritdoc cref="BundleCode" />
[Obsolete("Use BundleCode instead.")]
public string BundleId => this.BundleCode;

/// <summary>
/// Gets the recommended requested state for the bundle.
Expand All @@ -841,18 +849,22 @@ public class PlanRelatedBundleTypeEventArgs : CancellableHResultEventArgs
/// This class is for events raised by the engine.
/// It is not intended to be instantiated by user code.
/// </summary>
public PlanRelatedBundleTypeEventArgs(string bundleId, RelatedBundlePlanType recommendedType, RelatedBundlePlanType type, bool cancelRecommendation)
public PlanRelatedBundleTypeEventArgs(string bundleCode, RelatedBundlePlanType recommendedType, RelatedBundlePlanType type, bool cancelRecommendation)
: base(cancelRecommendation)
{
this.BundleId = bundleId;
this.BundleCode = bundleCode;
this.RecommendedType = recommendedType;
this.Type = type;
}

/// <summary>
/// Gets the identity of the bundle to plan for.
/// </summary>
public string BundleId { get; private set; }
public string BundleCode { get; private set; }

/// <inheritdoc cref="BundleCode" />
[Obsolete("Use BundleCode instead.")]
public string BundleId => this.BundleCode;

/// <summary>
/// Gets the recommended plan type for the bundle.
Expand Down Expand Up @@ -1327,10 +1339,10 @@ public class PlanForwardCompatibleBundleEventArgs : CancellableHResultEventArgs
/// This class is for events raised by the engine.
/// It is not intended to be instantiated by user code.
/// </summary>
public PlanForwardCompatibleBundleEventArgs(string bundleId, RelationType relationType, string bundleTag, bool perMachine, string version, bool recommendedIgnoreBundle, bool cancelRecommendation, bool ignoreBundle)
public PlanForwardCompatibleBundleEventArgs(string bundleCode, RelationType relationType, string bundleTag, bool perMachine, string version, bool recommendedIgnoreBundle, bool cancelRecommendation, bool ignoreBundle)
: base(cancelRecommendation)
{
this.BundleId = bundleId;
this.BundleCode = bundleCode;
this.RelationType = relationType;
this.BundleTag = bundleTag;
this.PerMachine = perMachine;
Expand All @@ -1342,7 +1354,11 @@ public PlanForwardCompatibleBundleEventArgs(string bundleId, RelationType relati
/// <summary>
/// Gets the identity of the forward compatible bundle detected.
/// </summary>
public string BundleId { get; private set; }
public string BundleCode { get; private set; }

/// <inheritdoc cref="BundleCode" />
[Obsolete("Use BundleCode instead.")]
public string BundleId => this.BundleCode;

/// <summary>
/// Gets the relationship type of the forward compatible bundle.
Expand Down Expand Up @@ -2624,18 +2640,22 @@ public class PlanRestoreRelatedBundleEventArgs : CancellableHResultEventArgs
/// This class is for events raised by the engine.
/// It is not intended to be instantiated by user code.
/// </summary>
public PlanRestoreRelatedBundleEventArgs(string bundleId, RequestState recommendedState, RequestState state, bool cancelRecommendation)
public PlanRestoreRelatedBundleEventArgs(string bundleCode, RequestState recommendedState, RequestState state, bool cancelRecommendation)
: base(cancelRecommendation)
{
this.BundleId = bundleId;
this.BundleCode = bundleCode;
this.RecommendedState = recommendedState;
this.State = state;
}

/// <summary>
/// Gets the identity of the bundle to plan for.
/// </summary>
public string BundleId { get; private set; }
public string BundleCode { get; private set; }

/// <inheritdoc cref="BundleCode" />
[Obsolete("Use BundleCode instead.")]
public string BundleId => this.BundleCode;

/// <summary>
/// Gets the recommended requested state for the bundle.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ int OnDetectBegin(
[PreserveSig]
[return: MarshalAs(UnmanagedType.I4)]
int OnDetectForwardCompatibleBundle(
[MarshalAs(UnmanagedType.LPWStr)] string wzBundleId,
[MarshalAs(UnmanagedType.LPWStr)] string wzBundleCode,
[MarshalAs(UnmanagedType.U4)] RelationType relationType,
[MarshalAs(UnmanagedType.LPWStr)] string wzBundleTag,
[MarshalAs(UnmanagedType.Bool)] bool fPerMachine,
Expand Down Expand Up @@ -135,7 +135,7 @@ int OnDetectUpdateComplete(
[PreserveSig]
[return: MarshalAs(UnmanagedType.I4)]
int OnDetectRelatedBundle(
[MarshalAs(UnmanagedType.LPWStr)] string wzBundleId,
[MarshalAs(UnmanagedType.LPWStr)] string wzBundleCode,
[MarshalAs(UnmanagedType.U4)] RelationType relationType,
[MarshalAs(UnmanagedType.LPWStr)] string wzBundleTag,
[MarshalAs(UnmanagedType.Bool)] bool fPerMachine,
Expand Down Expand Up @@ -243,7 +243,7 @@ int OnPlanBegin(
[PreserveSig]
[return: MarshalAs(UnmanagedType.I4)]
int OnPlanRelatedBundle(
[MarshalAs(UnmanagedType.LPWStr)] string wzBundleId,
[MarshalAs(UnmanagedType.LPWStr)] string wzBundleCode,
[MarshalAs(UnmanagedType.U4)] RequestState recommendedState,
[MarshalAs(UnmanagedType.U4)] ref RequestState pRequestedState,
[MarshalAs(UnmanagedType.Bool)] ref bool fCancel
Expand Down Expand Up @@ -869,7 +869,7 @@ int hrStatus
[PreserveSig]
[return: MarshalAs(UnmanagedType.I4)]
int OnPlanForwardCompatibleBundle(
[MarshalAs(UnmanagedType.LPWStr)] string wzBundleId,
[MarshalAs(UnmanagedType.LPWStr)] string wzBundleCode,
[MarshalAs(UnmanagedType.U4)] RelationType relationType,
[MarshalAs(UnmanagedType.LPWStr)] string wzBundleTag,
[MarshalAs(UnmanagedType.Bool)] bool fPerMachine,
Expand Down Expand Up @@ -957,7 +957,7 @@ int hrStatus
[PreserveSig]
[return: MarshalAs(UnmanagedType.I4)]
int OnPlanRestoreRelatedBundle(
[MarshalAs(UnmanagedType.LPWStr)] string wzBundleId,
[MarshalAs(UnmanagedType.LPWStr)] string wzBundleCode,
[MarshalAs(UnmanagedType.U4)] RequestState recommendedState,
[MarshalAs(UnmanagedType.U4)] ref RequestState pRequestedState,
[MarshalAs(UnmanagedType.Bool)] ref bool fCancel
Expand All @@ -969,7 +969,7 @@ int OnPlanRestoreRelatedBundle(
[PreserveSig]
[return: MarshalAs(UnmanagedType.I4)]
int OnPlanRelatedBundleType(
[MarshalAs(UnmanagedType.LPWStr)] string wzBundleId,
[MarshalAs(UnmanagedType.LPWStr)] string wzBundleCode,
[MarshalAs(UnmanagedType.U4)] RelatedBundlePlanType recommendedType,
[MarshalAs(UnmanagedType.U4)] ref RelatedBundlePlanType pRequestedType,
[MarshalAs(UnmanagedType.Bool)] ref bool fCancel
Expand Down Expand Up @@ -1004,7 +1004,7 @@ int OnExecuteProcessCancel(
[return: MarshalAs(UnmanagedType.I4)]
int OnDetectRelatedBundlePackage(
[MarshalAs(UnmanagedType.LPWStr)] string wzPackageId,
[MarshalAs(UnmanagedType.LPWStr)] string wzBundleId,
[MarshalAs(UnmanagedType.LPWStr)] string wzBundleCode,
[MarshalAs(UnmanagedType.U4)] RelationType relationType,
[MarshalAs(UnmanagedType.Bool)] bool fPerMachine,
[MarshalAs(UnmanagedType.LPWStr)] string wzVersion,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ void CompareVersions(
/// </summary>
[PreserveSig]
int GetRelatedBundleVariable(
[MarshalAs(UnmanagedType.LPWStr)] string wzBundleId,
[MarshalAs(UnmanagedType.LPWStr)] string wzBundleCode,
[MarshalAs(UnmanagedType.LPWStr)] string wzVariable,
IntPtr wzValue,
ref IntPtr pcchValue
Expand Down
4 changes: 2 additions & 2 deletions src/api/burn/WixToolset.BootstrapperApplicationApi/IEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ public interface IEngine
/// <summary>
/// Gets persisted variables from a related bundle.
/// </summary>
/// <param name="bundleId">The BundleId of the related bundle.</param>
/// <param name="bundleCode">The bundle code of the related bundle.</param>
/// <param name="name">The name of the variable.</param>
string GetRelatedBundleVariable(string bundleId, string name);
string GetRelatedBundleVariable(string bundleCode, string name);

/// <summary>
/// Launches a preapproved executable elevated. As long as the engine already elevated, there will be no UAC prompt.
Expand Down
8 changes: 4 additions & 4 deletions src/api/burn/balutil/BalBootstrapperEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ class CBalBootstrapperEngine : public IBootstrapperEngine
}

virtual STDMETHODIMP GetRelatedBundleVariable(
__in_z LPCWSTR wzBundleId,
__in_z LPCWSTR wzBundleCode,
__in_z LPCWSTR wzVariable,
__out_ecount_opt(*pcchValue) LPWSTR wzValue,
__inout SIZE_T* pcchValue
Expand All @@ -338,7 +338,7 @@ class CBalBootstrapperEngine : public IBootstrapperEngine

// Init send structs.
args.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
args.wzBundleId = wzBundleId;
args.wzBundleCode = wzBundleCode;
args.wzVariable = wzVariable;

results.dwApiVersion = WIX_5_BOOTSTRAPPER_APPLICATION_API_VERSION;
Expand All @@ -349,8 +349,8 @@ class CBalBootstrapperEngine : public IBootstrapperEngine
hr = BuffWriteNumberToBuffer(&bufferArgs, args.dwApiVersion);
ExitOnFailure(hr, "Failed to write API version of GetRelatedBundleVariable args.");

hr = BuffWriteStringToBuffer(&bufferArgs, args.wzBundleId);
ExitOnFailure(hr, "Failed to write bundle id of GetRelatedBundleVariable args.");
hr = BuffWriteStringToBuffer(&bufferArgs, args.wzBundleCode);
ExitOnFailure(hr, "Failed to write bundle code of GetRelatedBundleVariable args.");

hr = BuffWriteStringToBuffer(&bufferArgs, args.wzVariable);
ExitOnFailure(hr, "Failed to write variable name of GetRelatedBundleVariable args.");
Expand Down
10 changes: 5 additions & 5 deletions src/api/burn/balutil/balutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ DAPI_(HRESULT) BalGetVersionVariableFromEngine(
}

DAPI_(HRESULT) BalGetRelatedBundleVariable(
__in_z LPCWSTR wzBundleId,
__in_z LPCWSTR wzBundleCode,
__in_z LPCWSTR wzVariable,
__inout LPWSTR* psczValue
)
Expand All @@ -564,15 +564,15 @@ DAPI_(HRESULT) BalGetRelatedBundleVariable(
ExitOnRootFailure(hr, "BalInitialize() must be called first.");
}

hr = BalGetRelatedBundleVariableFromEngine(vpEngine, wzBundleId, wzVariable, psczValue);
hr = BalGetRelatedBundleVariableFromEngine(vpEngine, wzBundleCode, wzVariable, psczValue);

LExit:
return hr;
}

DAPI_(HRESULT) BalGetRelatedBundleVariableFromEngine(
__in IBootstrapperEngine* pEngine,
__in_z LPCWSTR wzBundleId,
__in_z LPCWSTR wzBundleCode,
__in_z LPCWSTR wzVariable,
__inout LPWSTR* psczValue
)
Expand All @@ -586,15 +586,15 @@ DAPI_(HRESULT) BalGetRelatedBundleVariableFromEngine(
ExitOnFailure(hr, "Failed to determine length of value.");
}

hr = pEngine->GetRelatedBundleVariable(wzBundleId, wzVariable, *psczValue, &cch);
hr = pEngine->GetRelatedBundleVariable(wzBundleCode, wzVariable, *psczValue, &cch);
if (E_MOREDATA == hr)
{
++cch;

hr = StrAllocSecure(psczValue, cch);
ExitOnFailure(hr, "Failed to allocate value.");

hr = pEngine->GetRelatedBundleVariable(wzBundleId, wzVariable, *psczValue, &cch);
hr = pEngine->GetRelatedBundleVariable(wzBundleCode, wzVariable, *psczValue, &cch);
}

LExit:
Expand Down
Loading

0 comments on commit 523c66a

Please sign in to comment.