diff options
Diffstat (limited to 'src/WixToolset.Core.Burn/Inscribe/InscribeBundleCommand.cs')
-rw-r--r-- | src/WixToolset.Core.Burn/Inscribe/InscribeBundleCommand.cs | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/WixToolset.Core.Burn/Inscribe/InscribeBundleCommand.cs b/src/WixToolset.Core.Burn/Inscribe/InscribeBundleCommand.cs index e87f4360..b466d0de 100644 --- a/src/WixToolset.Core.Burn/Inscribe/InscribeBundleCommand.cs +++ b/src/WixToolset.Core.Burn/Inscribe/InscribeBundleCommand.cs | |||
@@ -1,10 +1,10 @@ | |||
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. | 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 | 2 | ||
3 | namespace WixToolset.Core.Burn.Inscribe | 3 | namespace WixToolset.Core.Burn.Inscribe |
4 | { | 4 | { |
5 | using System.IO; | 5 | using System.IO; |
6 | using WixToolset.Core.Burn.Bundles; | 6 | using WixToolset.Core.Burn.Bundles; |
7 | using WixToolset.Extensibility; | 7 | using WixToolset.Core.Native; |
8 | using WixToolset.Extensibility.Data; | 8 | using WixToolset.Extensibility.Data; |
9 | using WixToolset.Extensibility.Services; | 9 | using WixToolset.Extensibility.Services; |
10 | 10 | ||
@@ -23,19 +23,19 @@ namespace WixToolset.Core.Burn.Inscribe | |||
23 | 23 | ||
24 | public bool Execute() | 24 | public bool Execute() |
25 | { | 25 | { |
26 | bool inscribed = false; | 26 | var inscribed = false; |
27 | string tempFile = Path.Combine(this.Context.IntermediateFolder, "bundle_engine_signed.exe"); | 27 | var tempFile = Path.Combine(this.Context.IntermediateFolder, "bundle_engine_signed.exe"); |
28 | 28 | ||
29 | using (BurnReader reader = BurnReader.Open(this.Context.InputFilePath)) | 29 | using (var reader = BurnReader.Open(this.Context.InputFilePath)) |
30 | { | 30 | { |
31 | File.Copy(this.Context.SignedEngineFile, tempFile, true); | 31 | FileSystem.CopyFile(this.Context.SignedEngineFile, tempFile, allowHardlink: false); |
32 | 32 | ||
33 | // If there was an attached container on the original (unsigned) bundle, put it back. | 33 | // If there was an attached container on the original (unsigned) bundle, put it back. |
34 | if (reader.AttachedContainerSize > 0) | 34 | if (reader.AttachedContainerSize > 0) |
35 | { | 35 | { |
36 | reader.Stream.Seek(reader.AttachedContainerAddress, SeekOrigin.Begin); | 36 | reader.Stream.Seek(reader.AttachedContainerAddress, SeekOrigin.Begin); |
37 | 37 | ||
38 | using (BurnWriter writer = BurnWriter.Open(this.Messaging, tempFile)) | 38 | using (var writer = BurnWriter.Open(this.Messaging, tempFile)) |
39 | { | 39 | { |
40 | writer.RememberThenResetSignature(); | 40 | writer.RememberThenResetSignature(); |
41 | writer.AppendContainer(reader.Stream, reader.AttachedContainerSize, BurnCommon.Container.Attached); | 41 | writer.AppendContainer(reader.Stream, reader.AttachedContainerSize, BurnCommon.Container.Attached); |
@@ -45,13 +45,8 @@ namespace WixToolset.Core.Burn.Inscribe | |||
45 | } | 45 | } |
46 | 46 | ||
47 | Directory.CreateDirectory(Path.GetDirectoryName(this.Context.OutputFile)); | 47 | Directory.CreateDirectory(Path.GetDirectoryName(this.Context.OutputFile)); |
48 | if (File.Exists(this.Context.OutputFile)) | ||
49 | { | ||
50 | File.Delete(this.Context.OutputFile); | ||
51 | } | ||
52 | 48 | ||
53 | File.Move(tempFile, this.Context.OutputFile); | 49 | FileSystem.MoveFile(tempFile, this.Context.OutputFile); |
54 | WixToolset.Core.Native.NativeMethods.ResetAcls(new string[] { this.Context.OutputFile }, 1); | ||
55 | 50 | ||
56 | return inscribed; | 51 | return inscribed; |
57 | } | 52 | } |