Skip to content

Commit

Permalink
Add missing Regions field to DismAppxPackage_
Browse files Browse the repository at this point in the history
This was causing fatal errors when marshalling the struct because the size was off.  Also added a unit test.

Fixes #58
  • Loading branch information
jeffkl committed Jun 26, 2018
1 parent 6993e96 commit b176345
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
42 changes: 42 additions & 0 deletions src/Microsoft.Dism.Tests/GetProvisionedAppxPackagesTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright (c). All rights reserved.
//
// Licensed under the MIT license.

using Shouldly;
using System;
using Xunit;
using Xunit.Abstractions;

namespace Microsoft.Dism.Tests
{
public class GetProvisionedAppxPackagesTest : DismTestBase
{
public GetProvisionedAppxPackagesTest(TestWimTemplate template, ITestOutputHelper testOutput)
: base(template, testOutput)
{
}

[Fact]
public void GetProvisionedAppxPackagesSimple()
{
using (DismSession onlineSession = DismApi.OpenOnlineSession())
{
DismAppxPackageCollection packages = DismApi.GetProvisionedAppxPackages(onlineSession);

packages.ShouldNotBeNull();
packages.Count.ShouldBeGreaterThan(0);

foreach (DismAppxPackage package in packages)
{
package.Architecture.ShouldNotBe(DismProcessorArchitecture.None);
package.DisplayName.ShouldNotBeNullOrWhiteSpace();
package.InstallLocation.ShouldNotBeNullOrWhiteSpace();
package.PackageName.ShouldNotBeNullOrWhiteSpace();
package.PublisherId.ShouldNotBeNullOrWhiteSpace();
package.ResourceId.ShouldNotBeNullOrWhiteSpace();
package.Version.ShouldBeGreaterThan(Version.Parse("0.0.0.0"));
}
}
}
}
}
2 changes: 2 additions & 0 deletions src/Microsoft.Dism/DismAppxPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ internal struct DismAppxPackage_
public string ResourceId;
[MarshalAs(UnmanagedType.LPWStr)]
public string InstallLocation;
[MarshalAs(UnmanagedType.LPWStr)]
public string Regions;
}
#pragma warning restore SA1600 // Elements must be documented
}
Expand Down

0 comments on commit b176345

Please sign in to comment.