c# - How to marshal WINBIO_IDENTITY -


winbio_identity confusing structure contains union, , since not experienced c++ programmer , not adept @ interop, cannot figure out how create c# structure can used marshal winbio_identity, , there no tutorials on using wbf in c#.

so far, have attempted looks this:

[structlayout(layoutkind.explicit)] public struct biometricidentity {     [fieldoffset(0)]     public biometricidentitytype type;     [fieldoffset(8)]     public valuestruct value;     [fieldoffset(8)]     public valuestruct2 value2;      [structlayout(layoutkind.explicit)]     public struct valuestruct     {         [fieldoffset(0)]         public int null;          [fieldoffset(0)]         public int wildcard;     }      [structlayout(layoutkind.explicit)]     public struct valuestruct2     {         [fieldoffset(0)]         public nativeguid templateguid;          [fieldoffset(0)]         public accountsid accountsid;     }      [structlayout(layoutkind.sequential)]     public struct accountsid     {         public uint size;          [marshalas(unmanagedtype.byvaltstr, sizeconst = 68)]         public string data;     } } 

for reference, winbio_identity struct looks this:

typedef struct   {     winbio_identity_type type;     union {         ulong null;         ulong wildcard;         guid templateguid;         struct {             ulong size;             uchar data[security_max_sid_size];         } accountsid;     } value; } winbio_identity; 


Comments