> Hello I need help to interop this structure in C# to make an wrapper for the
> "InstallApplication" method:
[quoted text clipped - 13 lines]
>
> Unions are hard to interop here, any Idea?
They are not. However, INSTALLSPEC is a little bit hard to deal with.
Untested:
[StructLayout(LayoutKind.Explicit)]
public struct INSTALLSPEC
{
[FieldOffset(0)] [MarshalAs(UnmanagedType.LPWStr)]
public string Name;
[FieldOffset(4)][MarshalAs(UnmanagedType.ByValArray, SizeConst=16)]
public byte[] GPOid;
[FieldOffset(0)] public string FileExt;
// GPOid accessor
public Guid Guid {
get { return new Guid(GPOid); }
set { GPOid = value.ToByteArray(); }
}
}
Though incomplete, this still works, because you don't need
the reserved fields that take the same place or less that
the other fields.
Rob