using System.Runtime.ConstrainedExecution;
#if !MOONLIGHT
+#if !FULL_AOT_RUNTIME
using System.Runtime.InteropServices.ComTypes;
-#endif
-
-#if !MOONLIGHT
using Mono.Interop;
#endif
+#endif
namespace System.Runtime.InteropServices
{
public static readonly int SystemMaxDBCSCharSize = 2; // don't know what this is
public static readonly int SystemDefaultCharSize = Environment.OSVersion.Platform == PlatformID.Win32NT ? 2 : 1;
+#if !MOBILE
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private extern static int AddRefInternal (IntPtr pUnk);
+#endif
public static int AddRef (IntPtr pUnk)
{
+#if !MOBILE
if (pUnk == IntPtr.Zero)
throw new ArgumentException ("Value cannot be null.", "pUnk");
return AddRefInternal (pUnk);
+#else
+ throw new NotImplementedException ();
+#endif
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
throw new NotImplementedException ();
}
-#if !MOONLIGHT
+#if !FULL_AOT_RUNTIME && !MOONLIGHT
public static object CreateWrapperOfType (object o, Type t)
{
__ComObject co = o as __ComObject;
FreeHGlobal (s);
}
-#if !MOONLIGHT
+#if !FULL_AOT_RUNTIME && !MOONLIGHT
public static Guid GenerateGuidForType (Type type)
{
return type.GUID;
throw new NotImplementedException ();
}
+#if !MOBILE
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private extern static IntPtr GetCCW (object o, Type T);
else
return GetCCW (o, T);
}
+#endif
public static IntPtr GetComInterfaceForObject (object o, Type T)
{
+#if !MOBILE
IntPtr pItf = GetComInterfaceForObjectInternal (o, T);
AddRef (pItf);
return pItf;
+#else
+ throw new NotImplementedException ();
+#endif
}
[MonoTODO]
throw new NotSupportedException ("MSDN states user code should never need to call this method.");
}
+#if !MOBILE
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern static int GetComSlotForMethodInfoInternal (MemberInfo m);
+#endif
public static int GetComSlotForMethodInfo (MemberInfo m)
{
+#if !MOBILE
if (m == null)
throw new ArgumentNullException ("m");
if (!(m is MethodInfo))
if (!m.DeclaringType.IsInterface)
throw new ArgumentException ("The MemberInfo must be an interface method.", "m");
return GetComSlotForMethodInfoInternal (m);
+#else
+ throw new NotImplementedException ();
+#endif
}
[MonoTODO]
return m.GetHINSTANCE ();
}
-#endif // !NET_2_1
+#endif // !MOONLIGHT
+#if !FULL_AOT_RUNTIME
[MonoTODO ("SetErrorInfo")]
public static int GetHRForException (Exception e)
{
Marshal.StructureToPtr(vt, pDstNativeVariant, false);
}
+#if !MOBILE
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private static extern object GetObjectForCCW (IntPtr pUnk);
+#endif
public static object GetObjectForIUnknown (IntPtr pUnk)
{
+#if !MOBILE
object obj = GetObjectForCCW (pUnk);
// was not a CCW
if (obj == null) {
obj = proxy.GetTransparentProxy ();
}
return obj;
+#else
+ throw new NotImplementedException ();
+#endif
}
public static object GetObjectForNativeVariant (IntPtr pSrcNativeVariant)
throw new NotImplementedException ();
}
+#if !FULL_AOT_RUNTIME
[Obsolete]
[MonoTODO]
public static string GetTypeInfoName (UCOMITypeInfo pTI)
{
throw new NotImplementedException ();
}
+#endif
[MonoTODO]
[Obsolete ("This method has been deprecated")]
throw new NotImplementedException ();
}
+#if !MOBILE
[MethodImplAttribute (MethodImplOptions.InternalCall)]
public extern static bool IsComObject (object o);
+#else
+ public static bool IsComObject (object o)
+ {
+ throw new NotImplementedException ();
+ }
+#endif
[MonoTODO]
public static bool IsTypeVisibleFromCom (Type t)
throw new NotImplementedException ();
}
#endif // !NET_2_1
+#endif
[MethodImplAttribute(MethodImplOptions.InternalCall)]
[ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public extern static string PtrToStringUni (IntPtr ptr, int len);
+#if !MOBILE
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public extern static string PtrToStringBSTR (IntPtr ptr);
+#else
+ public static string PtrToStringBSTR (IntPtr ptr)
+ {
+ throw new NotImplementedException ();
+ }
+#endif
[MethodImplAttribute(MethodImplOptions.InternalCall)]
[ComVisible (true)]
[ComVisible (true)]
public extern static object PtrToStructure (IntPtr ptr, Type structureType);
+#if !MOBILE
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private extern static int QueryInterfaceInternal (IntPtr pUnk, ref Guid iid, out IntPtr ppv);
+#endif
public static int QueryInterface (IntPtr pUnk, ref Guid iid, out IntPtr ppv)
{
+#if !MOBILE
if (pUnk == IntPtr.Zero)
throw new ArgumentException ("Value cannot be null.", "pUnk");
return QueryInterfaceInternal (pUnk, ref iid, out ppv);
+#else
+ throw new NotImplementedException ();
+#endif
}
public static byte ReadByte (IntPtr ptr)
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public extern static IntPtr ReAllocHGlobal (IntPtr pv, IntPtr cb);
+#if !MOBILE
[ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)]
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private extern static int ReleaseInternal (IntPtr pUnk);
+#endif
[ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
public static int Release (IntPtr pUnk)
{
+#if !MOBILE
if (pUnk == IntPtr.Zero)
throw new ArgumentException ("Value cannot be null.", "pUnk");
+
return ReleaseInternal (pUnk);
+#else
+ throw new NotImplementedException ();
+#endif
}
+#if !FULL_AOT_RUNTIME
#if !MOONLIGHT
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private extern static int ReleaseComObjectInternal (object co);
throw new NotSupportedException ("MSDN states user code should never need to call this method.");
}
#endif // !NET_2_1
+#endif
[ComVisible (true)]
public static int SizeOf (object structure)
return null;
}
+#if !FULL_AOT_RUNTIME
#if !MOONLIGHT
public static int FinalReleaseComObject (object o)
{
while (ReleaseComObject (o) != 0);
return 0;
}
+#endif
#endif
[MethodImplAttribute(MethodImplOptions.InternalCall)]