Fixed alignment of SET_VIRTUAL_DISK_INFO (#356)

pull/363/head
David Hall 2022-12-21 20:29:15 -07:00
parent 97c6db5d9d
commit 5c48d15f84
2 changed files with 10 additions and 8 deletions

View File

@ -2505,20 +2505,16 @@ namespace Vanara.PInvoke
// ULONG ChildDepth; PCWSTR ParentFilePath; } ParentPathWithDepthInfo; ULONG VhdPhysicalSectorSize; GUID VirtualDiskId; BOOL
// ChangeTrackingEnabled; struct { GUID LinkageId; PCWSTR ParentFilePath; } ParentLocator; }; } SET_VIRTUAL_DISK_INFO, *PSET_VIRTUAL_DISK_INFO;
[PInvokeData("virtdisk.h", MSDNShortId = "NS:virtdisk._SET_VIRTUAL_DISK_INFO")]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode,
#if x64
Pack = 8
#else
Pack = 4
#endif
)]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SET_VIRTUAL_DISK_INFO
{
private IntPtr ver;
/// <summary>
/// A SET_VIRTUAL_DISK_INFO_VERSION enumeration that specifies the version of the SET_VIRTUAL_DISK_INFO structure being passed to
/// or from the VHD functions. This determines the type of information set.
/// </summary>
public SET_VIRTUAL_DISK_INFO_VERSION Version;
public SET_VIRTUAL_DISK_INFO_VERSION Version { get => (SET_VIRTUAL_DISK_INFO_VERSION)ver.ToInt32(); set => ver = new((int)value); }
private UNION union;

View File

@ -14,6 +14,12 @@ namespace Vanara.PInvoke.Tests
private static readonly string tmpcfn = Vanara.PInvoke.Tests.TestCaseSources.TempDirWhack + "TestVHD - Diff.vhdx";
private static readonly string tmpfn = Vanara.PInvoke.Tests.TestCaseSources.TempDirWhack + "TestVHD.vhdx";
[Test]
public void _StructTest()
{
TestHelper.DumpStructSizeAndOffsets<SET_VIRTUAL_DISK_INFO>();
}
[Test()]
public void AttachVirtualDiskTest()
{