Marshaling LPBYTE
See the question and my original answer on StackOverflowIt should be
[StructLayout(LayoutKind.Sequential)]
public struct HEXDATA
{
public ushort usLength;
public IntPtr lpbData;
};
pack is in general not needed (in general only if pack is specified on the C/C++ size). There is no string here, so no CharSet is needed either.