1 /// Copyright 2016 by Samsung Electronics, Inc.,
3 /// This software is the confidential and proprietary information
4 /// of Samsung Electronics, Inc. ("Confidential Information"). You
5 /// shall not disclose such Confidential Information and shall use
6 /// it only in accordance with the terms of the license agreement
7 /// you entered into with Samsung.
11 using System.Runtime.InteropServices;
13 internal static partial class Interop
15 internal static partial class AppControl
17 [DllImport(Libraries.Application, EntryPoint = "app_control_create")]
18 internal static extern int Create(out SafeAppControlHandle handle);
20 [DllImport(Libraries.Application, EntryPoint = "app_control_get_app_id", CallingConvention = CallingConvention.Cdecl)]
21 internal static extern int GetAppId(IntPtr app_control, out IntPtr app_id);
23 [DllImport(Libraries.Application, EntryPoint = "app_control_get_operation", CallingConvention = CallingConvention.Cdecl)]
24 internal static extern int GetOperation(SafeAppControlHandle handle, out string operation);
26 [DllImport(Libraries.Application, EntryPoint = "app_control_get_uri", CallingConvention = CallingConvention.Cdecl)]
27 internal static extern int GetUri(SafeAppControlHandle handle, out string uri);
29 [DllImport(Libraries.Application, EntryPoint = "app_control_get_mime", CallingConvention = CallingConvention.Cdecl)]
30 internal static extern int GetMime(SafeAppControlHandle handle, out string mime);
32 [DllImport(Libraries.Application, EntryPoint = "app_control_destroy", CallingConvention = CallingConvention.Cdecl)]
33 private static extern int DangerousDestroy(IntPtr handle);
35 internal sealed class SafeAppControlHandle : SafeHandle
37 public SafeAppControlHandle() : base(IntPtr.Zero, true)
41 public SafeAppControlHandle(IntPtr handle) : base(handle, false)
45 public override bool IsInvalid
47 get { return this.handle == IntPtr.Zero; }
50 protected override bool ReleaseHandle()
52 AppControl.DangerousDestroy(this.handle);
53 this.SetHandle(IntPtr.Zero);