Commit 2c72c26e authored by Stephan Sundermann's avatar Stephan Sundermann Committed by Andrés G. Aragoneses

Windows: Specify CallingConvention everywhere (bgo#751045)

The default CallingConvention is WinAPI, which defaults to
the system's convention which might either be StdCall or CDecl.
For C libraries the CallingConvention to use is CDecl
else strange runtime errors might occur because of stack
corruption.

Since Banshee is using C libraries only, specify the CDecl
CallinvConvention everywhere.

On Windows the MDA in Visual Studio would detect a wrong
calling convention (mono has no such detection).

(We take this opportunity to use const names for libraries
in some DllImport calls which point to the same lib.)
Signed-off-by: 's avatarAndrés G. Aragoneses <knocte@gmail.com>
parent 30a38653
......@@ -228,26 +228,26 @@ namespace Banshee.GStreamer
private delegate void RipperFinishedHandler (IntPtr ripper);
private delegate void RipperErrorHandler (IntPtr ripper, IntPtr error, IntPtr debug);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr br_new (string device, int paranoia_mode, string encoder_pipeline);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void br_destroy (HandleRef handle);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void br_rip_track (HandleRef handle, int track_number, string output_path,
HandleRef tag_list, out bool tagging_supported);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void br_set_progress_callback (HandleRef handle, RipperProgressHandler callback);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void br_set_mimetype_callback (HandleRef handle, RipperMimeTypeHandler callback);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void br_set_finished_callback (HandleRef handle, RipperFinishedHandler callback);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void br_set_error_callback (HandleRef handle, RipperErrorHandler callback);
}
}
......@@ -168,25 +168,25 @@ namespace Banshee.GStreamer
private delegate void BpmDetectorFinishedHandler ();
//private delegate void BpmDetectorErrorHandler (IntPtr error, IntPtr debug);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr bbd_new ();
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bbd_destroy (HandleRef handle);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern bool bbd_get_is_detecting (HandleRef handle);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bbd_process_file (HandleRef handle, IntPtr path);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bbd_set_progress_callback (HandleRef handle, BpmDetectorProgressHandler callback);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bbd_set_finished_callback (HandleRef handle, BpmDetectorFinishedHandler callback);
//[DllImport ("libbanshee.dll")]
//[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
//private static extern void bbd_set_error_callback (HandleRef handle, BpmDetectorErrorHandler callback);
}
}
......@@ -80,6 +80,8 @@ namespace Banshee.GStreamer
public class PlayerEngine : Banshee.MediaEngine.PlayerEngine,
IEqualizer, IVisualizationDataSource, ISupportClutter
{
internal const string LibBansheeLibrary = "libbanshee.dll";
private uint GST_CORE_ERROR = 0;
private uint GST_LIBRARY_ERROR = 0;
private uint GST_RESOURCE_ERROR = 0;
......@@ -927,198 +929,198 @@ namespace Banshee.GStreamer
#endregion
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr bp_new ();
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern bool bp_initialize_pipeline (HandleRef player);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_destroy (HandleRef player);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_set_eos_callback (HandleRef player, BansheePlayerEosCallback cb);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_set_error_callback (HandleRef player, BansheePlayerErrorCallback cb);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_set_vis_data_callback (HandleRef player, BansheePlayerVisDataCallback cb);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_set_state_changed_callback (HandleRef player,
BansheePlayerStateChangedCallback cb);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_set_buffering_callback (HandleRef player,
BansheePlayerBufferingCallback cb);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_set_video_pipeline_setup_callback (HandleRef player,
VideoPipelineSetupHandler cb);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_set_tag_found_callback (HandleRef player,
GstTaggerTagFoundCallback cb);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_set_video_prepare_window_callback (HandleRef player,
VideoPrepareWindowHandler cb);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_set_next_track_starting_callback (HandleRef player,
BansheePlayerNextTrackStartingCallback cb);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_set_about_to_finish_callback (HandleRef player,
BansheePlayerAboutToFinishCallback cb);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern bool bp_open (HandleRef player, IntPtr uri, bool maybeVideo);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_stop (HandleRef player, bool nullstate);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_pause (HandleRef player);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_play (HandleRef player);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern bool bp_set_next_track (HandleRef player, IntPtr uri, bool maybeVideo);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_set_volume (HandleRef player, double volume);
[DllImport("libbanshee.dll")]
[DllImport(PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern double bp_get_volume (HandleRef player);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_set_volume_changed_callback (HandleRef player,
BansheePlayerVolumeChangedCallback cb);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern bool bp_can_seek (HandleRef player);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern bool bp_audiosink_has_volume (HandleRef player);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern bool bp_set_position (HandleRef player, ulong time_ms, bool accurate_seek);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern ulong bp_get_position (HandleRef player);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern ulong bp_get_duration (HandleRef player);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern bool bp_get_pipeline_elements (HandleRef player, out IntPtr playbin,
out IntPtr audiobin, out IntPtr audiotee);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_set_application_gdk_window (HandleRef player, IntPtr window);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern VideoDisplayContextType bp_video_get_display_context_type (HandleRef player);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_video_set_display_context (HandleRef player, IntPtr displayContext);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr bp_video_get_display_context (HandleRef player);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_video_window_expose (HandleRef player, IntPtr displayContext, bool direct);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_video_window_realize (HandleRef player, IntPtr window);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_get_error_quarks (out uint core, out uint library,
out uint resource, out uint stream);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern bool bp_equalizer_is_supported (HandleRef player);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_equalizer_set_preamp_level (HandleRef player, double level);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_equalizer_set_gain (HandleRef player, uint bandnum, double gain);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_equalizer_get_bandrange (HandleRef player, out int min, out int max);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern uint bp_equalizer_get_nbands (HandleRef player);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_equalizer_get_frequencies (HandleRef player,
[MarshalAs (UnmanagedType.LPArray)] out double [] freq);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_replaygain_set_enabled (HandleRef player, bool enabled);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern bool bp_replaygain_get_enabled (HandleRef player);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr clutter_gst_video_sink_new (IntPtr texture);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern int bp_get_subtitle_count (HandleRef player);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_set_subtitle (HandleRef player, int index);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_set_subtitle_uri (HandleRef player, IntPtr uri);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr bp_get_subtitle_uri (HandleRef player);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr bp_get_subtitle_description (HandleRef player, int index);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern string gstreamer_version_string ();
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern bool bp_dvd_is_menu (HandleRef player);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_dvd_mouse_move_notify (HandleRef player, double x, double y);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_dvd_mouse_button_pressed_notify (HandleRef player, int button, double x, double y);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_dvd_mouse_button_released_notify (HandleRef player, int button, double x, double y);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_dvd_left_notify (HandleRef player);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_dvd_right_notify (HandleRef player);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_dvd_up_notify (HandleRef player);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_dvd_down_notify (HandleRef player);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_dvd_activate_notify (HandleRef player);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_dvd_go_to_menu (HandleRef player);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_dvd_go_to_next_chapter (HandleRef player);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bp_dvd_go_to_previous_chapter (HandleRef player);
}
}
......@@ -49,7 +49,7 @@ namespace Banshee.GStreamer
{
}
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void gstreamer_initialize (bool debugging, BansheeLogHandler log_handler);
void IExtensionService.Initialize ()
......@@ -118,7 +118,7 @@ namespace Banshee.GStreamer
args.ProfileAvailable = available;
}
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern bool gstreamer_test_pipeline (IntPtr pipeline);
internal static bool TestPipeline (string pipeline)
......
......@@ -119,16 +119,16 @@ namespace Banshee.GStreamer
get { return handle; }
}
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr bt_tag_list_new ();
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bt_tag_list_free (HandleRef tag_list);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bt_tag_list_add_value (HandleRef tag_list, string tag_name, ref GLib.Value value);
[DllImport ("libbanshee.dll")]
[DllImport (PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void bt_tag_list_add_date (HandleRef tag_list, int year, int month, int day);
}
}
......@@ -171,32 +171,32 @@ namespace Banshee.GStreamer
private delegate void GstTranscoderFinishedCallback(IntPtr transcoder);
private delegate void GstTranscoderErrorCallback(IntPtr transcoder, IntPtr error, IntPtr debug);
[DllImport("libbanshee.dll")]
[DllImport(PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr gst_transcoder_new();
[DllImport("libbanshee.dll")]
[DllImport(PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void gst_transcoder_free(HandleRef handle);
[DllImport("libbanshee.dll")]
[DllImport(PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void gst_transcoder_transcode(HandleRef handle, IntPtr input_uri,
IntPtr output_uri, string encoder_pipeline);
[DllImport("libbanshee.dll")]
[DllImport(PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void gst_transcoder_cancel(HandleRef handle);
[DllImport("libbanshee.dll")]
[DllImport(PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void gst_transcoder_set_progress_callback(HandleRef handle,
GstTranscoderProgressCallback cb);
[DllImport("libbanshee.dll")]
[DllImport(PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void gst_transcoder_set_finished_callback(HandleRef handle,
GstTranscoderFinishedCallback cb);
[DllImport("libbanshee.dll")]
[DllImport(PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern void gst_transcoder_set_error_callback(HandleRef handle,
GstTranscoderErrorCallback cb);
[DllImport("libbanshee.dll")]
[DllImport(PlayerEngine.LibBansheeLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern bool gst_transcoder_get_is_transcoding(HandleRef handle);
}
}
......@@ -318,13 +318,15 @@ namespace Banshee.GStreamerSharp
}
}
[DllImport ("libgdk-3-0.dll")]
private const string LibGdkLibrary = "libgdk-3-0.dll";
[DllImport (LibGdkLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr gdk_quartz_window_get_nsview (IntPtr drawable);
[DllImport ("libgdk-3-0.dll")]
[DllImport (LibGdkLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr gdk_x11_window_get_xid (IntPtr drawable);
[DllImport ("libgdk-3-0.dll")]
[DllImport (LibGdkLibrary, CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr gdk_win32_drawable_get_handle (IntPtr drawable);
public VideoDisplayContextType VideoDisplayContextType {
......
......@@ -58,7 +58,7 @@ namespace Banshee.Hardware.Gio
}
// This was literally copied and pasted from Hal's CdromDevice class.
[DllImport ("libc")]
[DllImport ("libc", CallingConvention = CallingConvention.Cdecl)]
private static extern int ioctl (int device, IoctlOperation request, bool lockdoor);
private enum IoctlOperation {
......
......@@ -41,34 +41,34 @@ namespace Banshee.Hardware.Osx.LowLevel
// Missing pieces that are not present in MonoMac.CoreFoundation
internal class CoreFoundation
{
[DllImport (MonoMac.Constants.CoreFoundationLibrary)]
[DllImport (MonoMac.Constants.CoreFoundationLibrary, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr CFAllocatorGetDefault ();
[DllImport (MonoMac.Constants.CoreFoundationLibrary)]
[DllImport (MonoMac.Constants.CoreFoundationLibrary, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr CFRunLoopGetCurrent ();
[DllImport (MonoMac.Constants.CoreFoundationLibrary)]
[DllImport (MonoMac.Constants.CoreFoundationLibrary, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr CFRunLoopCopyCurrentMode (IntPtr runloop);
[DllImport (MonoMac.Constants.CoreFoundationLibrary)]
[DllImport (MonoMac.Constants.CoreFoundationLibrary, CallingConvention = CallingConvention.Cdecl)]
public static extern void CFRunLoopRun ();
[DllImport (MonoMac.Constants.CoreFoundationLibrary)]
[DllImport (MonoMac.Constants.CoreFoundationLibrary, CallingConvention = CallingConvention.Cdecl)]
public static extern void CFRunLoopStop (IntPtr runloop);
[DllImport (MonoMac.Constants.CoreFoundationLibrary)]
[DllImport (MonoMac.Constants.CoreFoundationLibrary, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr CFURLCopyFileSystemPath (IntPtr url, uint style);
[DllImport (MonoMac.Constants.CoreFoundationLibrary)]
[DllImport (MonoMac.Constants.CoreFoundationLibrary, CallingConvention = CallingConvention.Cdecl)]
public static extern void CFRelease (IntPtr ptr);
[DllImport (MonoMac.Constants.CoreFoundationLibrary)]
[DllImport (MonoMac.Constants.CoreFoundationLibrary, CallingConvention = CallingConvention.Cdecl)]
public static extern bool CFNumberGetValue (IntPtr number, int numberType, out Int32 val);
[DllImport (MonoMac.Constants.CoreFoundationLibrary)]
[DllImport (MonoMac.Constants.CoreFoundationLibrary, CallingConvention = CallingConvention.Cdecl)]
public static extern void CFShow (IntPtr obj);
[DllImport (MonoMac.Constants.CoreFoundationLibrary)]
[DllImport (MonoMac.Constants.CoreFoundationLibrary, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr CFStringCreateWithCString (IntPtr number, string str, int encoding);
}
}
......@@ -33,40 +33,40 @@ namespace Banshee.Hardware.Osx.LowLevel
{
private const string DiskArbitrationLibrary = "/Systems/Library/Frameworks/DiskArbitration.framework/DiskArbitration";
[DllImport (DiskArbitrationLibrary)]
[DllImport (DiskArbitrationLibrary, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr DASessionCreate (IntPtr allocator);
[DllImport (DiskArbitrationLibrary)]
[DllImport (DiskArbitrationLibrary, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr DARegisterDiskAppearedCallback (IntPtr session, IntPtr match, IntPtr callback, IntPtr context);
[DllImport (DiskArbitrationLibrary)]
[DllImport (DiskArbitrationLibrary, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr DARegisterDiskDescriptionChangedCallback (IntPtr session, IntPtr match, IntPtr watch, IntPtr callback, IntPtr context);
[DllImport (DiskArbitrationLibrary)]
[DllImport (DiskArbitrationLibrary, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr DARegisterDiskDisappearedCallback (IntPtr session, IntPtr match, IntPtr callback, IntPtr context);
[DllImport (DiskArbitrationLibrary)]
[DllImport (DiskArbitrationLibrary, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr DAUnregisterCallback (IntPtr session, IntPtr callback, IntPtr context);
[DllImport (DiskArbitrationLibrary)]
[DllImport (DiskArbitrationLibrary, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr DASessionScheduleWithRunLoop (IntPtr session , IntPtr runLoop , IntPtr runloopMode);
[DllImport (DiskArbitrationLibrary)]
[DllImport (DiskArbitrationLibrary, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr DASessionUnscheduleFromRunLoop (IntPtr session , IntPtr runLoop , IntPtr runloopMode);
[DllImport (DiskArbitrationLibrary)]
[DllImport (DiskArbitrationLibrary, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr DADiskCopyDescription (IntPtr disk);
[DllImport (DiskArbitrationLibrary)]
[DllImport (DiskArbitrationLibrary, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr DADiskCopyIOMedia (IntPtr disk);
[DllImport (DiskArbitrationLibrary)]
[DllImport (DiskArbitrationLibrary, CallingConvention = CallingConvention.Cdecl)]
public static extern void DADiskUnmount (IntPtr disk, int unmountOptions, UnmountCallback callback, IntPtr context);
[DllImport (DiskArbitrationLibrary)]
[DllImport (DiskArbitrationLibrary, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr DADiskCreateFromBSDName (IntPtr allocator, IntPtr da_session_ref, string name);
[DllImport (DiskArbitrationLibrary)]
[DllImport (DiskArbitrationLibrary, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr DADiskCreateFromVolumePath (IntPtr allocator, IntPtr da_session_ref, IntPtr urlref);
public delegate void UnmountCallback (IntPtr disk, IntPtr dissenter, IntPtr context);
......
......@@ -86,22 +86,22 @@ namespace Banshee.Hardware.Osx.LowLevel
return ptr;
}
[DllImport (IOKitLibrary)]
[DllImport (IOKitLibrary, CallingConvention = CallingConvention.Cdecl)]
public static extern void IOObjectRelease (IntPtr obj);
[DllImport (IOKitLibrary)]
[DllImport (IOKitLibrary, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr IORegistryEntryCreateCFProperty (IntPtr entry, IntPtr key, IntPtr allocator, uint options);
[DllImport (IOKitLibrary)]
[DllImport (IOKitLibrary, CallingConvention = CallingConvention.Cdecl)]
public static extern void IORegistryEntryGetParentIterator (IntPtr iterator, IntPtr plane, out IntPtr parent);
[DllImport (IOKitLibrary)]
[DllImport (IOKitLibrary, CallingConvention = CallingConvention.Cdecl)]
public static extern void IORegistryEntryGetParentEntry (IntPtr entry, string plane, out IntPtr parent);
[DllImport (IOKitLibrary)]
[DllImport (IOKitLibrary, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr IORegistryEntryFromPath (IntPtr master_port, string path);
[DllImport (IOKitLibrary)]
[DllImport (IOKitLibrary, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr IORegistryEntryGetPath (IntPtr entry, string plane, string path);
}
}
......@@ -77,25 +77,25 @@ namespace OsxIntegration.GtkOsxApplication
private const string GtkMacIntegrationLibrary = "libgtkmacintegration-gtk3.dylib";
[DllImport (GtkMacIntegrationLibrary)]
[DllImport (GtkMacIntegrationLibrary, CallingConvention = CallingConvention.Cdecl)]
protected extern static IntPtr gtkosx_application_get_type ();
[DllImport (GtkMacIntegrationLibrary)]
[DllImport (GtkMacIntegrationLibrary, CallingConvention = CallingConvention.Cdecl)]
protected extern static void gtkosx_application_ready (IntPtr app);
[DllImport (GtkMacIntegrationLibrary)]
[DllImport (GtkMacIntegrationLibrary, CallingConvention = CallingConvention.Cdecl)]
protected extern static void gtkosx_application_set_menu_bar (IntPtr app, IntPtr menu_shell);
[DllImport (GtkMacIntegrationLibrary)]
[DllImport (GtkMacIntegrationLibrary, CallingConvention = CallingConvention.Cdecl)]
protected extern static void gtkosx_application_insert_app_menu_item (IntPtr app, IntPtr menu_item, int index);
[DllImport (GtkMacIntegrationLibrary)]
[DllImport (GtkMacIntegrationLibrary, CallingConvention = CallingConvention.Cdecl)]
protected extern static void gtkosx_application_sync_menubar (IntPtr app);
[DllImport (GtkMacIntegrationLibrary)]
[DllImport (GtkMacIntegrationLibrary, CallingConvention = CallingConvention.Cdecl)]
protected extern static void gtkosx_application_set_dock_menu (IntPtr app, IntPtr menu_shell);
[DllImport (GtkMacIntegrationLibrary)]
[DllImport (GtkMacIntegrationLibrary, CallingConvention = CallingConvention.Cdecl)]
protected extern static void gtkosx_application_set_window_menu (IntPtr app, IntPtr menu_item);
// TODO add more functions from GtkOsxApplication
......
......@@ -38,7 +38,7 @@ namespace Banshee.IO.Unix
{
public class Directory : IDirectory
{