According to the doc of Marshal.PtrToStructure(IntPtr, Object)
http://msdn.microsoft.com/en-us/library/30ex8z62.aspx
, it throws the ArgumentException that you saw when structure layout is not
sequential or explicit or structure is a boxed value type.

In this case, the structure is declared as sequential, however, the
elements in the array (traceGuidReg[i]) are boxed on the managed heap
because of the array object, thus you got the error "the structure must not
be a value class."

You would need to use the overload Marshal.PtrToStructure Method (IntPtr,
Type)
http://msdn.microsoft.com/en-us/library/4ca6d5z7.aspx
and assign the result of PtrToStructure to the array elements.

public static object PtrToStructure(System.IntPtr ptr, System.Type structureType)
    Member of System.Runtime.InteropServices.Marshal

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-20
  • 2021-06-21
猜你喜欢
  • 2022-12-23
  • 2021-12-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-23
相关资源
相似解决方案