1

Closed

PInvokeStackImbalance with .NET 4

description

The Error is throwing only in Debug-Mode. In the Relase-Mode is no checking for the stack, but it is still an dangerous error.

The reason for this error are in delegate-Declarations.
  • LibVlcInterop.cs, Zeile 139, public delegate int Attach(IntPtr eventManagerInstance, EventTypes eventType, EventCallbackDelegate callback, IntPtr userData);
  • LibVlcInterop.cs, Zeile 149, public delegate void Detach(IntPtr eventManagerInstance, EventTypes eventType, EventCallbackDelegate callback, IntPtr userData);
  • LibVlcInterop.cs, Zeile 157, public delegate IntPtr GetTypeName(EventTypes eventType);
  • LibVlcInterop.cs, Zeile 220, public delegate IntPtr GetIterator(IntPtr logInstance);
  • LibVlcInterop.cs, Zeile 236, public delegate void FreeInstance(IntPtr logIteratorInstance);
  • LibVlcInterop.MediaList.cs, Zeile 99, public delegate IntPtr GetItemAt(IntPtr mediaListInstance, int index);
  • LibVlcInterop.MediaPlayer.cs, Zeile 238, public delegate long GetLength(IntPtr playerInstance);
There is missing the "[UnmanagedFunctionPointer(CallingConvention.Cdecl)]"-Statement.

With best regards
Closed Apr 18 at 9:35 AM by ZeBobo5

comments

FSofT wrote Nov 26, 2013 at 10:59 AM

I hope, this is a complete list of all concerned delegates:
  • LibVlcInterop.cs, Zeile 35, public delegate IntPtr NewInstance(int argsCount, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr)] string[] argv); LibVlcInterop.cs, Zeile 62, public delegate int AddInterface(IntPtr instance, [MarshalAs(UnmanagedType.LPArray)] byte[] name); LibVlcInterop.cs, Zeile 94, public delegate void SetUserAgent(IntPtr instance, [MarshalAs(UnmanagedType.LPArray)] byte[] name, [MarshalAs(UnmanagedType.LPArray)] byte[] http); LibVlcInterop.cs, Zeile 226, public delegate IntPtr GetIterator(IntPtr logInstance); LibVlcInterop.Media.cs, Zeile 196, public delegate IntPtr NewFromLocation(IntPtr instance, [MarshalAs(UnmanagedType.LPStr)] string psz_mrl); LibVlcInterop.MediaPlayer.cs, Zeile 239, public delegate long GetLength(IntPtr playerInstance); LibVlcInterop.cs, Zeile 139, public delegate int Attach(IntPtr eventManagerInstance, EventTypes eventType, EventCallbackDelegate callback, IntPtr userData); LibVlcInterop.cs, Zeile 149, public delegate void Detach(IntPtr eventManagerInstance, EventTypes eventType, EventCallbackDelegate callback, IntPtr userData); LibVlcInterop.cs, Zeile 157, public delegate IntPtr GetTypeName(EventTypes eventType); LibVlcInterop.cs, Zeile 220, public delegate IntPtr GetIterator(IntPtr logInstance); LibVlcInterop.cs, Zeile 236, public delegate void FreeInstance(IntPtr logIteratorInstance); LibVlcInterop.MediaList.cs, Zeile 99, public delegate IntPtr GetItemAt(IntPtr mediaListInstance, int index); LibVlcInterop.MediaPlayer.cs, Zeile 238, public delegate long GetLength(IntPtr playerInstance);