diff options
Diffstat (limited to 'src/WixToolset.Core.Burn/Bundles/BurnCommon.cs')
-rw-r--r-- | src/WixToolset.Core.Burn/Bundles/BurnCommon.cs | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/WixToolset.Core.Burn/Bundles/BurnCommon.cs b/src/WixToolset.Core.Burn/Bundles/BurnCommon.cs index 0baa6094..df328eb6 100644 --- a/src/WixToolset.Core.Burn/Bundles/BurnCommon.cs +++ b/src/WixToolset.Core.Burn/Bundles/BurnCommon.cs | |||
@@ -6,6 +6,7 @@ namespace WixToolset.Core.Burn.Bundles | |||
6 | using System.Diagnostics; | 6 | using System.Diagnostics; |
7 | using System.IO; | 7 | using System.IO; |
8 | using WixToolset.Data; | 8 | using WixToolset.Data; |
9 | using WixToolset.Extensibility.Services; | ||
9 | 10 | ||
10 | /// <summary> | 11 | /// <summary> |
11 | /// Common functionality for Burn PE Writer & Reader for the WiX toolset. | 12 | /// Common functionality for Burn PE Writer & Reader for the WiX toolset. |
@@ -77,7 +78,6 @@ namespace WixToolset.Core.Burn.Bundles | |||
77 | 78 | ||
78 | protected const UInt32 BURN_SECTION_MAGIC = 0x00f14300; | 79 | protected const UInt32 BURN_SECTION_MAGIC = 0x00f14300; |
79 | protected const UInt32 BURN_SECTION_VERSION = 0x00000002; | 80 | protected const UInt32 BURN_SECTION_VERSION = 0x00000002; |
80 | |||
81 | protected string fileExe; | 81 | protected string fileExe; |
82 | protected UInt32 peOffset = UInt32.MaxValue; | 82 | protected UInt32 peOffset = UInt32.MaxValue; |
83 | protected UInt16 sections = UInt16.MaxValue; | 83 | protected UInt16 sections = UInt16.MaxValue; |
@@ -103,8 +103,9 @@ namespace WixToolset.Core.Burn.Bundles | |||
103 | /// </summary> | 103 | /// </summary> |
104 | /// <param name="fileExe">File to modify in-place.</param> | 104 | /// <param name="fileExe">File to modify in-place.</param> |
105 | /// <param name="bundleGuid">GUID for the bundle.</param> | 105 | /// <param name="bundleGuid">GUID for the bundle.</param> |
106 | public BurnCommon(string fileExe) | 106 | public BurnCommon(IMessaging messaging, string fileExe) |
107 | { | 107 | { |
108 | this.messaging = messaging; | ||
108 | this.fileExe = fileExe; | 109 | this.fileExe = fileExe; |
109 | } | 110 | } |
110 | 111 | ||
@@ -123,6 +124,8 @@ namespace WixToolset.Core.Burn.Bundles | |||
123 | public UInt32 AttachedContainerAddress { get; protected set; } | 124 | public UInt32 AttachedContainerAddress { get; protected set; } |
124 | public UInt32 AttachedContainerSize { get; protected set; } | 125 | public UInt32 AttachedContainerSize { get; protected set; } |
125 | 126 | ||
127 | protected IMessaging messaging { get; } | ||
128 | |||
126 | public void Dispose() | 129 | public void Dispose() |
127 | { | 130 | { |
128 | Dispose(true); | 131 | Dispose(true); |
@@ -176,21 +179,21 @@ namespace WixToolset.Core.Burn.Bundles | |||
176 | uint32 = BurnCommon.ReadUInt32(bytes, BURN_SECTION_OFFSET_MAGIC); | 179 | uint32 = BurnCommon.ReadUInt32(bytes, BURN_SECTION_OFFSET_MAGIC); |
177 | if (BURN_SECTION_MAGIC != uint32) | 180 | if (BURN_SECTION_MAGIC != uint32) |
178 | { | 181 | { |
179 | Messaging.Instance.OnMessage(WixErrors.InvalidBundle(this.fileExe)); | 182 | this.messaging.Write(ErrorMessages.InvalidBundle(this.fileExe)); |
180 | return false; | 183 | return false; |
181 | } | 184 | } |
182 | 185 | ||
183 | this.Version = BurnCommon.ReadUInt32(bytes, BURN_SECTION_OFFSET_VERSION); | 186 | this.Version = BurnCommon.ReadUInt32(bytes, BURN_SECTION_OFFSET_VERSION); |
184 | if (BURN_SECTION_VERSION != this.Version) | 187 | if (BURN_SECTION_VERSION != this.Version) |
185 | { | 188 | { |
186 | Messaging.Instance.OnMessage(WixErrors.BundleTooNew(this.fileExe, this.Version)); | 189 | this.messaging.Write(ErrorMessages.BundleTooNew(this.fileExe, this.Version)); |
187 | return false; | 190 | return false; |
188 | } | 191 | } |
189 | 192 | ||
190 | uint32 = BurnCommon.ReadUInt32(bytes, BURN_SECTION_OFFSET_FORMAT); // We only know how to deal with CABs right now | 193 | uint32 = BurnCommon.ReadUInt32(bytes, BURN_SECTION_OFFSET_FORMAT); // We only know how to deal with CABs right now |
191 | if (1 != uint32) | 194 | if (1 != uint32) |
192 | { | 195 | { |
193 | Messaging.Instance.OnMessage(WixErrors.InvalidBundle(this.fileExe)); | 196 | this.messaging.Write(ErrorMessages.InvalidBundle(this.fileExe)); |
194 | return false; | 197 | return false; |
195 | } | 198 | } |
196 | 199 | ||
@@ -257,7 +260,7 @@ namespace WixToolset.Core.Burn.Bundles | |||
257 | 260 | ||
258 | if (UInt32.MaxValue == wixburnSectionOffset) | 261 | if (UInt32.MaxValue == wixburnSectionOffset) |
259 | { | 262 | { |
260 | Messaging.Instance.OnMessage(WixErrors.StubMissingWixburnSection(this.fileExe)); | 263 | this.messaging.Write(ErrorMessages.StubMissingWixburnSection(this.fileExe)); |
261 | return false; | 264 | return false; |
262 | } | 265 | } |
263 | 266 | ||
@@ -265,7 +268,7 @@ namespace WixToolset.Core.Burn.Bundles | |||
265 | // the smallest alignment (512 bytes), but just to be paranoid... | 268 | // the smallest alignment (512 bytes), but just to be paranoid... |
266 | if (BURN_SECTION_SIZE > BurnCommon.ReadUInt32(bytes, IMAGE_SECTION_HEADER_OFFSET_SIZEOFRAWDATA)) | 269 | if (BURN_SECTION_SIZE > BurnCommon.ReadUInt32(bytes, IMAGE_SECTION_HEADER_OFFSET_SIZEOFRAWDATA)) |
267 | { | 270 | { |
268 | Messaging.Instance.OnMessage(WixErrors.StubWixburnSectionTooSmall(this.fileExe)); | 271 | this.messaging.Write(ErrorMessages.StubWixburnSectionTooSmall(this.fileExe)); |
269 | return false; | 272 | return false; |
270 | } | 273 | } |
271 | 274 | ||
@@ -294,7 +297,7 @@ namespace WixToolset.Core.Burn.Bundles | |||
294 | // Verify the NT signature... | 297 | // Verify the NT signature... |
295 | if (IMAGE_NT_SIGNATURE != BurnCommon.ReadUInt32(bytes, IMAGE_NT_HEADER_OFFSET_SIGNATURE)) | 298 | if (IMAGE_NT_SIGNATURE != BurnCommon.ReadUInt32(bytes, IMAGE_NT_HEADER_OFFSET_SIGNATURE)) |
296 | { | 299 | { |
297 | Messaging.Instance.OnMessage(WixErrors.InvalidStubExe(this.fileExe)); | 300 | this.messaging.Write(ErrorMessages.InvalidStubExe(this.fileExe)); |
298 | return false; | 301 | return false; |
299 | } | 302 | } |
300 | 303 | ||
@@ -329,7 +332,7 @@ namespace WixToolset.Core.Burn.Bundles | |||
329 | // Verify the DOS 'MZ' signature. | 332 | // Verify the DOS 'MZ' signature. |
330 | if (IMAGE_DOS_SIGNATURE != BurnCommon.ReadUInt16(bytes, IMAGE_DOS_HEADER_OFFSET_MAGIC)) | 333 | if (IMAGE_DOS_SIGNATURE != BurnCommon.ReadUInt16(bytes, IMAGE_DOS_HEADER_OFFSET_MAGIC)) |
331 | { | 334 | { |
332 | Messaging.Instance.OnMessage(WixErrors.InvalidStubExe(this.fileExe)); | 335 | this.messaging.Write(ErrorMessages.InvalidStubExe(this.fileExe)); |
333 | return false; | 336 | return false; |
334 | } | 337 | } |
335 | 338 | ||