diff options
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Inscribe')
-rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Inscribe/InscribeMsiPackageCommand.cs | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Inscribe/InscribeMsiPackageCommand.cs b/src/WixToolset.Core.WindowsInstaller/Inscribe/InscribeMsiPackageCommand.cs index 93dd9d3b..f3028fbe 100644 --- a/src/WixToolset.Core.WindowsInstaller/Inscribe/InscribeMsiPackageCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Inscribe/InscribeMsiPackageCommand.cs | |||
@@ -12,7 +12,8 @@ namespace WixToolset.Core.WindowsInstaller.Inscribe | |||
12 | using WixToolset.Core.WindowsInstaller.Bind; | 12 | using WixToolset.Core.WindowsInstaller.Bind; |
13 | using WixToolset.Data; | 13 | using WixToolset.Data; |
14 | using WixToolset.Data.WindowsInstaller; | 14 | using WixToolset.Data.WindowsInstaller; |
15 | using WixToolset.Extensibility; | 15 | using WixToolset.Extensibility.Data; |
16 | using WixToolset.Extensibility.Services; | ||
16 | using WixToolset.Msi; | 17 | using WixToolset.Msi; |
17 | 18 | ||
18 | internal class InscribeMsiPackageCommand | 19 | internal class InscribeMsiPackageCommand |
@@ -20,11 +21,14 @@ namespace WixToolset.Core.WindowsInstaller.Inscribe | |||
20 | public InscribeMsiPackageCommand(IInscribeContext context) | 21 | public InscribeMsiPackageCommand(IInscribeContext context) |
21 | { | 22 | { |
22 | this.Context = context; | 23 | this.Context = context; |
24 | this.Messaging = context.ServiceProvider.GetService<IMessaging>(); | ||
23 | this.TableDefinitions = WindowsInstallerStandardInternal.GetTableDefinitions(); | 25 | this.TableDefinitions = WindowsInstallerStandardInternal.GetTableDefinitions(); |
24 | } | 26 | } |
25 | 27 | ||
26 | private IInscribeContext Context { get; } | 28 | private IInscribeContext Context { get; } |
27 | 29 | ||
30 | private IMessaging Messaging { get; } | ||
31 | |||
28 | private TableDefinitionCollection TableDefinitions { get; } | 32 | private TableDefinitionCollection TableDefinitions { get; } |
29 | 33 | ||
30 | public bool Execute() | 34 | public bool Execute() |
@@ -36,7 +40,7 @@ namespace WixToolset.Core.WindowsInstaller.Inscribe | |||
36 | FileAttributes attributes = File.GetAttributes(this.Context.InputFilePath); | 40 | FileAttributes attributes = File.GetAttributes(this.Context.InputFilePath); |
37 | if (FileAttributes.ReadOnly == (attributes & FileAttributes.ReadOnly)) | 41 | if (FileAttributes.ReadOnly == (attributes & FileAttributes.ReadOnly)) |
38 | { | 42 | { |
39 | this.Context.Messaging.Write(ErrorMessages.ReadOnlyOutputFile(this.Context.InputFilePath)); | 43 | this.Messaging.Write(ErrorMessages.ReadOnlyOutputFile(this.Context.InputFilePath)); |
40 | return shouldCommit; | 44 | return shouldCommit; |
41 | } | 45 | } |
42 | 46 | ||
@@ -179,7 +183,7 @@ namespace WixToolset.Core.WindowsInstaller.Inscribe | |||
179 | // If the cabs aren't there, throw an error but continue to catch the other errors | 183 | // If the cabs aren't there, throw an error but continue to catch the other errors |
180 | if (!File.Exists(cabPath)) | 184 | if (!File.Exists(cabPath)) |
181 | { | 185 | { |
182 | this.Context.Messaging.Write(ErrorMessages.WixFileNotFound(cabPath)); | 186 | this.Messaging.Write(ErrorMessages.WixFileNotFound(cabPath)); |
183 | continue; | 187 | continue; |
184 | } | 188 | } |
185 | 189 | ||
@@ -205,11 +209,11 @@ namespace WixToolset.Core.WindowsInstaller.Inscribe | |||
205 | if ((5 == Environment.OSVersion.Version.Major && 2 == Environment.OSVersion.Version.Minor) || // W2K3 | 209 | if ((5 == Environment.OSVersion.Version.Major && 2 == Environment.OSVersion.Version.Minor) || // W2K3 |
206 | (5 == Environment.OSVersion.Version.Major && 1 == Environment.OSVersion.Version.Minor)) // XP | 210 | (5 == Environment.OSVersion.Version.Major && 1 == Environment.OSVersion.Version.Minor)) // XP |
207 | { | 211 | { |
208 | this.Context.Messaging.Write(ErrorMessages.UnableToGetAuthenticodeCertOfFileDownlevelOS(cabPath, String.Format(CultureInfo.InvariantCulture, "HRESULT: 0x{0:x8}", HResult))); | 212 | this.Messaging.Write(ErrorMessages.UnableToGetAuthenticodeCertOfFileDownlevelOS(cabPath, String.Format(CultureInfo.InvariantCulture, "HRESULT: 0x{0:x8}", HResult))); |
209 | } | 213 | } |
210 | else // otherwise, generic error | 214 | else // otherwise, generic error |
211 | { | 215 | { |
212 | this.Context.Messaging.Write(ErrorMessages.UnableToGetAuthenticodeCertOfFile(cabPath, String.Format(CultureInfo.InvariantCulture, "HRESULT: 0x{0:x8}", HResult))); | 216 | this.Messaging.Write(ErrorMessages.UnableToGetAuthenticodeCertOfFile(cabPath, String.Format(CultureInfo.InvariantCulture, "HRESULT: 0x{0:x8}", HResult))); |
213 | } | 217 | } |
214 | } | 218 | } |
215 | 219 | ||
@@ -252,7 +256,7 @@ namespace WixToolset.Core.WindowsInstaller.Inscribe | |||
252 | 256 | ||
253 | if (digitalCertificateTable.Rows.Count > 0) | 257 | if (digitalCertificateTable.Rows.Count > 0) |
254 | { | 258 | { |
255 | var command = new CreateIdtFileCommand(this.Context.Messaging, digitalCertificateTable, codepage, this.Context.IntermediateFolder, true); | 259 | var command = new CreateIdtFileCommand(this.Messaging, digitalCertificateTable, codepage, this.Context.IntermediateFolder, true); |
256 | command.Execute(); | 260 | command.Execute(); |
257 | 261 | ||
258 | database.Import(command.IdtPath); | 262 | database.Import(command.IdtPath); |
@@ -261,7 +265,7 @@ namespace WixToolset.Core.WindowsInstaller.Inscribe | |||
261 | 265 | ||
262 | if (digitalSignatureTable.Rows.Count > 0) | 266 | if (digitalSignatureTable.Rows.Count > 0) |
263 | { | 267 | { |
264 | var command = new CreateIdtFileCommand(this.Context.Messaging, digitalSignatureTable, codepage, this.Context.IntermediateFolder, true); | 268 | var command = new CreateIdtFileCommand(this.Messaging, digitalSignatureTable, codepage, this.Context.IntermediateFolder, true); |
265 | command.Execute(); | 269 | command.Execute(); |
266 | 270 | ||
267 | database.Import(command.IdtPath); | 271 | database.Import(command.IdtPath); |
@@ -275,7 +279,7 @@ namespace WixToolset.Core.WindowsInstaller.Inscribe | |||
275 | // If we did find external cabs but none of them were signed, give a warning | 279 | // If we did find external cabs but none of them were signed, give a warning |
276 | if (foundUnsignedExternals) | 280 | if (foundUnsignedExternals) |
277 | { | 281 | { |
278 | this.Context.Messaging.Write(WarningMessages.ExternalCabsAreNotSigned(this.Context.InputFilePath)); | 282 | this.Messaging.Write(WarningMessages.ExternalCabsAreNotSigned(this.Context.InputFilePath)); |
279 | } | 283 | } |
280 | 284 | ||
281 | if (shouldCommit) | 285 | if (shouldCommit) |