diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2020-05-15 13:48:38 +1000 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2020-05-16 21:47:46 +1000 |
| commit | 780cd25e41f2d2982807a0a2a24a734684d27fe6 (patch) | |
| tree | eaf7322f1cb79f337f764d778d518f9fa2b2e175 /src/WixToolset.Mba.Core | |
| parent | b0b50f1d8512b6d7ebd087d19406629db0a5ef9b (diff) | |
| download | wix-780cd25e41f2d2982807a0a2a24a734684d27fe6.tar.gz wix-780cd25e41f2d2982807a0a2a24a734684d27fe6.tar.bz2 wix-780cd25e41f2d2982807a0a2a24a734684d27fe6.zip | |
WIXFEAT:6164 Add OnPlanMsiPackage.
Diffstat (limited to 'src/WixToolset.Mba.Core')
| -rw-r--r-- | src/WixToolset.Mba.Core/BootstrapperApplication.cs | 34 | ||||
| -rw-r--r-- | src/WixToolset.Mba.Core/EventArgs.cs | 74 | ||||
| -rw-r--r-- | src/WixToolset.Mba.Core/IBootstrapperApplication.cs | 109 |
3 files changed, 214 insertions, 3 deletions
diff --git a/src/WixToolset.Mba.Core/BootstrapperApplication.cs b/src/WixToolset.Mba.Core/BootstrapperApplication.cs index 249c17c9..9ee909dc 100644 --- a/src/WixToolset.Mba.Core/BootstrapperApplication.cs +++ b/src/WixToolset.Mba.Core/BootstrapperApplication.cs | |||
| @@ -162,6 +162,11 @@ namespace WixToolset.Mba.Core | |||
| 162 | public event EventHandler<PlanMsiFeatureEventArgs> PlanMsiFeature; | 162 | public event EventHandler<PlanMsiFeatureEventArgs> PlanMsiFeature; |
| 163 | 163 | ||
| 164 | /// <summary> | 164 | /// <summary> |
| 165 | /// Fired when the engine is planning an MSI or MSP package. | ||
| 166 | /// </summary> | ||
| 167 | public event EventHandler<PlanMsiPackageEventArgs> PlanMsiPackage; | ||
| 168 | |||
| 169 | /// <summary> | ||
| 165 | /// Fired when the engine has completed planning the installation of a specific package. | 170 | /// Fired when the engine has completed planning the installation of a specific package. |
| 166 | /// </summary> | 171 | /// </summary> |
| 167 | public event EventHandler<PlanPackageCompleteEventArgs> PlanPackageComplete; | 172 | public event EventHandler<PlanPackageCompleteEventArgs> PlanPackageComplete; |
| @@ -659,6 +664,19 @@ namespace WixToolset.Mba.Core | |||
| 659 | } | 664 | } |
| 660 | 665 | ||
| 661 | /// <summary> | 666 | /// <summary> |
| 667 | /// Called when the engine is planning an MSI or MSP package. | ||
| 668 | /// </summary> | ||
| 669 | /// <param name="args">Additional arguments for this event.</param> | ||
| 670 | protected virtual void OnPlanMsiPackage(PlanMsiPackageEventArgs args) | ||
| 671 | { | ||
| 672 | EventHandler<PlanMsiPackageEventArgs> handler = this.PlanMsiPackage; | ||
| 673 | if (null != handler) | ||
| 674 | { | ||
| 675 | handler(this, args); | ||
| 676 | } | ||
| 677 | } | ||
| 678 | |||
| 679 | /// <summary> | ||
| 662 | /// Called when then engine has completed planning the installation of a specific package. | 680 | /// Called when then engine has completed planning the installation of a specific package. |
| 663 | /// </summary> | 681 | /// </summary> |
| 664 | /// <param name="args">Additional arguments for this event.</param> | 682 | /// <param name="args">Additional arguments for this event.</param> |
| @@ -1288,6 +1306,18 @@ namespace WixToolset.Mba.Core | |||
| 1288 | return args.HResult; | 1306 | return args.HResult; |
| 1289 | } | 1307 | } |
| 1290 | 1308 | ||
| 1309 | int IBootstrapperApplication.OnPlanMsiPackage(string wzPackageId, bool fExecute, ActionState action, ref bool fCancel, ref BURN_MSI_PROPERTY actionMsiProperty, ref INSTALLUILEVEL uiLevel, ref bool fDisableExternalUiHandler) | ||
| 1310 | { | ||
| 1311 | PlanMsiPackageEventArgs args = new PlanMsiPackageEventArgs(wzPackageId, fExecute, action, fCancel, actionMsiProperty, uiLevel, fDisableExternalUiHandler); | ||
| 1312 | this.OnPlanMsiPackage(args); | ||
| 1313 | |||
| 1314 | fCancel = args.Cancel; | ||
| 1315 | actionMsiProperty = args.ActionMsiProperty; | ||
| 1316 | uiLevel = args.UiLevel; | ||
| 1317 | fDisableExternalUiHandler = args.DisableExternalUiHandler; | ||
| 1318 | return args.HResult; | ||
| 1319 | } | ||
| 1320 | |||
| 1291 | int IBootstrapperApplication.OnPlanPackageComplete(string wzPackageId, int hrStatus, PackageState state, RequestState requested, ActionState execute, ActionState rollback) | 1321 | int IBootstrapperApplication.OnPlanPackageComplete(string wzPackageId, int hrStatus, PackageState state, RequestState requested, ActionState execute, ActionState rollback) |
| 1292 | { | 1322 | { |
| 1293 | var args = new PlanPackageCompleteEventArgs(wzPackageId, hrStatus, state, requested, execute, rollback); | 1323 | var args = new PlanPackageCompleteEventArgs(wzPackageId, hrStatus, state, requested, execute, rollback); |
| @@ -1466,9 +1496,9 @@ namespace WixToolset.Mba.Core | |||
| 1466 | return args.HResult; | 1496 | return args.HResult; |
| 1467 | } | 1497 | } |
| 1468 | 1498 | ||
| 1469 | int IBootstrapperApplication.OnExecutePackageBegin(string wzPackageId, bool fExecute, ActionState action, ref bool fCancel) | 1499 | int IBootstrapperApplication.OnExecutePackageBegin(string wzPackageId, bool fExecute, ActionState action, INSTALLUILEVEL uiLevel, bool fDisableExternalUiHandler, ref bool fCancel) |
| 1470 | { | 1500 | { |
| 1471 | ExecutePackageBeginEventArgs args = new ExecutePackageBeginEventArgs(wzPackageId, fExecute, action, fCancel); | 1501 | ExecutePackageBeginEventArgs args = new ExecutePackageBeginEventArgs(wzPackageId, fExecute, action, uiLevel, fDisableExternalUiHandler, fCancel); |
| 1472 | this.OnExecutePackageBegin(args); | 1502 | this.OnExecutePackageBegin(args); |
| 1473 | 1503 | ||
| 1474 | fCancel = args.Cancel; | 1504 | fCancel = args.Cancel; |
diff --git a/src/WixToolset.Mba.Core/EventArgs.cs b/src/WixToolset.Mba.Core/EventArgs.cs index ca0fa173..e739a853 100644 --- a/src/WixToolset.Mba.Core/EventArgs.cs +++ b/src/WixToolset.Mba.Core/EventArgs.cs | |||
| @@ -996,6 +996,64 @@ namespace WixToolset.Mba.Core | |||
| 996 | } | 996 | } |
| 997 | 997 | ||
| 998 | /// <summary> | 998 | /// <summary> |
| 999 | /// Additional arguments used when the engine is planning an MSI or MSP package. | ||
| 1000 | /// </summary> | ||
| 1001 | [Serializable] | ||
| 1002 | public class PlanMsiPackageEventArgs : CancellableHResultEventArgs | ||
| 1003 | { | ||
| 1004 | /// <summary> | ||
| 1005 | /// Creates a new instance of the <see cref="PlanMsiPackageEventArgs"/> class. | ||
| 1006 | /// </summary> | ||
| 1007 | /// <param name="packageId">The identity of the package planned for.</param> | ||
| 1008 | /// <param name="shouldExecute">Whether the package is planned to execute or roll back.</param> | ||
| 1009 | /// <param name="action">The action planned for the package.</param> | ||
| 1010 | /// <param name="cancelRecommendation">The recommendation from the engine.</param> | ||
| 1011 | /// <param name="actionMsiProperty">The requested MSI property to add.</param> | ||
| 1012 | /// <param name="uiLevel">The requested internal UI level.</param> | ||
| 1013 | /// <param name="disableExternalUiHandler">Whether Burn is requested to set up an external UI handler.</param> | ||
| 1014 | public PlanMsiPackageEventArgs(string packageId, bool shouldExecute, ActionState action, bool cancelRecommendation, BURN_MSI_PROPERTY actionMsiProperty, INSTALLUILEVEL uiLevel, bool disableExternalUiHandler) | ||
| 1015 | : base(cancelRecommendation) | ||
| 1016 | { | ||
| 1017 | this.PackageId = packageId; | ||
| 1018 | this.ShouldExecute = shouldExecute; | ||
| 1019 | this.Action = action; | ||
| 1020 | this.ActionMsiProperty = actionMsiProperty; | ||
| 1021 | this.UiLevel = uiLevel; | ||
| 1022 | this.DisableExternalUiHandler = disableExternalUiHandler; | ||
| 1023 | } | ||
| 1024 | |||
| 1025 | /// <summary> | ||
| 1026 | /// Gets identity of the package planned for. | ||
| 1027 | /// </summary> | ||
| 1028 | public string PackageId { get; private set; } | ||
| 1029 | |||
| 1030 | /// <summary> | ||
| 1031 | /// Gets whether the package is planned to execute or roll back. | ||
| 1032 | /// </summary> | ||
| 1033 | public bool ShouldExecute { get; private set; } | ||
| 1034 | |||
| 1035 | /// <summary> | ||
| 1036 | /// Gets the action planned for the package. | ||
| 1037 | /// </summary> | ||
| 1038 | public ActionState Action { get; private set; } | ||
| 1039 | |||
| 1040 | /// <summary> | ||
| 1041 | /// Gets or sets the requested MSI property to add. | ||
| 1042 | /// </summary> | ||
| 1043 | public BURN_MSI_PROPERTY ActionMsiProperty { get; set; } | ||
| 1044 | |||
| 1045 | /// <summary> | ||
| 1046 | /// Gets or sets the requested internal UI level. | ||
| 1047 | /// </summary> | ||
| 1048 | public INSTALLUILEVEL UiLevel { get; set; } | ||
| 1049 | |||
| 1050 | /// <summary> | ||
| 1051 | /// Gets or sets whether Burn is requested to set up an external UI handler. | ||
| 1052 | /// </summary> | ||
| 1053 | public bool DisableExternalUiHandler { get; set; } | ||
| 1054 | } | ||
| 1055 | |||
| 1056 | /// <summary> | ||
| 999 | /// Additional arguments used when then engine has completed planning the installation of a specific package. | 1057 | /// Additional arguments used when then engine has completed planning the installation of a specific package. |
| 1000 | /// </summary> | 1058 | /// </summary> |
| 1001 | [Serializable] | 1059 | [Serializable] |
| @@ -1503,13 +1561,17 @@ namespace WixToolset.Mba.Core | |||
| 1503 | /// <param name="packageId">The identity of the package to act on.</param> | 1561 | /// <param name="packageId">The identity of the package to act on.</param> |
| 1504 | /// <param name="shouldExecute">Whether the package is being executed or rolled back.</param> | 1562 | /// <param name="shouldExecute">Whether the package is being executed or rolled back.</param> |
| 1505 | /// <param name="action">The action about to be executed.</param> | 1563 | /// <param name="action">The action about to be executed.</param> |
| 1564 | /// <param name="uiLevel">The internal UI level (if this is an MSI or MSP package).</param> | ||
| 1565 | /// <param name="disableExternalUiHandler">Whether Burn will set up an external UI handler (if this is an MSI or MSP package).</param> | ||
| 1506 | /// <param name="cancelRecommendation">The recommendation from the engine.</param> | 1566 | /// <param name="cancelRecommendation">The recommendation from the engine.</param> |
| 1507 | public ExecutePackageBeginEventArgs(string packageId, bool shouldExecute, ActionState action, bool cancelRecommendation) | 1567 | public ExecutePackageBeginEventArgs(string packageId, bool shouldExecute, ActionState action, INSTALLUILEVEL uiLevel, bool disableExternalUiHandler, bool cancelRecommendation) |
| 1508 | : base(cancelRecommendation) | 1568 | : base(cancelRecommendation) |
| 1509 | { | 1569 | { |
| 1510 | this.PackageId = packageId; | 1570 | this.PackageId = packageId; |
| 1511 | this.ShouldExecute = shouldExecute; | 1571 | this.ShouldExecute = shouldExecute; |
| 1512 | this.Action = action; | 1572 | this.Action = action; |
| 1573 | this.UiLevel = uiLevel; | ||
| 1574 | this.DisableExternalUiHandler = disableExternalUiHandler; | ||
| 1513 | } | 1575 | } |
| 1514 | 1576 | ||
| 1515 | /// <summary> | 1577 | /// <summary> |
| @@ -1526,6 +1588,16 @@ namespace WixToolset.Mba.Core | |||
| 1526 | /// Gets the action about to be executed. | 1588 | /// Gets the action about to be executed. |
| 1527 | /// </summary> | 1589 | /// </summary> |
| 1528 | public ActionState Action { get; private set; } | 1590 | public ActionState Action { get; private set; } |
| 1591 | |||
| 1592 | /// <summary> | ||
| 1593 | /// Gets the internal UI level (if this is an MSI or MSP package). | ||
| 1594 | /// </summary> | ||
| 1595 | public INSTALLUILEVEL UiLevel { get; private set; } | ||
| 1596 | |||
| 1597 | /// <summary> | ||
| 1598 | /// Gets whether Burn will set up an external UI handler (if this is an MSI or MSP package). | ||
| 1599 | /// </summary> | ||
| 1600 | public bool DisableExternalUiHandler { get; private set; } | ||
| 1529 | } | 1601 | } |
| 1530 | 1602 | ||
| 1531 | /// <summary> | 1603 | /// <summary> |
diff --git a/src/WixToolset.Mba.Core/IBootstrapperApplication.cs b/src/WixToolset.Mba.Core/IBootstrapperApplication.cs index c4daaf32..fa655282 100644 --- a/src/WixToolset.Mba.Core/IBootstrapperApplication.cs +++ b/src/WixToolset.Mba.Core/IBootstrapperApplication.cs | |||
| @@ -221,6 +221,18 @@ namespace WixToolset.Mba.Core | |||
| 221 | 221 | ||
| 222 | [PreserveSig] | 222 | [PreserveSig] |
| 223 | [return: MarshalAs(UnmanagedType.I4)] | 223 | [return: MarshalAs(UnmanagedType.I4)] |
| 224 | int OnPlanMsiPackage( | ||
| 225 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | ||
| 226 | [MarshalAs(UnmanagedType.Bool)] bool fExecute, | ||
| 227 | [MarshalAs(UnmanagedType.U4)] ActionState action, | ||
| 228 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel, | ||
| 229 | [MarshalAs(UnmanagedType.U4)] ref BURN_MSI_PROPERTY actionMsiProperty, | ||
| 230 | [MarshalAs(UnmanagedType.U4)] ref INSTALLUILEVEL uiLevel, | ||
| 231 | [MarshalAs(UnmanagedType.Bool)] ref bool fDisableExternalUiHandler | ||
| 232 | ); | ||
| 233 | |||
| 234 | [PreserveSig] | ||
| 235 | [return: MarshalAs(UnmanagedType.I4)] | ||
| 224 | int OnPlanPackageComplete( | 236 | int OnPlanPackageComplete( |
| 225 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | 237 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, |
| 226 | int hrStatus, | 238 | int hrStatus, |
| @@ -393,6 +405,8 @@ namespace WixToolset.Mba.Core | |||
| 393 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | 405 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, |
| 394 | [MarshalAs(UnmanagedType.Bool)] bool fExecute, | 406 | [MarshalAs(UnmanagedType.Bool)] bool fExecute, |
| 395 | [MarshalAs(UnmanagedType.U4)] ActionState action, | 407 | [MarshalAs(UnmanagedType.U4)] ActionState action, |
| 408 | [MarshalAs(UnmanagedType.U4)] INSTALLUILEVEL uiLevel, | ||
| 409 | [MarshalAs(UnmanagedType.Bool)] bool fDisableExternalUiHandler, | ||
| 396 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | 410 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel |
| 397 | ); | 411 | ); |
| 398 | 412 | ||
| @@ -832,4 +846,99 @@ namespace WixToolset.Mba.Core | |||
| 832 | Restart, | 846 | Restart, |
| 833 | ReloadBootstrapper, | 847 | ReloadBootstrapper, |
| 834 | } | 848 | } |
| 849 | |||
| 850 | /// <summary> | ||
| 851 | /// The property Burn will add so the MSI can know the planned action for the package. | ||
| 852 | /// </summary> | ||
| 853 | public enum BURN_MSI_PROPERTY | ||
| 854 | { | ||
| 855 | /// <summary> | ||
| 856 | /// No property will be added. | ||
| 857 | /// </summary> | ||
| 858 | None, | ||
| 859 | |||
| 860 | /// <summary> | ||
| 861 | /// Add BURNMSIINSTALL=1 | ||
| 862 | /// </summary> | ||
| 863 | Install, | ||
| 864 | |||
| 865 | /// <summary> | ||
| 866 | /// Add BURNMSIMODFIY=1 | ||
| 867 | /// </summary> | ||
| 868 | Modify, | ||
| 869 | |||
| 870 | /// <summary> | ||
| 871 | /// Add BURNMSIREPAIR=1 | ||
| 872 | /// </summary> | ||
| 873 | Repair, | ||
| 874 | |||
| 875 | /// <summary> | ||
| 876 | /// Add BURNMSIUNINSTALL=1 | ||
| 877 | /// </summary> | ||
| 878 | Uninstall, | ||
| 879 | } | ||
| 880 | |||
| 881 | /// <summary> | ||
| 882 | /// From msi.h | ||
| 883 | /// https://docs.microsoft.com/en-us/windows/win32/api/msi/nf-msi-msisetinternalui | ||
| 884 | /// </summary> | ||
| 885 | [Flags] | ||
| 886 | public enum INSTALLUILEVEL | ||
| 887 | { | ||
| 888 | /// <summary> | ||
| 889 | /// UI level is unchanged | ||
| 890 | /// </summary> | ||
| 891 | NoChange = 0, | ||
| 892 | |||
| 893 | /// <summary> | ||
| 894 | /// default UI is used | ||
| 895 | /// </summary> | ||
| 896 | Default = 1, | ||
| 897 | |||
| 898 | /// <summary> | ||
| 899 | /// completely silent installation | ||
| 900 | /// </summary> | ||
| 901 | None = 2, | ||
| 902 | |||
| 903 | /// <summary> | ||
| 904 | /// simple progress and error handling | ||
| 905 | /// </summary> | ||
| 906 | Basic = 3, | ||
| 907 | |||
| 908 | /// <summary> | ||
| 909 | /// authored UI, wizard dialogs suppressed | ||
| 910 | /// </summary> | ||
| 911 | Reduced = 4, | ||
| 912 | |||
| 913 | /// <summary> | ||
| 914 | /// authored UI with wizards, progress, errors | ||
| 915 | /// </summary> | ||
| 916 | Full = 5, | ||
| 917 | |||
| 918 | /// <summary> | ||
| 919 | /// display success/failure dialog at end of install | ||
| 920 | /// </summary> | ||
| 921 | EndDialog = 0x80, | ||
| 922 | |||
| 923 | /// <summary> | ||
| 924 | /// display only progress dialog | ||
| 925 | /// </summary> | ||
| 926 | ProgressOnly = 0x40, | ||
| 927 | |||
| 928 | /// <summary> | ||
| 929 | /// do not display the cancel button in basic UI | ||
| 930 | /// </summary> | ||
| 931 | HideCancel = 0x20, | ||
| 932 | |||
| 933 | /// <summary> | ||
| 934 | /// force display of source resolution even if quiet | ||
| 935 | /// </summary> | ||
| 936 | SourceResOnly = 0x100, | ||
| 937 | |||
| 938 | /// <summary> | ||
| 939 | /// show UAC prompt even if quiet | ||
| 940 | /// Can only be used if on Windows Installer 5.0 or later | ||
| 941 | /// </summary> | ||
| 942 | UacOnly = 0x200, | ||
| 943 | } | ||
| 835 | } | 944 | } |
