aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Mba.Core/BootstrapperApplication.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.Mba.Core/BootstrapperApplication.cs')
-rw-r--r--src/WixToolset.Mba.Core/BootstrapperApplication.cs1591
1 files changed, 1591 insertions, 0 deletions
diff --git a/src/WixToolset.Mba.Core/BootstrapperApplication.cs b/src/WixToolset.Mba.Core/BootstrapperApplication.cs
new file mode 100644
index 00000000..c08a60c7
--- /dev/null
+++ b/src/WixToolset.Mba.Core/BootstrapperApplication.cs
@@ -0,0 +1,1591 @@
1// 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.
2
3namespace WixToolset.BootstrapperCore
4{
5 using System;
6 using System.Runtime.InteropServices;
7 using System.Threading;
8
9 /// <summary>
10 /// The default bootstrapper application.
11 /// </summary>
12 [ClassInterface(ClassInterfaceType.None)]
13 public abstract class BootstrapperApplication : MarshalByRefObject, IDefaultBootstrapperApplication
14 {
15 /// <summary>
16 /// Specifies whether this bootstrapper should run asynchronously. The default is true.
17 /// </summary>
18 protected readonly bool asyncExecution;
19
20 /// <summary>
21 /// Gets the <see cref="IEngine"/> for interaction with the engine.
22 /// </summary>
23 protected readonly IEngine engine;
24
25 private bool applying;
26
27 /// <summary>
28 /// Creates a new instance of the <see cref="BootstrapperApplication"/> class.
29 /// </summary>
30 protected BootstrapperApplication(IEngine engine)
31 {
32 this.engine = engine;
33 this.applying = false;
34 this.asyncExecution = true;
35 }
36
37 /// <summary>
38 /// Fired when the engine is starting up the bootstrapper application.
39 /// </summary>
40 public event EventHandler<StartupEventArgs> Startup;
41
42 /// <summary>
43 /// Fired when the engine is shutting down the bootstrapper application.
44 /// </summary>
45 public event EventHandler<ShutdownEventArgs> Shutdown;
46
47 /// <summary>
48 /// Fired when the system is shutting down or user is logging off.
49 /// </summary>
50 /// <remarks>
51 /// <para>To prevent shutting down or logging off, set <see cref="CancellableHResultEventArgs.Cancel"/> to
52 /// true; otherwise, set it to false.</para>
53 /// <para>By default setup will prevent shutting down or logging off between
54 /// <see cref="BootstrapperApplication.ApplyBegin"/> and <see cref="BootstrapperApplication.ApplyComplete"/>.
55 /// Derivatives can change this behavior by overriding <see cref="BootstrapperApplication.OnSystemShutdown"/>
56 /// or handling <see cref="BootstrapperApplication.SystemShutdown"/>.</para>
57 /// <para>If <see cref="SystemShutdownEventArgs.Reasons"/> contains <see cref="EndSessionReasons.Critical"/>
58 /// the bootstrapper cannot prevent the shutdown and only has a few seconds to save state or perform any other
59 /// critical operations before being closed by the operating system.</para>
60 /// <para>This event may be fired on a different thread.</para>
61 /// </remarks>
62 public event EventHandler<SystemShutdownEventArgs> SystemShutdown;
63
64 /// <summary>
65 /// Fired when the overall detection phase has begun.
66 /// </summary>
67 public event EventHandler<DetectBeginEventArgs> DetectBegin;
68
69 /// <summary>
70 /// Fired when a forward compatible bundle is detected.
71 /// </summary>
72 public event EventHandler<DetectForwardCompatibleBundleEventArgs> DetectForwardCompatibleBundle;
73
74 /// <summary>
75 /// Fired when the update detection phase has begun.
76 /// </summary>
77 public event EventHandler<DetectUpdateBeginEventArgs> DetectUpdateBegin;
78
79 /// <summary>
80 /// Fired when the update detection has found a potential update candidate.
81 /// </summary>
82 public event EventHandler<DetectUpdateEventArgs> DetectUpdate;
83
84 /// <summary>
85 /// Fired when the update detection phase has completed.
86 /// </summary>
87 public event EventHandler<DetectUpdateCompleteEventArgs> DetectUpdateComplete;
88
89 /// <summary>
90 /// Fired when a related bundle has been detected for a bundle.
91 /// </summary>
92 public event EventHandler<DetectRelatedBundleEventArgs> DetectRelatedBundle;
93
94 /// <summary>
95 /// Fired when the detection for a specific package has begun.
96 /// </summary>
97 public event EventHandler<DetectPackageBeginEventArgs> DetectPackageBegin;
98
99 /// <summary>
100 /// Fired when a package was not detected but a package using the same provider key was.
101 /// </summary>
102 public event EventHandler<DetectCompatibleMsiPackageEventArgs> DetectCompatibleMsiPackage;
103
104 /// <summary>
105 /// Fired when a related MSI package has been detected for a package.
106 /// </summary>
107 public event EventHandler<DetectRelatedMsiPackageEventArgs> DetectRelatedMsiPackage;
108
109 /// <summary>
110 /// Fired when an MSP package detects a target MSI has been detected.
111 /// </summary>
112 public event EventHandler<DetectTargetMsiPackageEventArgs> DetectTargetMsiPackage;
113
114 /// <summary>
115 /// Fired when a feature in an MSI package has been detected.
116 /// </summary>
117 public event EventHandler<DetectMsiFeatureEventArgs> DetectMsiFeature;
118
119 /// <summary>
120 /// Fired when the detection for a specific package has completed.
121 /// </summary>
122 public event EventHandler<DetectPackageCompleteEventArgs> DetectPackageComplete;
123
124 /// <summary>
125 /// Fired when the detection phase has completed.
126 /// </summary>
127 public event EventHandler<DetectCompleteEventArgs> DetectComplete;
128
129 /// <summary>
130 /// Fired when the engine has begun planning the installation.
131 /// </summary>
132 public event EventHandler<PlanBeginEventArgs> PlanBegin;
133
134 /// <summary>
135 /// Fired when the engine has begun planning for a related bundle.
136 /// </summary>
137 public event EventHandler<PlanRelatedBundleEventArgs> PlanRelatedBundle;
138
139 /// <summary>
140 /// Fired when the engine has begun planning the installation of a specific package.
141 /// </summary>
142 public event EventHandler<PlanPackageBeginEventArgs> PlanPackageBegin;
143
144 /// <summary>
145 /// Fired when the engine plans a new, compatible package using the same provider key.
146 /// </summary>
147 public event EventHandler<PlanCompatibleMsiPackageBeginEventArgs> PlanCompatibleMsiPackageBegin;
148
149 /// <summary>
150 /// Fired when the engine has completed planning the installation of a specific package.
151 /// </summary>
152 public event EventHandler<PlanCompatibleMsiPackageCompleteEventArgs> PlanCompatibleMsiPackageComplete;
153
154 /// <summary>
155 /// Fired when the engine is about to plan the target MSI of a MSP package.
156 /// </summary>
157 public event EventHandler<PlanTargetMsiPackageEventArgs> PlanTargetMsiPackage;
158
159 /// <summary>
160 /// Fired when the engine is about to plan a feature in an MSI package.
161 /// </summary>
162 public event EventHandler<PlanMsiFeatureEventArgs> PlanMsiFeature;
163
164 /// <summary>
165 /// Fired when the engine has completed planning the installation of a specific package.
166 /// </summary>
167 public event EventHandler<PlanPackageCompleteEventArgs> PlanPackageComplete;
168
169 /// <summary>
170 /// Fired when the engine has completed planning the installation.
171 /// </summary>
172 public event EventHandler<PlanCompleteEventArgs> PlanComplete;
173
174 /// <summary>
175 /// Fired when the engine has begun installing the bundle.
176 /// </summary>
177 public event EventHandler<ApplyBeginEventArgs> ApplyBegin;
178
179 /// <summary>
180 /// Fired when the engine is about to start the elevated process.
181 /// </summary>
182 public event EventHandler<ElevateBeginEventArgs> ElevateBegin;
183
184 /// <summary>
185 /// Fired when the engine has completed starting the elevated process.
186 /// </summary>
187 public event EventHandler<ElevateCompleteEventArgs> ElevateComplete;
188
189 /// <summary>
190 /// Fired when the engine has changed progress for the bundle installation.
191 /// </summary>
192 public event EventHandler<ProgressEventArgs> Progress;
193
194 /// <summary>
195 /// Fired when the engine has encountered an error.
196 /// </summary>
197 public event EventHandler<ErrorEventArgs> Error;
198
199 /// <summary>
200 /// Fired when the engine has begun registering the location and visibility of the bundle.
201 /// </summary>
202 public event EventHandler<RegisterBeginEventArgs> RegisterBegin;
203
204 /// <summary>
205 /// Fired when the engine has completed registering the location and visibility of the bundle.
206 /// </summary>
207 public event EventHandler<RegisterCompleteEventArgs> RegisterComplete;
208
209 /// <summary>
210 /// Fired when the engine has begun removing the registration for the location and visibility of the bundle.
211 /// </summary>
212 public event EventHandler<UnregisterBeginEventArgs> UnregisterBegin;
213
214 /// <summary>
215 /// Fired when the engine has completed removing the registration for the location and visibility of the bundle.
216 /// </summary>
217 public event EventHandler<UnregisterCompleteEventArgs> UnregisterComplete;
218
219 /// <summary>
220 /// Fired when the engine has begun caching the installation sources.
221 /// </summary>
222 public event EventHandler<CacheBeginEventArgs> CacheBegin;
223
224 /// <summary>
225 /// Fired when the engine has begun caching a specific package.
226 /// </summary>
227 public event EventHandler<CachePackageBeginEventArgs> CachePackageBegin;
228
229 /// <summary>
230 /// Fired when the engine has begun acquiring the installation sources.
231 /// </summary>
232 public event EventHandler<CacheAcquireBeginEventArgs> CacheAcquireBegin;
233
234 /// <summary>
235 /// Fired when the engine has progress acquiring the installation sources.
236 /// </summary>
237 public event EventHandler<CacheAcquireProgressEventArgs> CacheAcquireProgress;
238
239 /// <summary>
240 /// Fired by the engine to allow the BA to change the source
241 /// using <see cref="M:Engine.SetLocalSource"/> or <see cref="M:Engine.SetDownloadSource"/>.
242 /// </summary>
243 public event EventHandler<ResolveSourceEventArgs> ResolveSource;
244
245 /// <summary>
246 /// Fired when the engine has completed the acquisition of the installation sources.
247 /// </summary>
248 public event EventHandler<CacheAcquireCompleteEventArgs> CacheAcquireComplete;
249
250 /// <summary>
251 /// Fired when the engine begins the verification of the acquired installation sources.
252 /// </summary>
253 public event EventHandler<CacheVerifyBeginEventArgs> CacheVerifyBegin;
254
255 /// <summary>
256 /// Fired when the engine complete the verification of the acquired installation sources.
257 /// </summary>
258 public event EventHandler<CacheVerifyCompleteEventArgs> CacheVerifyComplete;
259
260 /// <summary>
261 /// Fired when the engine has completed caching a specific package.
262 /// </summary>
263 public event EventHandler<CachePackageCompleteEventArgs> CachePackageComplete;
264
265 /// <summary>
266 /// Fired after the engine has cached the installation sources.
267 /// </summary>
268 public event EventHandler<CacheCompleteEventArgs> CacheComplete;
269
270 /// <summary>
271 /// Fired when the engine has begun installing packages.
272 /// </summary>
273 public event EventHandler<ExecuteBeginEventArgs> ExecuteBegin;
274
275 /// <summary>
276 /// Fired when the engine has begun installing a specific package.
277 /// </summary>
278 public event EventHandler<ExecutePackageBeginEventArgs> ExecutePackageBegin;
279
280 /// <summary>
281 /// Fired when the engine executes one or more patches targeting a product.
282 /// </summary>
283 public event EventHandler<ExecutePatchTargetEventArgs> ExecutePatchTarget;
284
285 /// <summary>
286 /// Fired when Windows Installer sends an installation message.
287 /// </summary>
288 public event EventHandler<ExecuteMsiMessageEventArgs> ExecuteMsiMessage;
289
290 /// <summary>
291 /// Fired when Windows Installer sends a files in use installation message.
292 /// </summary>
293 public event EventHandler<ExecuteFilesInUseEventArgs> ExecuteFilesInUse;
294
295 /// <summary>
296 /// Fired when the engine has completed installing a specific package.
297 /// </summary>
298 public event EventHandler<ExecutePackageCompleteEventArgs> ExecutePackageComplete;
299
300 /// <summary>
301 /// Fired when the engine has completed installing packages.
302 /// </summary>
303 public event EventHandler<ExecuteCompleteEventArgs> ExecuteComplete;
304
305 /// <summary>
306 /// Fired when the engine has completed installing the bundle.
307 /// </summary>
308 public event EventHandler<ApplyCompleteEventArgs> ApplyComplete;
309
310 /// <summary>
311 /// Fired by the engine while executing on payload.
312 /// </summary>
313 public event EventHandler<ExecuteProgressEventArgs> ExecuteProgress;
314
315 /// <summary>
316 /// Fired when the engine is about to launch the preapproved executable.
317 /// </summary>
318 public event EventHandler<LaunchApprovedExeBeginArgs> LaunchApprovedExeBegin;
319
320 /// <summary>
321 /// Fired when the engine has completed launching the preapproved executable.
322 /// </summary>
323 public event EventHandler<LaunchApprovedExeCompleteArgs> LaunchApprovedExeComplete;
324
325 /// <summary>
326 /// Entry point that is called when the bootstrapper application is ready to run.
327 /// </summary>
328 protected abstract void Run();
329
330 /// <summary>
331 /// Called by the engine on startup of the bootstrapper application.
332 /// </summary>
333 /// <param name="args">Additional arguments for this event.</param>
334 protected virtual void OnStartup(StartupEventArgs args)
335 {
336 EventHandler<StartupEventArgs> handler = this.Startup;
337 if (null != handler)
338 {
339 handler(this, args);
340 }
341
342 if (this.asyncExecution)
343 {
344 this.engine.Log(LogLevel.Verbose, "Creating BA thread to run asynchronously.");
345 Thread uiThread = new Thread(this.Run);
346 uiThread.Name = "UIThread";
347 uiThread.SetApartmentState(ApartmentState.STA);
348 uiThread.Start();
349 }
350 else
351 {
352 this.engine.Log(LogLevel.Verbose, "Creating BA thread to run synchronously.");
353 this.Run();
354 }
355 }
356
357 /// <summary>
358 /// Called by the engine to uninitialize the BA.
359 /// </summary>
360 /// <param name="args">Additional arguments for this event.</param>
361 protected virtual void OnShutdown(ShutdownEventArgs args)
362 {
363 EventHandler<ShutdownEventArgs> handler = this.Shutdown;
364 if (null != handler)
365 {
366 handler(this, args);
367 }
368 }
369
370 /// <summary>
371 /// Called when the system is shutting down or the user is logging off.
372 /// </summary>
373 /// <param name="args">Additional arguments for this event.</param>
374 /// <remarks>
375 /// <para>To prevent shutting down or logging off, set <see cref="CancellableHResultEventArgs.Cancel"/> to
376 /// true; otherwise, set it to false.</para>
377 /// <para>By default setup will prevent shutting down or logging off between
378 /// <see cref="BootstrapperApplication.ApplyBegin"/> and <see cref="BootstrapperApplication.ApplyComplete"/>.
379 /// Derivatives can change this behavior by overriding <see cref="BootstrapperApplication.OnSystemShutdown"/>
380 /// or handling <see cref="BootstrapperApplication.SystemShutdown"/>.</para>
381 /// <para>If <see cref="SystemShutdownEventArgs.Reasons"/> contains <see cref="EndSessionReasons.Critical"/>
382 /// the bootstrapper cannot prevent the shutdown and only has a few seconds to save state or perform any other
383 /// critical operations before being closed by the operating system.</para>
384 /// <para>This method may be called on a different thread.</para>
385 /// </remarks>
386 protected virtual void OnSystemShutdown(SystemShutdownEventArgs args)
387 {
388 EventHandler<SystemShutdownEventArgs> handler = this.SystemShutdown;
389 if (null != handler)
390 {
391 handler(this, args);
392 }
393 else if (null != args)
394 {
395 // Allow requests to shut down when critical or not applying.
396 bool critical = EndSessionReasons.Critical == (EndSessionReasons.Critical & args.Reasons);
397 args.Cancel = !critical && this.applying;
398 }
399 }
400
401 /// <summary>
402 /// Called when the overall detection phase has begun.
403 /// </summary>
404 /// <param name="args">Additional arguments for this event.</param>
405 protected virtual void OnDetectBegin(DetectBeginEventArgs args)
406 {
407 EventHandler<DetectBeginEventArgs> handler = this.DetectBegin;
408 if (null != handler)
409 {
410 handler(this, args);
411 }
412 }
413
414 /// <summary>
415 /// Called when the update detection phase has begun.
416 /// </summary>
417 /// <param name="args">Additional arguments for this event.</param>
418 protected virtual void OnDetectForwardCompatibleBundle(DetectForwardCompatibleBundleEventArgs args)
419 {
420 EventHandler<DetectForwardCompatibleBundleEventArgs> handler = this.DetectForwardCompatibleBundle;
421 if (null != handler)
422 {
423 handler(this, args);
424 }
425 }
426
427 /// <summary>
428 /// Called when the update detection phase has begun.
429 /// </summary>
430 /// <param name="args">Additional arguments for this event.</param>
431 protected virtual void OnDetectUpdateBegin(DetectUpdateBeginEventArgs args)
432 {
433 EventHandler<DetectUpdateBeginEventArgs> handler = this.DetectUpdateBegin;
434 if (null != handler)
435 {
436 handler(this, args);
437 }
438 }
439
440 /// <summary>
441 /// Fired when the update detection has found a potential update candidate.
442 /// </summary>
443 /// <param name="args">Additional arguments for this event.</param>
444 protected virtual void OnDetectUpdate(DetectUpdateEventArgs args)
445 {
446 EventHandler<DetectUpdateEventArgs> handler = this.DetectUpdate;
447 if (null != handler)
448 {
449 handler(this, args);
450 }
451 }
452
453 /// <summary>
454 /// Called when the update detection phase has completed.
455 /// </summary>
456 /// <param name="args">Additional arguments for this event.</param>
457 protected virtual void OnDetectUpdateComplete(DetectUpdateCompleteEventArgs args)
458 {
459 EventHandler<DetectUpdateCompleteEventArgs> handler = this.DetectUpdateComplete;
460 if (null != handler)
461 {
462 handler(this, args);
463 }
464 }
465
466 /// <summary>
467 /// Called when a related bundle has been detected for a bundle.
468 /// </summary>
469 /// <param name="args">Additional arguments for this event.</param>
470 protected virtual void OnDetectRelatedBundle(DetectRelatedBundleEventArgs args)
471 {
472 EventHandler<DetectRelatedBundleEventArgs> handler = this.DetectRelatedBundle;
473 if (null != handler)
474 {
475 handler(this, args);
476 }
477 }
478
479 /// <summary>
480 /// Called when the detection for a specific package has begun.
481 /// </summary>
482 /// <param name="args">Additional arguments for this event.</param>
483 protected virtual void OnDetectPackageBegin(DetectPackageBeginEventArgs args)
484 {
485 EventHandler<DetectPackageBeginEventArgs> handler = this.DetectPackageBegin;
486 if (null != handler)
487 {
488 handler(this, args);
489 }
490 }
491
492 /// <summary>
493 /// Called when a package was not detected but a package using the same provider key was.
494 /// </summary>
495 /// <param name="args">Additional arguments for this event.</param>
496 protected virtual void OnDetectCompatibleMsiPackage(DetectCompatibleMsiPackageEventArgs args)
497 {
498 EventHandler<DetectCompatibleMsiPackageEventArgs> handler = this.DetectCompatibleMsiPackage;
499 if (null != handler)
500 {
501 handler(this, args);
502 }
503 }
504
505 /// <summary>
506 /// Called when a related MSI package has been detected for a package.
507 /// </summary>
508 /// <param name="args">Additional arguments for this event.</param>
509 protected virtual void OnDetectRelatedMsiPackage(DetectRelatedMsiPackageEventArgs args)
510 {
511 EventHandler<DetectRelatedMsiPackageEventArgs> handler = this.DetectRelatedMsiPackage;
512 if (null != handler)
513 {
514 handler(this, args);
515 }
516 }
517
518 /// <summary>
519 /// Called when an MSP package detects a target MSI has been detected.
520 /// </summary>
521 /// <param name="args">Additional arguments for this event.</param>
522 protected virtual void OnDetectTargetMsiPackage(DetectTargetMsiPackageEventArgs args)
523 {
524 EventHandler<DetectTargetMsiPackageEventArgs> handler = this.DetectTargetMsiPackage;
525 if (null != handler)
526 {
527 handler(this, args);
528 }
529 }
530
531 /// <summary>
532 /// Called when an MSI feature has been detected for a package.
533 /// </summary>
534 /// <param name="args">Additional arguments for this event.</param>
535 protected virtual void OnDetectMsiFeature(DetectMsiFeatureEventArgs args)
536 {
537 EventHandler<DetectMsiFeatureEventArgs> handler = this.DetectMsiFeature;
538 if (null != handler)
539 {
540 handler(this, args);
541 }
542 }
543
544 /// <summary>
545 /// Called when the detection for a specific package has completed.
546 /// </summary>
547 /// <param name="args">Additional arguments for this event.</param>
548 protected virtual void OnDetectPackageComplete(DetectPackageCompleteEventArgs args)
549 {
550 EventHandler<DetectPackageCompleteEventArgs> handler = this.DetectPackageComplete;
551 if (null != handler)
552 {
553 handler(this, args);
554 }
555 }
556
557 /// <summary>
558 /// Called when the detection phase has completed.
559 /// </summary>
560 /// <param name="args">Additional arguments for this event.</param>
561 protected virtual void OnDetectComplete(DetectCompleteEventArgs args)
562 {
563 EventHandler<DetectCompleteEventArgs> handler = this.DetectComplete;
564 if (null != handler)
565 {
566 handler(this, args);
567 }
568 }
569
570 /// <summary>
571 /// Called when the engine has begun planning the installation.
572 /// </summary>
573 /// <param name="args">Additional arguments for this event.</param>
574 protected virtual void OnPlanBegin(PlanBeginEventArgs args)
575 {
576 EventHandler<PlanBeginEventArgs> handler = this.PlanBegin;
577 if (null != handler)
578 {
579 handler(this, args);
580 }
581 }
582
583 /// <summary>
584 /// Called when the engine has begun planning for a prior bundle.
585 /// </summary>
586 /// <param name="args">Additional arguments for this event.</param>
587 protected virtual void OnPlanRelatedBundle(PlanRelatedBundleEventArgs args)
588 {
589 EventHandler<PlanRelatedBundleEventArgs> handler = this.PlanRelatedBundle;
590 if (null != handler)
591 {
592 handler(this, args);
593 }
594 }
595
596 /// <summary>
597 /// Called when the engine has begun planning the installation of a specific package.
598 /// </summary>
599 /// <param name="args">Additional arguments for this event.</param>
600 protected virtual void OnPlanPackageBegin(PlanPackageBeginEventArgs args)
601 {
602 EventHandler<PlanPackageBeginEventArgs> handler = this.PlanPackageBegin;
603 if (null != handler)
604 {
605 handler(this, args);
606 }
607 }
608
609 /// <summary>
610 /// Called when the engine plans a new, compatible package using the same provider key.
611 /// </summary>
612 /// <param name="args">Additional arguments for this event.</param>
613 protected virtual void OnPlanCompatibleMsiPackageBegin(PlanCompatibleMsiPackageBeginEventArgs args)
614 {
615 EventHandler<PlanCompatibleMsiPackageBeginEventArgs> handler = this.PlanCompatibleMsiPackageBegin;
616 if (null != handler)
617 {
618 handler(this, args);
619 }
620 }
621
622 /// <summary>
623 /// Called when the engine has completed planning the installation of a specific package.
624 /// </summary>
625 /// <param name="args">Additional arguments for this event.</param>
626 protected virtual void OnPlanCompatibleMsiPackageComplete(PlanCompatibleMsiPackageCompleteEventArgs args)
627 {
628 EventHandler<PlanCompatibleMsiPackageCompleteEventArgs> handler = this.PlanCompatibleMsiPackageComplete;
629 if (null != handler)
630 {
631 handler(this, args);
632 }
633 }
634
635 /// <summary>
636 /// Called when the engine is about to plan the target MSI of a MSP package.
637 /// </summary>
638 /// <param name="args">Additional arguments for this event.</param>
639 protected virtual void OnPlanTargetMsiPackage(PlanTargetMsiPackageEventArgs args)
640 {
641 EventHandler<PlanTargetMsiPackageEventArgs> handler = this.PlanTargetMsiPackage;
642 if (null != handler)
643 {
644 handler(this, args);
645 }
646 }
647
648 /// <summary>
649 /// Called when the engine is about to plan an MSI feature of a specific package.
650 /// </summary>
651 /// <param name="args">Additional arguments for this event.</param>
652 protected virtual void OnPlanMsiFeature(PlanMsiFeatureEventArgs args)
653 {
654 EventHandler<PlanMsiFeatureEventArgs> handler = this.PlanMsiFeature;
655 if (null != handler)
656 {
657 handler(this, args);
658 }
659 }
660
661 /// <summary>
662 /// Called when then engine has completed planning the installation of a specific package.
663 /// </summary>
664 /// <param name="args">Additional arguments for this event.</param>
665 protected virtual void OnPlanPackageComplete(PlanPackageCompleteEventArgs args)
666 {
667 EventHandler<PlanPackageCompleteEventArgs> handler = this.PlanPackageComplete;
668 if (null != handler)
669 {
670 handler(this, args);
671 }
672 }
673
674 /// <summary>
675 /// Called when the engine has completed planning the installation.
676 /// </summary>
677 /// <param name="args">Additional arguments for this event.</param>
678 protected virtual void OnPlanComplete(PlanCompleteEventArgs args)
679 {
680 EventHandler<PlanCompleteEventArgs> handler = this.PlanComplete;
681 if (null != handler)
682 {
683 handler(this, args);
684 }
685 }
686
687 /// <summary>
688 /// Called when the engine has begun installing the bundle.
689 /// </summary>
690 /// <param name="args">Additional arguments for this event.</param>
691 protected virtual void OnApplyBegin(ApplyBeginEventArgs args)
692 {
693 EventHandler<ApplyBeginEventArgs> handler = this.ApplyBegin;
694 if (null != handler)
695 {
696 handler(this, args);
697 }
698 }
699
700 /// <summary>
701 /// Called when the engine is about to start the elevated process.
702 /// </summary>
703 /// <param name="args">Additional arguments for this event.</param>
704 protected virtual void OnElevateBegin(ElevateBeginEventArgs args)
705 {
706 EventHandler<ElevateBeginEventArgs> handler = this.ElevateBegin;
707 if (null != handler)
708 {
709 handler(this, args);
710 }
711 }
712
713 /// <summary>
714 /// Called when the engine has completed starting the elevated process.
715 /// </summary>
716 /// <param name="args">Additional arguments for this event.</param>
717 protected virtual void OnElevateComplete(ElevateCompleteEventArgs args)
718 {
719 EventHandler<ElevateCompleteEventArgs> handler = this.ElevateComplete;
720 if (null != handler)
721 {
722 handler(this, args);
723 }
724 }
725
726 /// <summary>
727 /// Called when the engine has changed progress for the bundle installation.
728 /// </summary>
729 /// <param name="args">Additional arguments for this event.</param>
730 protected virtual void OnProgress(ProgressEventArgs args)
731 {
732 EventHandler<ProgressEventArgs> handler = this.Progress;
733 if (null != handler)
734 {
735 handler(this, args);
736 }
737 }
738
739 /// <summary>
740 /// Called when the engine has encountered an error.
741 /// </summary>
742 /// <param name="args">Additional arguments for this event.</param>
743 protected virtual void OnError(ErrorEventArgs args)
744 {
745 EventHandler<ErrorEventArgs> handler = this.Error;
746 if (null != handler)
747 {
748 handler(this, args);
749 }
750 }
751
752 /// <summary>
753 /// Called when the engine has begun registering the location and visibility of the bundle.
754 /// </summary>
755 /// <param name="args">Additional arguments for this event.</param>
756 protected virtual void OnRegisterBegin(RegisterBeginEventArgs args)
757 {
758 EventHandler<RegisterBeginEventArgs> handler = this.RegisterBegin;
759 if (null != handler)
760 {
761 handler(this, args);
762 }
763 }
764
765 /// <summary>
766 /// Called when the engine has completed registering the location and visilibity of the bundle.
767 /// </summary>
768 /// <param name="args">Additional arguments for this event.</param>
769 protected virtual void OnRegisterComplete(RegisterCompleteEventArgs args)
770 {
771 EventHandler<RegisterCompleteEventArgs> handler = this.RegisterComplete;
772 if (null != handler)
773 {
774 handler(this, args);
775 }
776 }
777
778 /// <summary>
779 /// Called when the engine has begun removing the registration for the location and visibility of the bundle.
780 /// </summary>
781 /// <param name="args">Additional arguments for this event.</param>
782 protected virtual void OnUnregisterBegin(UnregisterBeginEventArgs args)
783 {
784 EventHandler<UnregisterBeginEventArgs> handler = this.UnregisterBegin;
785 if (null != handler)
786 {
787 handler(this, args);
788 }
789 }
790
791 /// <summary>
792 /// Called when the engine has completed removing the registration for the location and visibility of the bundle.
793 /// </summary>
794 /// <param name="args">Additional arguments for this event.</param>
795 protected virtual void OnUnregisterComplete(UnregisterCompleteEventArgs args)
796 {
797 EventHandler<UnregisterCompleteEventArgs> handler = this.UnregisterComplete;
798 if (null != handler)
799 {
800 handler(this, args);
801 }
802 }
803
804 /// <summary>
805 /// Called when the engine begins to cache the installation sources.
806 /// </summary>
807 /// <param name="args"></param>
808 protected virtual void OnCacheBegin(CacheBeginEventArgs args)
809 {
810 EventHandler<CacheBeginEventArgs> handler = this.CacheBegin;
811 if (null != handler)
812 {
813 handler(this, args);
814 }
815 }
816
817 /// <summary>
818 /// Called by the engine when it begins to cache a specific package.
819 /// </summary>
820 /// <param name="args"></param>
821 protected virtual void OnCachePackageBegin(CachePackageBeginEventArgs args)
822 {
823 EventHandler<CachePackageBeginEventArgs> handler = this.CachePackageBegin;
824 if (null != handler)
825 {
826 handler(this, args);
827 }
828 }
829
830 /// <summary>
831 /// Called when the engine begins to cache the container or payload.
832 /// </summary>
833 /// <param name="args"></param>
834 protected virtual void OnCacheAcquireBegin(CacheAcquireBeginEventArgs args)
835 {
836 EventHandler<CacheAcquireBeginEventArgs> handler = this.CacheAcquireBegin;
837 if (null != handler)
838 {
839 handler(this, args);
840 }
841 }
842
843 /// <summary>
844 /// Called when the engine has progressed on caching the container or payload.
845 /// </summary>
846 /// <param name="args"></param>
847 protected virtual void OnCacheAcquireProgress(CacheAcquireProgressEventArgs args)
848 {
849 EventHandler<CacheAcquireProgressEventArgs> handler = this.CacheAcquireProgress;
850 if (null != handler)
851 {
852 handler(this, args);
853 }
854 }
855
856 /// <summary>
857 /// Called by the engine to allow the BA to change the source
858 /// using <see cref="M:Engine.SetLocalSource"/> or <see cref="M:Engine.SetDownloadSource"/>.
859 /// </summary>
860 /// <param name="args">Additional arguments for this event.</param>
861 protected virtual void OnResolveSource(ResolveSourceEventArgs args)
862 {
863 EventHandler<ResolveSourceEventArgs> handler = this.ResolveSource;
864 if (null != handler)
865 {
866 handler(this, args);
867 }
868 }
869
870 /// <summary>
871 /// Called when the engine completes caching of the container or payload.
872 /// </summary>
873 /// <param name="args"></param>
874 protected virtual void OnCacheAcquireComplete(CacheAcquireCompleteEventArgs args)
875 {
876 EventHandler<CacheAcquireCompleteEventArgs> handler = this.CacheAcquireComplete;
877 if (null != handler)
878 {
879 handler(this, args);
880 }
881 }
882
883 /// <summary>
884 /// Called when the engine has started verify the payload.
885 /// </summary>
886 /// <param name="args"></param>
887 protected virtual void OnCacheVerifyBegin(CacheVerifyBeginEventArgs args)
888 {
889 EventHandler<CacheVerifyBeginEventArgs> handler = this.CacheVerifyBegin;
890 if (null != handler)
891 {
892 handler(this, args);
893 }
894 }
895
896 /// <summary>
897 /// Called when the engine completes verification of the payload.
898 /// </summary>
899 /// <param name="args"></param>
900 protected virtual void OnCacheVerifyComplete(CacheVerifyCompleteEventArgs args)
901 {
902 EventHandler<CacheVerifyCompleteEventArgs> handler = this.CacheVerifyComplete;
903 if (null != handler)
904 {
905 handler(this, args);
906 }
907 }
908
909 /// <summary>
910 /// Called when the engine completes caching a specific package.
911 /// </summary>
912 /// <param name="args"></param>
913 protected virtual void OnCachePackageComplete(CachePackageCompleteEventArgs args)
914 {
915 EventHandler<CachePackageCompleteEventArgs> handler = this.CachePackageComplete;
916 if (null != handler)
917 {
918 handler(this, args);
919 }
920 }
921
922 /// <summary>
923 /// Called after the engine has cached the installation sources.
924 /// </summary>
925 /// <param name="args">Additional arguments for this event.</param>
926 protected virtual void OnCacheComplete(CacheCompleteEventArgs args)
927 {
928 EventHandler<CacheCompleteEventArgs> handler = this.CacheComplete;
929 if (null != handler)
930 {
931 handler(this, args);
932 }
933 }
934
935 /// <summary>
936 /// Called when the engine has begun installing packages.
937 /// </summary>
938 /// <param name="args">Additional arguments for this event.</param>
939 protected virtual void OnExecuteBegin(ExecuteBeginEventArgs args)
940 {
941 EventHandler<ExecuteBeginEventArgs> handler = this.ExecuteBegin;
942 if (null != handler)
943 {
944 handler(this, args);
945 }
946 }
947
948 /// <summary>
949 /// Called when the engine has begun installing a specific package.
950 /// </summary>
951 /// <param name="args">Additional arguments for this event.</param>
952 protected virtual void OnExecutePackageBegin(ExecutePackageBeginEventArgs args)
953 {
954 EventHandler<ExecutePackageBeginEventArgs> handler = this.ExecutePackageBegin;
955 if (null != handler)
956 {
957 handler(this, args);
958 }
959 }
960
961 /// <summary>
962 /// Called when the engine executes one or more patches targeting a product.
963 /// </summary>
964 /// <param name="args">Additional arguments for this event.</param>
965 protected virtual void OnExecutePatchTarget(ExecutePatchTargetEventArgs args)
966 {
967 EventHandler<ExecutePatchTargetEventArgs> handler = this.ExecutePatchTarget;
968 if (null != handler)
969 {
970 handler(this, args);
971 }
972 }
973
974 /// <summary>
975 /// Called when Windows Installer sends an installation message.
976 /// </summary>
977 /// <param name="args">Additional arguments for this event.</param>
978 protected virtual void OnExecuteMsiMessage(ExecuteMsiMessageEventArgs args)
979 {
980 EventHandler<ExecuteMsiMessageEventArgs> handler = this.ExecuteMsiMessage;
981 if (null != handler)
982 {
983 handler(this, args);
984 }
985 }
986
987 /// <summary>
988 /// Called when Windows Installer sends a file in use installation message.
989 /// </summary>
990 /// <param name="args">Additional arguments for this event.</param>
991 protected virtual void OnExecuteFilesInUse(ExecuteFilesInUseEventArgs args)
992 {
993 EventHandler<ExecuteFilesInUseEventArgs> handler = this.ExecuteFilesInUse;
994 if (null != handler)
995 {
996 handler(this, args);
997 }
998 }
999
1000 /// <summary>
1001 /// Called when the engine has completed installing a specific package.
1002 /// </summary>
1003 /// <param name="args">Additional arguments for this event.</param>
1004 protected virtual void OnExecutePackageComplete(ExecutePackageCompleteEventArgs args)
1005 {
1006 EventHandler<ExecutePackageCompleteEventArgs> handler = this.ExecutePackageComplete;
1007 if (null != handler)
1008 {
1009 handler(this, args);
1010 }
1011 }
1012
1013 /// <summary>
1014 /// Called when the engine has completed installing packages.
1015 /// </summary>
1016 /// <param name="args">Additional arguments for this event.</param>
1017 protected virtual void OnExecuteComplete(ExecuteCompleteEventArgs args)
1018 {
1019 EventHandler<ExecuteCompleteEventArgs> handler = this.ExecuteComplete;
1020 if (null != handler)
1021 {
1022 handler(this, args);
1023 }
1024 }
1025
1026 /// <summary>
1027 /// Called when the engine has completed installing the bundle.
1028 /// </summary>
1029 /// <param name="args">Additional arguments for this event.</param>
1030 protected virtual void OnApplyComplete(ApplyCompleteEventArgs args)
1031 {
1032 EventHandler<ApplyCompleteEventArgs> handler = this.ApplyComplete;
1033 if (null != handler)
1034 {
1035 handler(this, args);
1036 }
1037 }
1038
1039 /// <summary>
1040 /// Called by the engine while executing on payload.
1041 /// </summary>
1042 /// <param name="args">Additional arguments for this event.</param>
1043 protected virtual void OnExecuteProgress(ExecuteProgressEventArgs args)
1044 {
1045 EventHandler<ExecuteProgressEventArgs> handler = this.ExecuteProgress;
1046 if (null != handler)
1047 {
1048 handler(this, args);
1049 }
1050 }
1051
1052 /// <summary>
1053 /// Called by the engine before trying to launch the preapproved executable.
1054 /// </summary>
1055 /// <param name="args">Additional arguments for this event.</param>
1056 protected virtual void OnLaunchApprovedExeBegin(LaunchApprovedExeBeginArgs args)
1057 {
1058 EventHandler<LaunchApprovedExeBeginArgs> handler = this.LaunchApprovedExeBegin;
1059 if (null != handler)
1060 {
1061 handler(this, args);
1062 }
1063 }
1064
1065 /// <summary>
1066 /// Called by the engine after trying to launch the preapproved executable.
1067 /// </summary>
1068 /// <param name="args">Additional arguments for this event.</param>
1069 protected virtual void OnLaunchApprovedExeComplete(LaunchApprovedExeCompleteArgs args)
1070 {
1071 EventHandler<LaunchApprovedExeCompleteArgs> handler = this.LaunchApprovedExeComplete;
1072 if (null != handler)
1073 {
1074 handler(this, args);
1075 }
1076 }
1077
1078 #region IBootstrapperApplication Members
1079
1080 int IBootstrapperApplication.OnStartup()
1081 {
1082 StartupEventArgs args = new StartupEventArgs();
1083 this.OnStartup(args);
1084
1085 return args.HResult;
1086 }
1087
1088 int IBootstrapperApplication.OnShutdown(ref BOOTSTRAPPER_SHUTDOWN_ACTION action)
1089 {
1090 ShutdownEventArgs args = new ShutdownEventArgs(action);
1091 this.OnShutdown(args);
1092
1093 action = args.Action;
1094 return args.HResult;
1095 }
1096
1097 int IBootstrapperApplication.OnSystemShutdown(EndSessionReasons dwEndSession, ref bool fCancel)
1098 {
1099 SystemShutdownEventArgs args = new SystemShutdownEventArgs(dwEndSession, fCancel);
1100 this.OnSystemShutdown(args);
1101
1102 fCancel = args.Cancel;
1103 return args.HResult;
1104 }
1105
1106 int IBootstrapperApplication.OnDetectBegin(bool fInstalled, int cPackages, ref bool fCancel)
1107 {
1108 DetectBeginEventArgs args = new DetectBeginEventArgs(fInstalled, cPackages, fCancel);
1109 this.OnDetectBegin(args);
1110
1111 fCancel = args.Cancel;
1112 return args.HResult;
1113 }
1114
1115 int IBootstrapperApplication.OnDetectForwardCompatibleBundle(string wzBundleId, RelationType relationType, string wzBundleTag, bool fPerMachine, long version, ref bool fCancel, ref bool fIgnoreBundle)
1116 {
1117 DetectForwardCompatibleBundleEventArgs args = new DetectForwardCompatibleBundleEventArgs(wzBundleId, relationType, wzBundleTag, fPerMachine, version, fCancel, fIgnoreBundle);
1118 this.OnDetectForwardCompatibleBundle(args);
1119
1120 fCancel = args.Cancel;
1121 fIgnoreBundle = args.IgnoreBundle;
1122 return args.HResult;
1123 }
1124
1125 int IBootstrapperApplication.OnDetectUpdateBegin(string wzUpdateLocation, ref bool fCancel, ref bool fSkip)
1126 {
1127 DetectUpdateBeginEventArgs args = new DetectUpdateBeginEventArgs(wzUpdateLocation, fCancel, fSkip);
1128 this.OnDetectUpdateBegin(args);
1129
1130 fCancel = args.Cancel;
1131 fSkip = args.Skip;
1132 return args.HResult;
1133 }
1134
1135 int IBootstrapperApplication.OnDetectUpdate(string wzUpdateLocation, long dw64Size, long dw64Version, string wzTitle, string wzSummary, string wzContentType, string wzContent, ref bool fCancel, ref bool fStopProcessingUpdates)
1136 {
1137 DetectUpdateEventArgs args = new DetectUpdateEventArgs(wzUpdateLocation, dw64Size, dw64Version, wzTitle, wzSummary, wzContentType, wzContent, fCancel, fStopProcessingUpdates);
1138 this.OnDetectUpdate(args);
1139
1140 fCancel = args.Cancel;
1141 fStopProcessingUpdates = args.StopProcessingUpdates;
1142 return args.HResult;
1143 }
1144
1145 int IBootstrapperApplication.OnDetectUpdateComplete(int hrStatus, ref bool fIgnoreError)
1146 {
1147 DetectUpdateCompleteEventArgs args = new DetectUpdateCompleteEventArgs(hrStatus, fIgnoreError);
1148 this.OnDetectUpdateComplete(args);
1149
1150 fIgnoreError = args.IgnoreError;
1151 return args.HResult;
1152 }
1153
1154 int IBootstrapperApplication.OnDetectRelatedBundle(string wzProductCode, RelationType relationType, string wzBundleTag, bool fPerMachine, long version, RelatedOperation operation, ref bool fCancel)
1155 {
1156 DetectRelatedBundleEventArgs args = new DetectRelatedBundleEventArgs(wzProductCode, relationType, wzBundleTag, fPerMachine, version, operation, fCancel);
1157 this.OnDetectRelatedBundle(args);
1158
1159 fCancel = args.Cancel;
1160 return args.HResult;
1161 }
1162
1163 int IBootstrapperApplication.OnDetectPackageBegin(string wzPackageId, ref bool fCancel)
1164 {
1165 DetectPackageBeginEventArgs args = new DetectPackageBeginEventArgs(wzPackageId, fCancel);
1166 this.OnDetectPackageBegin(args);
1167
1168 fCancel = args.Cancel;
1169 return args.HResult;
1170 }
1171
1172 int IBootstrapperApplication.OnDetectCompatibleMsiPackage(string wzPackageId, string wzCompatiblePackageId, long dw64CompatiblePackageVersion, ref bool fCancel)
1173 {
1174 DetectCompatibleMsiPackageEventArgs args = new DetectCompatibleMsiPackageEventArgs(wzPackageId, wzCompatiblePackageId, dw64CompatiblePackageVersion, fCancel);
1175 this.OnDetectCompatibleMsiPackage(args);
1176
1177 fCancel = args.Cancel;
1178 return args.HResult;
1179 }
1180
1181 int IBootstrapperApplication.OnDetectRelatedMsiPackage(string wzPackageId, string wzUpgradeCode, string wzProductCode, bool fPerMachine, long version, RelatedOperation operation, ref bool fCancel)
1182 {
1183 DetectRelatedMsiPackageEventArgs args = new DetectRelatedMsiPackageEventArgs(wzPackageId, wzUpgradeCode, wzProductCode, fPerMachine, version, operation, fCancel);
1184 this.OnDetectRelatedMsiPackage(args);
1185
1186 fCancel = args.Cancel;
1187 return args.HResult;
1188 }
1189
1190 int IBootstrapperApplication.OnDetectTargetMsiPackage(string wzPackageId, string wzProductCode, PackageState patchState, ref bool fCancel)
1191 {
1192 DetectTargetMsiPackageEventArgs args = new DetectTargetMsiPackageEventArgs(wzPackageId, wzProductCode, patchState, fCancel);
1193 this.OnDetectTargetMsiPackage(args);
1194
1195 fCancel = args.Cancel;
1196 return args.HResult;
1197 }
1198
1199 int IBootstrapperApplication.OnDetectMsiFeature(string wzPackageId, string wzFeatureId, FeatureState state, ref bool fCancel)
1200 {
1201 DetectMsiFeatureEventArgs args = new DetectMsiFeatureEventArgs(wzPackageId, wzFeatureId, state, fCancel);
1202 this.OnDetectMsiFeature(args);
1203
1204 fCancel = args.Cancel;
1205 return args.HResult;
1206 }
1207
1208 int IBootstrapperApplication.OnDetectPackageComplete(string wzPackageId, int hrStatus, PackageState state)
1209 {
1210 DetectPackageCompleteEventArgs args = new DetectPackageCompleteEventArgs(wzPackageId, hrStatus, state);
1211 this.OnDetectPackageComplete(args);
1212
1213 return args.HResult;
1214 }
1215
1216 int IBootstrapperApplication.OnDetectComplete(int hrStatus)
1217 {
1218 DetectCompleteEventArgs args = new DetectCompleteEventArgs(hrStatus);
1219 this.OnDetectComplete(args);
1220
1221 return args.HResult;
1222 }
1223
1224 int IBootstrapperApplication.OnPlanBegin(int cPackages, ref bool fCancel)
1225 {
1226 PlanBeginEventArgs args = new PlanBeginEventArgs(cPackages, fCancel);
1227 this.OnPlanBegin(args);
1228
1229 fCancel = args.Cancel;
1230 return args.HResult;
1231 }
1232
1233 int IBootstrapperApplication.OnPlanRelatedBundle(string wzBundleId, RequestState recommendedState, ref RequestState pRequestedState, ref bool fCancel)
1234 {
1235 PlanRelatedBundleEventArgs args = new PlanRelatedBundleEventArgs(wzBundleId, recommendedState, pRequestedState, fCancel);
1236 this.OnPlanRelatedBundle(args);
1237
1238 pRequestedState = args.State;
1239 fCancel = args.Cancel;
1240 return args.HResult;
1241 }
1242
1243 int IBootstrapperApplication.OnPlanPackageBegin(string wzPackageId, RequestState recommendedState, ref RequestState pRequestedState, ref bool fCancel)
1244 {
1245 PlanPackageBeginEventArgs args = new PlanPackageBeginEventArgs(wzPackageId, recommendedState, pRequestedState, fCancel);
1246 this.OnPlanPackageBegin(args);
1247
1248 pRequestedState = args.State;
1249 fCancel = args.Cancel;
1250 return args.HResult;
1251 }
1252
1253 int IBootstrapperApplication.OnPlanCompatibleMsiPackageBegin(string wzPackageId, string wzCompatiblePackageId, long dw64CompatiblePackageVersion, RequestState recommendedState, ref RequestState pRequestedState, ref bool fCancel)
1254 {
1255 PlanCompatibleMsiPackageBeginEventArgs args = new PlanCompatibleMsiPackageBeginEventArgs(wzPackageId, wzCompatiblePackageId, dw64CompatiblePackageVersion, recommendedState, pRequestedState, fCancel);
1256 this.OnPlanCompatibleMsiPackageBegin(args);
1257
1258 pRequestedState = args.State;
1259 fCancel = args.Cancel;
1260 return args.HResult;
1261 }
1262
1263 int IBootstrapperApplication.OnPlanCompatibleMsiPackageComplete(string wzPackageId, string wzCompatiblePackageId, int hrStatus, PackageState state, RequestState requested, ActionState execute, ActionState rollback)
1264 {
1265 PlanCompatibleMsiPackageCompleteEventArgs args = new PlanCompatibleMsiPackageCompleteEventArgs(wzPackageId, wzCompatiblePackageId, hrStatus, state, requested, execute, rollback);
1266 this.OnPlanCompatibleMsiPackageComplete(args);
1267
1268 return args.HResult;
1269 }
1270
1271 int IBootstrapperApplication.OnPlanTargetMsiPackage(string wzPackageId, string wzProductCode, RequestState recommendedState, ref RequestState pRequestedState, ref bool fCancel)
1272 {
1273 PlanTargetMsiPackageEventArgs args = new PlanTargetMsiPackageEventArgs(wzPackageId, wzProductCode, recommendedState, pRequestedState, fCancel);
1274 this.OnPlanTargetMsiPackage(args);
1275
1276 pRequestedState = args.State;
1277 fCancel = args.Cancel;
1278 return args.HResult;
1279 }
1280
1281 int IBootstrapperApplication.OnPlanMsiFeature(string wzPackageId, string wzFeatureId, FeatureState recommendedState, ref FeatureState pRequestedState, ref bool fCancel)
1282 {
1283 PlanMsiFeatureEventArgs args = new PlanMsiFeatureEventArgs(wzPackageId, wzFeatureId, recommendedState, pRequestedState, fCancel);
1284 this.OnPlanMsiFeature(args);
1285
1286 pRequestedState = args.State;
1287 fCancel = args.Cancel;
1288 return args.HResult;
1289 }
1290
1291 int IBootstrapperApplication.OnPlanPackageComplete(string wzPackageId, int hrStatus, PackageState state, RequestState requested, ActionState execute, ActionState rollback)
1292 {
1293 var args = new PlanPackageCompleteEventArgs(wzPackageId, hrStatus, state, requested, execute, rollback);
1294 this.OnPlanPackageComplete(args);
1295
1296 return args.HResult;
1297 }
1298
1299 int IBootstrapperApplication.OnPlanComplete(int hrStatus)
1300 {
1301 PlanCompleteEventArgs args = new PlanCompleteEventArgs(hrStatus);
1302 this.OnPlanComplete(args);
1303
1304 return args.HResult;
1305 }
1306
1307 int IBootstrapperApplication.OnApplyBegin(int dwPhaseCount, ref bool fCancel)
1308 {
1309 this.applying = true;
1310
1311 ApplyBeginEventArgs args = new ApplyBeginEventArgs(dwPhaseCount, fCancel);
1312 this.OnApplyBegin(args);
1313
1314 fCancel = args.Cancel;
1315 return args.HResult;
1316 }
1317
1318 int IBootstrapperApplication.OnElevateBegin(ref bool fCancel)
1319 {
1320 ElevateBeginEventArgs args = new ElevateBeginEventArgs(fCancel);
1321 this.OnElevateBegin(args);
1322
1323 fCancel = args.Cancel;
1324 return args.HResult;
1325 }
1326
1327 int IBootstrapperApplication.OnElevateComplete(int hrStatus)
1328 {
1329 ElevateCompleteEventArgs args = new ElevateCompleteEventArgs(hrStatus);
1330 this.OnElevateComplete(args);
1331
1332 return args.HResult;
1333 }
1334
1335 int IBootstrapperApplication.OnProgress(int dwProgressPercentage, int dwOverallPercentage, ref bool fCancel)
1336 {
1337 ProgressEventArgs args = new ProgressEventArgs(dwProgressPercentage, dwOverallPercentage, fCancel);
1338 this.OnProgress(args);
1339
1340 fCancel = args.Cancel;
1341 return args.HResult;
1342 }
1343
1344 int IBootstrapperApplication.OnError(ErrorType errorType, string wzPackageId, int dwCode, string wzError, int dwUIHint, int cData, string[] rgwzData, Result nRecommendation, ref Result pResult)
1345 {
1346 ErrorEventArgs args = new ErrorEventArgs(errorType, wzPackageId, dwCode, wzError, dwUIHint, rgwzData, nRecommendation, pResult);
1347 this.OnError(args);
1348
1349 pResult = args.Result;
1350 return args.HResult;
1351 }
1352
1353 int IBootstrapperApplication.OnRegisterBegin(ref bool fCancel)
1354 {
1355 RegisterBeginEventArgs args = new RegisterBeginEventArgs(fCancel);
1356 this.OnRegisterBegin(args);
1357
1358 fCancel = args.Cancel;
1359 return args.HResult;
1360 }
1361
1362 int IBootstrapperApplication.OnRegisterComplete(int hrStatus)
1363 {
1364 RegisterCompleteEventArgs args = new RegisterCompleteEventArgs(hrStatus);
1365 this.OnRegisterComplete(args);
1366
1367 return args.HResult;
1368 }
1369
1370 int IBootstrapperApplication.OnCacheBegin(ref bool fCancel)
1371 {
1372 CacheBeginEventArgs args = new CacheBeginEventArgs(fCancel);
1373 this.OnCacheBegin(args);
1374
1375 fCancel = args.Cancel;
1376 return args.HResult;
1377 }
1378
1379 int IBootstrapperApplication.OnCachePackageBegin(string wzPackageId, int cCachePayloads, long dw64PackageCacheSize, ref bool fCancel)
1380 {
1381 CachePackageBeginEventArgs args = new CachePackageBeginEventArgs(wzPackageId, cCachePayloads, dw64PackageCacheSize, fCancel);
1382 this.OnCachePackageBegin(args);
1383
1384 fCancel = args.Cancel;
1385 return args.HResult;
1386 }
1387
1388 int IBootstrapperApplication.OnCacheAcquireBegin(string wzPackageOrContainerId, string wzPayloadId, CacheOperation operation, string wzSource, ref bool fCancel)
1389 {
1390 CacheAcquireBeginEventArgs args = new CacheAcquireBeginEventArgs(wzPackageOrContainerId, wzPayloadId, operation, wzSource, fCancel);
1391 this.OnCacheAcquireBegin(args);
1392
1393 fCancel = args.Cancel;
1394 return args.HResult;
1395 }
1396
1397 int IBootstrapperApplication.OnCacheAcquireProgress(string wzPackageOrContainerId, string wzPayloadId, long dw64Progress, long dw64Total, int dwOverallPercentage, ref bool fCancel)
1398 {
1399 CacheAcquireProgressEventArgs args = new CacheAcquireProgressEventArgs(wzPackageOrContainerId, wzPayloadId, dw64Progress, dw64Total, dwOverallPercentage, fCancel);
1400 this.OnCacheAcquireProgress(args);
1401
1402 fCancel = args.Cancel;
1403 return args.HResult;
1404 }
1405
1406 int IBootstrapperApplication.OnResolveSource(string wzPackageOrContainerId, string wzPayloadId, string wzLocalSource, string wzDownloadSource, BOOTSTRAPPER_RESOLVESOURCE_ACTION recommendation, ref BOOTSTRAPPER_RESOLVESOURCE_ACTION action, ref bool fCancel)
1407 {
1408 ResolveSourceEventArgs args = new ResolveSourceEventArgs(wzPackageOrContainerId, wzPayloadId, wzLocalSource, wzDownloadSource, action, recommendation, fCancel);
1409 this.OnResolveSource(args);
1410
1411 action = args.Action;
1412 fCancel = args.Cancel;
1413 return args.HResult;
1414 }
1415
1416 int IBootstrapperApplication.OnCacheAcquireComplete(string wzPackageOrContainerId, string wzPayloadId, int hrStatus, BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION recommendation, ref BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION action)
1417 {
1418 CacheAcquireCompleteEventArgs args = new CacheAcquireCompleteEventArgs(wzPackageOrContainerId, wzPayloadId, hrStatus, recommendation, action);
1419 this.OnCacheAcquireComplete(args);
1420
1421 action = args.Action;
1422 return args.HResult;
1423 }
1424
1425 int IBootstrapperApplication.OnCacheVerifyBegin(string wzPackageId, string wzPayloadId, ref bool fCancel)
1426 {
1427 CacheVerifyBeginEventArgs args = new CacheVerifyBeginEventArgs(wzPackageId, wzPayloadId, fCancel);
1428 this.OnCacheVerifyBegin(args);
1429
1430 fCancel = args.Cancel;
1431 return args.HResult;
1432 }
1433
1434 int IBootstrapperApplication.OnCacheVerifyComplete(string wzPackageId, string wzPayloadId, int hrStatus, BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION recommendation, ref BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION action)
1435 {
1436 CacheVerifyCompleteEventArgs args = new CacheVerifyCompleteEventArgs(wzPackageId, wzPayloadId, hrStatus, recommendation, action);
1437 this.OnCacheVerifyComplete(args);
1438
1439 action = args.Action;
1440 return args.HResult;
1441 }
1442
1443 int IBootstrapperApplication.OnCachePackageComplete(string wzPackageId, int hrStatus, BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION recommendation, ref BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION action)
1444 {
1445 CachePackageCompleteEventArgs args = new CachePackageCompleteEventArgs(wzPackageId, hrStatus, recommendation, action);
1446 this.OnCachePackageComplete(args);
1447
1448 action = args.Action;
1449 return args.HResult;
1450 }
1451
1452 int IBootstrapperApplication.OnCacheComplete(int hrStatus)
1453 {
1454 CacheCompleteEventArgs args = new CacheCompleteEventArgs(hrStatus);
1455 this.OnCacheComplete(args);
1456
1457 return args.HResult;
1458 }
1459
1460 int IBootstrapperApplication.OnExecuteBegin(int cExecutingPackages, ref bool fCancel)
1461 {
1462 ExecuteBeginEventArgs args = new ExecuteBeginEventArgs(cExecutingPackages, fCancel);
1463 this.OnExecuteBegin(args);
1464
1465 args.Cancel = fCancel;
1466 return args.HResult;
1467 }
1468
1469 int IBootstrapperApplication.OnExecutePackageBegin(string wzPackageId, bool fExecute, ref bool fCancel)
1470 {
1471 ExecutePackageBeginEventArgs args = new ExecutePackageBeginEventArgs(wzPackageId, fExecute, fCancel);
1472 this.OnExecutePackageBegin(args);
1473
1474 fCancel = args.Cancel;
1475 return args.HResult;
1476 }
1477
1478 int IBootstrapperApplication.OnExecutePatchTarget(string wzPackageId, string wzTargetProductCode, ref bool fCancel)
1479 {
1480 ExecutePatchTargetEventArgs args = new ExecutePatchTargetEventArgs(wzPackageId, wzTargetProductCode, fCancel);
1481 this.OnExecutePatchTarget(args);
1482
1483 fCancel = args.Cancel;
1484 return args.HResult;
1485 }
1486
1487 int IBootstrapperApplication.OnExecuteProgress(string wzPackageId, int dwProgressPercentage, int dwOverallPercentage, ref bool fCancel)
1488 {
1489 ExecuteProgressEventArgs args = new ExecuteProgressEventArgs(wzPackageId, dwProgressPercentage, dwOverallPercentage, fCancel);
1490 this.OnExecuteProgress(args);
1491
1492 fCancel = args.Cancel;
1493 return args.HResult;
1494 }
1495
1496 int IBootstrapperApplication.OnExecuteMsiMessage(string wzPackageId, InstallMessage messageType, int dwUIHint, string wzMessage, int cData, string[] rgwzData, Result nRecommendation, ref Result pResult)
1497 {
1498 ExecuteMsiMessageEventArgs args = new ExecuteMsiMessageEventArgs(wzPackageId, messageType, dwUIHint, wzMessage, rgwzData, nRecommendation, pResult);
1499 this.OnExecuteMsiMessage(args);
1500
1501 pResult = args.Result;
1502 return args.HResult;
1503 }
1504
1505 int IBootstrapperApplication.OnExecuteFilesInUse(string wzPackageId, int cFiles, string[] rgwzFiles, Result nRecommendation, ref Result pResult)
1506 {
1507 ExecuteFilesInUseEventArgs args = new ExecuteFilesInUseEventArgs(wzPackageId, rgwzFiles, nRecommendation, pResult);
1508 this.OnExecuteFilesInUse(args);
1509
1510 pResult = args.Result;
1511 return args.HResult;
1512 }
1513
1514 int IBootstrapperApplication.OnExecutePackageComplete(string wzPackageId, int hrStatus, ApplyRestart restart, BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION recommendation, ref BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION pAction)
1515 {
1516 ExecutePackageCompleteEventArgs args = new ExecutePackageCompleteEventArgs(wzPackageId, hrStatus, restart, recommendation, pAction);
1517 this.OnExecutePackageComplete(args);
1518
1519 pAction = args.Action;
1520 return args.HResult;
1521 }
1522
1523 int IBootstrapperApplication.OnExecuteComplete(int hrStatus)
1524 {
1525 ExecuteCompleteEventArgs args = new ExecuteCompleteEventArgs(hrStatus);
1526 this.OnExecuteComplete(args);
1527
1528 return args.HResult;
1529 }
1530
1531 int IBootstrapperApplication.OnUnregisterBegin(ref bool fCancel)
1532 {
1533 UnregisterBeginEventArgs args = new UnregisterBeginEventArgs(fCancel);
1534 this.OnUnregisterBegin(args);
1535
1536 fCancel = args.Cancel;
1537 return args.HResult;
1538 }
1539
1540 int IBootstrapperApplication.OnUnregisterComplete(int hrStatus)
1541 {
1542 UnregisterCompleteEventArgs args = new UnregisterCompleteEventArgs(hrStatus);
1543 this.OnUnregisterComplete(args);
1544
1545 return args.HResult;
1546 }
1547
1548 int IBootstrapperApplication.OnApplyComplete(int hrStatus, ApplyRestart restart, BOOTSTRAPPER_APPLYCOMPLETE_ACTION recommendation, ref BOOTSTRAPPER_APPLYCOMPLETE_ACTION pAction)
1549 {
1550 ApplyCompleteEventArgs args = new ApplyCompleteEventArgs(hrStatus, restart, recommendation, pAction);
1551 this.OnApplyComplete(args);
1552
1553 this.applying = false;
1554
1555 pAction = args.Action;
1556 return args.HResult;
1557 }
1558
1559 int IBootstrapperApplication.OnLaunchApprovedExeBegin(ref bool fCancel)
1560 {
1561 LaunchApprovedExeBeginArgs args = new LaunchApprovedExeBeginArgs(fCancel);
1562 this.OnLaunchApprovedExeBegin(args);
1563
1564 fCancel = args.Cancel;
1565 return args.HResult;
1566 }
1567
1568 int IBootstrapperApplication.OnLaunchApprovedExeComplete(int hrStatus, int processId)
1569 {
1570 LaunchApprovedExeCompleteArgs args = new LaunchApprovedExeCompleteArgs(hrStatus, processId);
1571 this.OnLaunchApprovedExeComplete(args);
1572
1573 return args.HResult;
1574 }
1575
1576 int IBootstrapperApplication.BAProc(BOOTSTRAPPER_APPLICATION_MESSAGE message, IntPtr pvArgs, IntPtr pvResults, IntPtr pvContext)
1577 {
1578 switch (message)
1579 {
1580 default:
1581 return NativeMethods.E_NOTIMPL;
1582 }
1583 }
1584
1585 void IBootstrapperApplication.BAProcFallback(BOOTSTRAPPER_APPLICATION_MESSAGE message, IntPtr pvArgs, IntPtr pvResults, ref int phr, IntPtr pvContext)
1586 {
1587 }
1588
1589 #endregion
1590 }
1591}