diff options
Diffstat (limited to 'src/wix/WixToolset.Core.Burn/Bundles/CreateBundleExeCommand.cs')
-rw-r--r-- | src/wix/WixToolset.Core.Burn/Bundles/CreateBundleExeCommand.cs | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/wix/WixToolset.Core.Burn/Bundles/CreateBundleExeCommand.cs b/src/wix/WixToolset.Core.Burn/Bundles/CreateBundleExeCommand.cs index aed539ae..54f1dfc9 100644 --- a/src/wix/WixToolset.Core.Burn/Bundles/CreateBundleExeCommand.cs +++ b/src/wix/WixToolset.Core.Burn/Bundles/CreateBundleExeCommand.cs | |||
@@ -6,6 +6,7 @@ namespace WixToolset.Core.Burn.Bundles | |||
6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
7 | using System.IO; | 7 | using System.IO; |
8 | using System.Reflection; | 8 | using System.Reflection; |
9 | using System.Runtime.InteropServices; | ||
9 | using System.Text; | 10 | using System.Text; |
10 | using System.Xml; | 11 | using System.Xml; |
11 | using WixToolset.Core.Native; | 12 | using WixToolset.Core.Native; |
@@ -303,17 +304,64 @@ namespace WixToolset.Core.Burn.Bundles | |||
303 | } | 304 | } |
304 | } | 305 | } |
305 | 306 | ||
307 | var splashScreenType = BURN_SPLASH_SCREEN_TYPE.BURN_SPLASH_SCREEN_TYPE_NONE; | ||
308 | |||
306 | if (!String.IsNullOrEmpty(bundleInfo.SplashScreenSourceFile)) | 309 | if (!String.IsNullOrEmpty(bundleInfo.SplashScreenSourceFile)) |
307 | { | 310 | { |
308 | var bitmap = new Dtf.Resources.BitmapResource("#1", burnLocale); | 311 | var bitmap = new Dtf.Resources.BitmapResource("#1", burnLocale); |
309 | bitmap.ReadFromFile(bundleInfo.SplashScreenSourceFile); | 312 | bitmap.ReadFromFile(bundleInfo.SplashScreenSourceFile); |
310 | resources.Add(bitmap); | 313 | resources.Add(bitmap); |
314 | |||
315 | splashScreenType = BURN_SPLASH_SCREEN_TYPE.BURN_SPLASH_SCREEN_TYPE_BITMAP_RESOURCE; | ||
311 | } | 316 | } |
312 | 317 | ||
318 | var splashScreenConfig = new BURN_SPLASH_SCREEN_CONFIGURATION | ||
319 | { | ||
320 | Type = splashScreenType, | ||
321 | ResourceId = 1, | ||
322 | }; | ||
323 | |||
324 | var splashScreenConfigResource = new Dtf.Resources.Resource(ResourceType.RCData, "#1", burnLocale, splashScreenConfig.ToBytes()); | ||
325 | resources.Add(splashScreenConfigResource); | ||
326 | |||
313 | var manifestResource = new Resource(ResourceType.Manifest, "#1", burnLocale, applicationManifestData); | 327 | var manifestResource = new Resource(ResourceType.Manifest, "#1", burnLocale, applicationManifestData); |
314 | resources.Add(manifestResource); | 328 | resources.Add(manifestResource); |
315 | 329 | ||
316 | resources.Save(bundleTempPath); | 330 | resources.Save(bundleTempPath); |
317 | } | 331 | } |
332 | |||
333 | enum BURN_SPLASH_SCREEN_TYPE | ||
334 | { | ||
335 | BURN_SPLASH_SCREEN_TYPE_NONE, | ||
336 | BURN_SPLASH_SCREEN_TYPE_BITMAP_RESOURCE, | ||
337 | } | ||
338 | |||
339 | [StructLayout(LayoutKind.Sequential)] | ||
340 | struct BURN_SPLASH_SCREEN_CONFIGURATION | ||
341 | { | ||
342 | [MarshalAs(UnmanagedType.I4)] | ||
343 | public BURN_SPLASH_SCREEN_TYPE Type; | ||
344 | |||
345 | [MarshalAs(UnmanagedType.U2)] | ||
346 | public UInt16 ResourceId; | ||
347 | |||
348 | public byte[] ToBytes() | ||
349 | { | ||
350 | var cb = Marshal.SizeOf(this); | ||
351 | var data = new byte[cb]; | ||
352 | var pBuffer = Marshal.AllocHGlobal(cb); | ||
353 | |||
354 | try | ||
355 | { | ||
356 | Marshal.StructureToPtr(this, pBuffer, true); | ||
357 | Marshal.Copy(pBuffer, data, 0, cb); | ||
358 | return data; | ||
359 | } | ||
360 | finally | ||
361 | { | ||
362 | Marshal.FreeHGlobal(pBuffer); | ||
363 | } | ||
364 | } | ||
365 | } | ||
318 | } | 366 | } |
319 | } | 367 | } |