summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs')
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs538
1 files changed, 0 insertions, 538 deletions
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs b/src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs
index 3a79650bd9..9e9103b9c2 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs
@@ -19,7 +19,6 @@ namespace System.Runtime.InteropServices
using System.Reflection;
using System.Reflection.Emit;
using System.Security;
- using System.Security.Permissions;
using System.Text;
using System.Threading;
using System.Runtime.Remoting;
@@ -76,7 +75,6 @@ namespace System.Runtime.InteropServices
#endif
}
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
private static bool IsNotWin32Atom(IntPtr ptr)
{
#if FEATURE_PAL
@@ -213,7 +211,6 @@ namespace System.Runtime.InteropServices
//====================================================================
// SizeOf()
//====================================================================
- [System.Runtime.InteropServices.ComVisible(true)]
public static int SizeOf(Object structure)
{
if (structure == null)
@@ -253,7 +250,6 @@ namespace System.Runtime.InteropServices
/// </summary>
/// <typeparam name="T">Provide a value type to figure out its size</typeparam>
/// <returns>The aligned size of T in bytes.</returns>
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
internal static uint AlignedSizeOf<T>() where T : struct
{
uint size = SizeOfType(typeof(T));
@@ -271,13 +267,11 @@ namespace System.Runtime.InteropServices
// Type must be a value type with no object reference fields. We only
// assert this, due to the lack of a suitable generic constraint.
[MethodImpl(MethodImplOptions.InternalCall)]
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
internal static extern uint SizeOfType(Type type);
// Type must be a value type with no object reference fields. We only
// assert this, due to the lack of a suitable generic constraint.
[MethodImpl(MethodImplOptions.InternalCall)]
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
private static extern uint AlignedSizeOfType(Type type);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -470,7 +464,6 @@ namespace System.Runtime.InteropServices
throw new PlatformNotSupportedException();
}
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static unsafe int ReadInt32(IntPtr ptr, int ofs)
{
try
@@ -500,13 +493,11 @@ namespace System.Runtime.InteropServices
}
}
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static int ReadInt32(IntPtr ptr)
{
return ReadInt32(ptr,0);
}
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static IntPtr ReadIntPtr([MarshalAs(UnmanagedType.AsAny),In] Object ptr, int ofs)
{
#if BIT64
@@ -516,7 +507,6 @@ namespace System.Runtime.InteropServices
#endif
}
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static IntPtr ReadIntPtr(IntPtr ptr, int ofs)
{
#if BIT64
@@ -526,7 +516,6 @@ namespace System.Runtime.InteropServices
#endif
}
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static IntPtr ReadIntPtr(IntPtr ptr)
{
#if BIT64
@@ -574,7 +563,6 @@ namespace System.Runtime.InteropServices
}
}
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static long ReadInt64(IntPtr ptr)
{
return ReadInt64(ptr,0);
@@ -768,7 +756,6 @@ namespace System.Runtime.InteropServices
// GetLastWin32Error
//====================================================================
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static extern int GetLastWin32Error();
@@ -776,14 +763,12 @@ namespace System.Runtime.InteropServices
// SetLastWin32Error
//====================================================================
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
internal static extern void SetLastWin32Error(int error);
//====================================================================
// GetHRForLastWin32Error
//====================================================================
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static int GetHRForLastWin32Error()
{
int dwLastError = GetLastWin32Error();
@@ -830,34 +815,6 @@ namespace System.Runtime.InteropServices
}
}
- //====================================================================
- // NumParamBytes
- //====================================================================
- public static int NumParamBytes(MethodInfo m)
- {
- if (m == null)
- throw new ArgumentNullException(nameof(m));
- Contract.EndContractBlock();
-
- RuntimeMethodInfo rmi = m as RuntimeMethodInfo;
- if (rmi == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeMethodInfo"));
-
- return InternalNumParamBytes(rmi);
- }
-
- [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode), SuppressUnmanagedCodeSecurity]
- private static extern int InternalNumParamBytes(IRuntimeMethodInfo m);
-
- //====================================================================
- // Win32 Exception stuff
- // These are mostly interesting for Structured exception handling,
- // but need to be exposed for all exceptions (not just SEHException).
- //====================================================================
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- [System.Runtime.InteropServices.ComVisible(true)]
- public static extern /* struct _EXCEPTION_POINTERS* */ IntPtr GetExceptionPointers();
-
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public static extern int GetExceptionCode();
@@ -868,7 +825,6 @@ namespace System.Runtime.InteropServices
// "fDeleteOld" is true, this routine will call DestroyStructure() first.
//====================================================================
[MethodImplAttribute(MethodImplOptions.InternalCall), ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
- [System.Runtime.InteropServices.ComVisible(true)]
public static extern void StructureToPtr(Object structure, IntPtr ptr, bool fDeleteOld);
public static void StructureToPtr<T>(T structure, IntPtr ptr, bool fDeleteOld)
@@ -879,7 +835,6 @@ namespace System.Runtime.InteropServices
//====================================================================
// Marshals data from a native memory block to a preallocated structure class.
//====================================================================
- [System.Runtime.InteropServices.ComVisible(true)]
public static void PtrToStructure(IntPtr ptr, Object structure)
{
PtrToStructureHelper(ptr, structure, false);
@@ -894,7 +849,6 @@ namespace System.Runtime.InteropServices
// Creates a new instance of "structuretype" and marshals data from a
// native memory block to it.
//====================================================================
- [System.Runtime.InteropServices.ComVisible(true)]
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
public static Object PtrToStructure(IntPtr ptr, Type structureType)
{
@@ -935,7 +889,6 @@ namespace System.Runtime.InteropServices
// "structureclass" is used to provide layout information.
//====================================================================
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- [System.Runtime.InteropServices.ComVisible(true)]
public static extern void DestroyStructure(IntPtr ptr, Type structuretype);
public static void DestroyStructure<T>(IntPtr ptr)
@@ -1015,45 +968,8 @@ namespace System.Runtime.InteropServices
//====================================================================
- // This method is intended for compiler code generators rather
- // than applications.
- //====================================================================
- [ObsoleteAttribute("The GetUnmanagedThunkForManagedMethodPtr method has been deprecated and will be removed in a future release.", false)]
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- public static extern IntPtr GetUnmanagedThunkForManagedMethodPtr(IntPtr pfnMethodToWrap, IntPtr pbSignature, int cbSignature);
-
- //====================================================================
- // This method is intended for compiler code generators rather
- // than applications.
- //====================================================================
- [ObsoleteAttribute("The GetManagedThunkForUnmanagedMethodPtr method has been deprecated and will be removed in a future release.", false)]
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- public static extern IntPtr GetManagedThunkForUnmanagedMethodPtr(IntPtr pfnMethodToWrap, IntPtr pbSignature, int cbSignature);
-
- //====================================================================
- // The hosting APIs allow a sophisticated host to schedule fibers
- // onto OS threads, so long as they notify the runtime of this
- // activity. A fiber cookie can be redeemed for its managed Thread
- // object by calling the following service.
- //====================================================================
- [ObsoleteAttribute("The GetThreadFromFiberCookie method has been deprecated. Use the hosting API to perform this operation.", false)]
- public static Thread GetThreadFromFiberCookie(int cookie)
- {
- if (cookie == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_ArgumentZero"), nameof(cookie));
- Contract.EndContractBlock();
-
- return InternalGetThreadFromFiberCookie(cookie);
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private static extern Thread InternalGetThreadFromFiberCookie(int cookie);
-
-
- //====================================================================
// Memory allocation and deallocation.
//====================================================================
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
public static IntPtr AllocHGlobal(IntPtr cb)
{
// For backwards compatibility on 32 bit platforms, ensure we pass values between
@@ -1077,13 +993,11 @@ namespace System.Runtime.InteropServices
return pNewMem;
}
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
public static IntPtr AllocHGlobal(int cb)
{
return AllocHGlobal((IntPtr)cb);
}
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static void FreeHGlobal(IntPtr hglobal)
{
if (IsNotWin32Atom(hglobal)) {
@@ -1192,185 +1106,6 @@ namespace System.Runtime.InteropServices
internal static extern int GetHRForException_WinRT(Exception e);
internal static readonly Guid ManagedNameGuid = new Guid("{0F21F359-AB84-41E8-9A78-36D110E6D2F9}");
-
- //====================================================================
- // Given a managed object that wraps a UCOMITypeLib, return its name
- //====================================================================
- [Obsolete("Use System.Runtime.InteropServices.Marshal.GetTypeLibName(ITypeLib pTLB) instead. http://go.microsoft.com/fwlink/?linkid=14202&ID=0000011.", false)]
- public static String GetTypeLibName(UCOMITypeLib pTLB)
- {
- return GetTypeLibName((ITypeLib)pTLB);
- }
-
-
- //====================================================================
- // Given a managed object that wraps an ITypeLib, return its name
- //====================================================================
- public static String GetTypeLibName(ITypeLib typelib)
- {
- if (typelib == null)
- throw new ArgumentNullException(nameof(typelib));
- Contract.EndContractBlock();
-
- String strTypeLibName = null;
- String strDocString = null;
- int dwHelpContext = 0;
- String strHelpFile = null;
-
- typelib.GetDocumentation(-1, out strTypeLibName, out strDocString, out dwHelpContext, out strHelpFile);
-
- return strTypeLibName;
- }
-
- //====================================================================
- // Internal version of GetTypeLibName
- // Support GUID_ManagedName which aligns with TlbImp
- //====================================================================
- internal static String GetTypeLibNameInternal(ITypeLib typelib)
- {
- if (typelib == null)
- throw new ArgumentNullException(nameof(typelib));
- Contract.EndContractBlock();
-
- // Try GUID_ManagedName first
- ITypeLib2 typeLib2 = typelib as ITypeLib2;
- if (typeLib2 != null)
- {
- Guid guid = ManagedNameGuid;
- object val;
-
- try
- {
- typeLib2.GetCustData(ref guid, out val);
- }
- catch(Exception)
- {
- val = null;
- }
-
- if (val != null && val.GetType() == typeof(string))
- {
- string customManagedNamespace = (string)val;
- customManagedNamespace = customManagedNamespace.Trim();
- if (customManagedNamespace.EndsWith(".DLL", StringComparison.OrdinalIgnoreCase))
- customManagedNamespace = customManagedNamespace.Substring(0, customManagedNamespace.Length - 4);
- else if (customManagedNamespace.EndsWith(".EXE", StringComparison.OrdinalIgnoreCase))
- customManagedNamespace = customManagedNamespace.Substring(0, customManagedNamespace.Length - 4);
- return customManagedNamespace;
- }
- }
-
- return GetTypeLibName(typelib);
- }
-
-
- //====================================================================
- // Given an managed object that wraps an UCOMITypeLib, return its guid
- //====================================================================
- [Obsolete("Use System.Runtime.InteropServices.Marshal.GetTypeLibGuid(ITypeLib pTLB) instead. http://go.microsoft.com/fwlink/?linkid=14202&ID=0000011.", false)]
- public static Guid GetTypeLibGuid(UCOMITypeLib pTLB)
- {
- return GetTypeLibGuid((ITypeLib)pTLB);
- }
-
- //====================================================================
- // Given an managed object that wraps an ITypeLib, return its guid
- //====================================================================
- public static Guid GetTypeLibGuid(ITypeLib typelib)
- {
- Guid result = new Guid ();
- FCallGetTypeLibGuid (ref result, typelib);
- return result;
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private static extern void FCallGetTypeLibGuid(ref Guid result, ITypeLib pTLB);
-
- //====================================================================
- // Given a managed object that wraps a UCOMITypeLib, return its lcid
- //====================================================================
- [Obsolete("Use System.Runtime.InteropServices.Marshal.GetTypeLibLcid(ITypeLib pTLB) instead. http://go.microsoft.com/fwlink/?linkid=14202&ID=0000011.", false)]
- public static int GetTypeLibLcid(UCOMITypeLib pTLB)
- {
- return GetTypeLibLcid((ITypeLib)pTLB);
- }
-
- //====================================================================
- // Given a managed object that wraps an ITypeLib, return its lcid
- //====================================================================
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- public static extern int GetTypeLibLcid(ITypeLib typelib);
-
- //====================================================================
- // Given a managed object that wraps an ITypeLib, return it's
- // version information.
- //====================================================================
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal static extern void GetTypeLibVersion(ITypeLib typeLibrary, out int major, out int minor);
-
- //====================================================================
- // Given a managed object that wraps an ITypeInfo, return its guid.
- //====================================================================
- internal static Guid GetTypeInfoGuid(ITypeInfo typeInfo)
- {
- Guid result = new Guid ();
- FCallGetTypeInfoGuid (ref result, typeInfo);
- return result;
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private static extern void FCallGetTypeInfoGuid(ref Guid result, ITypeInfo typeInfo);
-
- //====================================================================
- // Given a assembly, return the TLBID that will be generated for the
- // typelib exported from the assembly.
- //====================================================================
- public static Guid GetTypeLibGuidForAssembly(Assembly asm)
- {
- if (asm == null)
- throw new ArgumentNullException(nameof(asm));
- Contract.EndContractBlock();
-
- RuntimeAssembly rtAssembly = asm as RuntimeAssembly;
- if (rtAssembly == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeAssembly"), nameof(asm));
-
- Guid result = new Guid();
- FCallGetTypeLibGuidForAssembly(ref result, rtAssembly);
- return result;
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private static extern void FCallGetTypeLibGuidForAssembly(ref Guid result, RuntimeAssembly asm);
-
- //====================================================================
- // Given a assembly, return the version number of the type library
- // that would be exported from the assembly.
- //====================================================================
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private static extern void _GetTypeLibVersionForAssembly(RuntimeAssembly inputAssembly, out int majorVersion, out int minorVersion);
-
- public static void GetTypeLibVersionForAssembly(Assembly inputAssembly, out int majorVersion, out int minorVersion)
- {
- if (inputAssembly == null)
- throw new ArgumentNullException(nameof(inputAssembly));
- Contract.EndContractBlock();
-
- RuntimeAssembly rtAssembly = inputAssembly as RuntimeAssembly;
- if (rtAssembly == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeAssembly"), nameof(inputAssembly));
-
- _GetTypeLibVersionForAssembly(rtAssembly, out majorVersion, out minorVersion);
- }
-
- //====================================================================
- // Given a managed object that wraps an UCOMITypeInfo, return its name
- //====================================================================
- [Obsolete("Use System.Runtime.InteropServices.Marshal.GetTypeInfoName(ITypeInfo pTLB) instead. http://go.microsoft.com/fwlink/?linkid=14202&ID=0000011.", false)]
- public static String GetTypeInfoName(UCOMITypeInfo pTI)
- {
- return GetTypeInfoName((ITypeInfo)pTI);
- }
//====================================================================
// Given a managed object that wraps an ITypeInfo, return its name
@@ -1391,65 +1126,6 @@ namespace System.Runtime.InteropServices
return strTypeLibName;
}
- //====================================================================
- // Internal version of GetTypeInfoName
- // Support GUID_ManagedName which aligns with TlbImp
- //====================================================================
- internal static String GetTypeInfoNameInternal(ITypeInfo typeInfo, out bool hasManagedName)
- {
- if (typeInfo == null)
- throw new ArgumentNullException(nameof(typeInfo));
- Contract.EndContractBlock();
-
- // Try ManagedNameGuid first
- ITypeInfo2 typeInfo2 = typeInfo as ITypeInfo2;
- if (typeInfo2 != null)
- {
- Guid guid = ManagedNameGuid;
- object val;
-
- try
- {
- typeInfo2.GetCustData(ref guid, out val);
- }
- catch(Exception)
- {
- val = null;
- }
-
- if (val != null && val.GetType() == typeof(string))
- {
- hasManagedName = true;
- return (string)val;
- }
- }
-
- hasManagedName = false;
- return GetTypeInfoName(typeInfo);
- }
-
- //====================================================================
- // Get the corresponding managed name as converted by TlbImp
- // Used to get the type using GetType() from imported assemblies
- //====================================================================
- internal static String GetManagedTypeInfoNameInternal(ITypeLib typeLib, ITypeInfo typeInfo)
- {
- bool hasManagedName;
- string name = GetTypeInfoNameInternal(typeInfo, out hasManagedName);
- if (hasManagedName)
- return name;
- else
- return GetTypeLibNameInternal(typeLib) + "." + name;
- }
-
- //====================================================================
- // If a type with the specified GUID is loaded, this method will
- // return the reflection type that represents it. Otherwise it returns
- // NULL.
- //====================================================================
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private static extern Type GetLoadedTypeForGUID(ref Guid guid);
-
// This method is identical to Type.GetTypeFromCLSID. Since it's interop specific, we expose it
// on Marshal for more consistent API surface.
public static Type GetTypeFromCLSID(Guid clsid)
@@ -1458,12 +1134,6 @@ namespace System.Runtime.InteropServices
}
//====================================================================
- // map Type to ITypeInfo*
- //====================================================================
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- public static extern IntPtr /* ITypeInfo* */ GetITypeInfoForType(Type t);
-
- //====================================================================
// return the IUnknown* for an Object if the current context
// is the one where the RCW was first seen. Will return null
// otherwise.
@@ -1473,11 +1143,6 @@ namespace System.Runtime.InteropServices
return GetIUnknownForObjectNative(o, false);
}
- public static IntPtr /* IUnknown* */ GetIUnknownForObjectInContext(Object o)
- {
- return GetIUnknownForObjectNative(o, true);
- }
-
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern IntPtr /* IUnknown* */ GetIUnknownForObjectNative(Object o, bool onlyInContext);
@@ -1499,18 +1164,6 @@ namespace System.Runtime.InteropServices
}
#if FEATURE_COMINTEROP
- //====================================================================
- // return the IDispatch* for an Object if the current context
- // is the one where the RCW was first seen. Will return null
- // otherwise.
- //====================================================================
- public static IntPtr /* IUnknown* */ GetIDispatchForObjectInContext(Object o)
- {
- return GetIDispatchForObjectNative(o, true);
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private static extern IntPtr /* IUnknown* */ GetIDispatchForObjectNative(Object o, bool onlyInContext);
//====================================================================
// return the IUnknown* representing the interface for the Object
@@ -1537,17 +1190,6 @@ namespace System.Runtime.InteropServices
return GetComInterfaceForObjectNative(o, T, false, bEnableCustomizedQueryInterface);
}
- //====================================================================
- // return the IUnknown* representing the interface for the Object
- // Object o should support Type T if the current context
- // is the one where the RCW was first seen. Will return null
- // otherwise.
- //====================================================================
- public static IntPtr /* IUnknown* */ GetComInterfaceForObjectInContext(Object o, Type t)
- {
- return GetComInterfaceForObjectNative(o, t, true, true);
- }
-
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern IntPtr /* IUnknown* */ GetComInterfaceForObjectNative(Object o, Type t, bool onlyInContext, bool fEnalbeCustomizedQueryInterface);
@@ -1892,21 +1534,6 @@ namespace System.Runtime.InteropServices
private static extern Object InternalCreateWrapperOfType(Object o, Type t);
//====================================================================
- // There may be a thread-based cache of COM components. This service can
- // force the aggressive release of the current thread's cache.
- //====================================================================
- [Obsolete("This API did not perform any operation and will be removed in future versions of the CLR.", false)]
- public static void ReleaseThreadCache()
- {
- }
-
- //====================================================================
- // check if the type is visible from COM.
- //====================================================================
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- public static extern bool IsTypeVisibleFromCom(Type t);
-
- //====================================================================
// IUnknown Helpers
//====================================================================
[MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -1915,7 +1542,6 @@ namespace System.Runtime.InteropServices
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public static extern int /* ULONG */ AddRef(IntPtr /* IUnknown */ pUnk );
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static extern int /* ULONG */ Release(IntPtr /* IUnknown */ pUnk );
[MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -1958,45 +1584,6 @@ namespace System.Runtime.InteropServices
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public static extern int GetStartComSlot(Type t);
- /// <summary>
- /// <para>Returns the last valid COM slot that GetMethodInfoForSlot will work on. </para>
- /// </summary>
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- public static extern int GetEndComSlot(Type t);
-
- /// <summary>
- /// <para>Returns the MemberInfo that COM callers calling through the exposed
- /// vtable on the given slot will be calling. The slot should take into account
- /// if the exposed interface is IUnknown based or IDispatch based.
- /// For classes, the lookup is done on the default interface that will be
- /// exposed for the class. </para>
- /// </summary>
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- public static extern MemberInfo GetMethodInfoForComSlot(Type t, int slot, ref ComMemberType memberType);
-
- /// <summary>
- /// <para>Returns the COM slot for a memeber info, taking into account whether
- /// the exposed interface is IUnknown based or IDispatch based</para>
- /// </summary>
- public static int GetComSlotForMethodInfo(MemberInfo m)
- {
- if (m== null)
- throw new ArgumentNullException(nameof(m));
-
- if (!(m is RuntimeMethodInfo))
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeMethodInfo"), nameof(m));
-
- if (!m.DeclaringType.IsInterface)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeInterfaceMethod"), nameof(m));
- if (m.DeclaringType.IsGenericType)
- throw new ArgumentException(Environment.GetResourceString("Argument_NeedNonGenericType"), nameof(m));
- Contract.EndContractBlock();
-
- return InternalGetComSlotForMethodInfo((IRuntimeMethodInfo)m);
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private static extern int InternalGetComSlotForMethodInfo(IRuntimeMethodInfo m);
#endif // FEATURE_COMINTEROP
//====================================================================
@@ -2069,38 +1656,6 @@ namespace System.Runtime.InteropServices
return obj;
}
- //====================================================================
- // This method gets the currently running object.
- //====================================================================
- public static Object GetActiveObject(String progID)
- {
- Object obj = null;
- Guid clsid;
-
- // Call CLSIDFromProgIDEx first then fall back on CLSIDFromProgID if
- // CLSIDFromProgIDEx doesn't exist.
- try
- {
- CLSIDFromProgIDEx(progID, out clsid);
- }
-// catch
- catch(Exception)
- {
- CLSIDFromProgID(progID, out clsid);
- }
-
- GetActiveObject(ref clsid, IntPtr.Zero, out obj);
- return obj;
- }
-
- [DllImport(Microsoft.Win32.Win32Native.OLE32, PreserveSig = false)]
- [SuppressUnmanagedCodeSecurity]
- private static extern void CLSIDFromProgIDEx([MarshalAs(UnmanagedType.LPWStr)] String progId, out Guid clsid);
-
- [DllImport(Microsoft.Win32.Win32Native.OLE32, PreserveSig = false)]
- [SuppressUnmanagedCodeSecurity]
- private static extern void CLSIDFromProgID([MarshalAs(UnmanagedType.LPWStr)] String progId, out Guid clsid);
-
[DllImport(Microsoft.Win32.Win32Native.OLE32, PreserveSig = false)]
[SuppressUnmanagedCodeSecurity]
private static extern void CreateBindCtx(UInt32 reserved, out IBindCtx ppbc);
@@ -2113,19 +1668,6 @@ namespace System.Runtime.InteropServices
[SuppressUnmanagedCodeSecurity]
private static extern void BindMoniker(IMoniker pmk, UInt32 grfOpt, ref Guid iidResult, [MarshalAs(UnmanagedType.Interface)] out Object ppvResult);
- [DllImport(Microsoft.Win32.Win32Native.OLEAUT32, PreserveSig = false)]
- [SuppressUnmanagedCodeSecurity]
- private static extern void GetActiveObject(ref Guid rclsid, IntPtr reserved, [MarshalAs(UnmanagedType.Interface)] out Object ppunk);
-
- //========================================================================
- // Private method called from remoting to support ServicedComponents.
- //========================================================================
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal static extern bool InternalSwitchCCW(Object oldtp, Object newtp);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal static extern Object InternalWrapIUnknownWithComObject(IntPtr i);
-
//========================================================================
// Private method called from EE upon use of license/ICF2 marshaling.
//========================================================================
@@ -2156,86 +1698,6 @@ namespace System.Runtime.InteropServices
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern object GetNativeActivationFactory(Type type);
- //========================================================================
- // Methods allowing retrieval of the IIDs exposed by an underlying WinRT
- // object, as specified by the object's IInspectable::GetIids()
- //========================================================================
- [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode), SuppressUnmanagedCodeSecurity]
- private static extern void _GetInspectableIids(ObjectHandleOnStack obj, ObjectHandleOnStack guids);
-
- internal static System.Guid[] GetInspectableIids(object obj)
- {
- System.Guid[] result = null;
- System.__ComObject comObj = obj as System.__ComObject;
- if (comObj != null)
- {
- _GetInspectableIids(JitHelpers.GetObjectHandleOnStack(ref comObj),
- JitHelpers.GetObjectHandleOnStack(ref result));
- }
-
- return result;
- }
-
- //========================================================================
- // Methods allowing retrieval of the cached WinRT type corresponding to
- // the specified GUID
- //========================================================================
- [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode), SuppressUnmanagedCodeSecurity]
- private static extern void _GetCachedWinRTTypeByIid(
- ObjectHandleOnStack appDomainObj,
- System.Guid iid,
- out IntPtr rthHandle);
-
- internal static System.Type GetCachedWinRTTypeByIid(
- System.AppDomain ad,
- System.Guid iid)
- {
- IntPtr rthHandle;
- _GetCachedWinRTTypeByIid(JitHelpers.GetObjectHandleOnStack(ref ad),
- iid,
- out rthHandle);
- System.Type res = Type.GetTypeFromHandleUnsafe(rthHandle);
- return res;
- }
-
-
- //========================================================================
- // Methods allowing retrieval of the WinRT types cached in the specified
- // app domain
- //========================================================================
- [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode), SuppressUnmanagedCodeSecurity]
- private static extern void _GetCachedWinRTTypes(
- ObjectHandleOnStack appDomainObj,
- ref int epoch,
- ObjectHandleOnStack winrtTypes);
-
- internal static System.Type[] GetCachedWinRTTypes(
- System.AppDomain ad,
- ref int epoch)
- {
- System.IntPtr[] res = null;
-
- _GetCachedWinRTTypes(JitHelpers.GetObjectHandleOnStack(ref ad),
- ref epoch,
- JitHelpers.GetObjectHandleOnStack(ref res));
-
- System.Type[] result = new System.Type[res.Length];
- for (int i = 0; i < res.Length; ++i)
- {
- result[i] = Type.GetTypeFromHandleUnsafe(res[i]);
- }
-
- return result;
- }
-
- internal static System.Type[] GetCachedWinRTTypes(
- System.AppDomain ad)
- {
- int dummyEpoch = 0;
- return GetCachedWinRTTypes(ad, ref dummyEpoch);
- }
-
-
#endif // FEATURE_COMINTEROP
public static Delegate GetDelegateForFunctionPointer(IntPtr ptr, Type t)