All pastes #233255 Raw Edit

Unnamed

public text v1 · immutable
·published 2006-11-01 21:09 UTC
rendered paste body
System.Runtime.InteropServices.MarshalDirectiveException: Can not marshal 'parameter #3': Pointers can not reference marshaled structures. Use byref instead.
  at (wrapper managed-to-native) PaintDotNet.SystemLayer.SafeNativeMethods:GetRegionData (intptr,uint,PaintDotNet.SystemLayer.NativeStructs/RGNDATA*)

[DllImport("Gdi32.dll", SetLastError = true)]
internal unsafe static extern uint GetRegionData(
  IntPtr hRgn,                       // handle to region
  uint dwCount,                      // size of region data buffer
  NativeStructs.RGNDATA *lpRgnData   // region data buffer
);


[StructLayout(LayoutKind.Sequential)]
internal struct RGNDATA
{
  internal RGNDATAHEADER rdh;

  internal unsafe static RECT *GetRectsPointer(RGNDATA *me)
  {
    return (RECT *)((byte *)me + sizeof(RGNDATAHEADER));
  }
}