diff options
author | Luqun Lou <luqunl@users.noreply.github.com> | 2018-08-15 15:52:28 -0700 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2018-08-15 15:52:28 -0700 |
commit | 81455f6fe9e078902f1fb331ae81d85c4d001c5f (patch) | |
tree | f01ab5727f42fe917c8e23705959f70e994fa7f0 | |
parent | 26286b460e53d03ec8b74b85f09c0754bb10605f (diff) | |
download | coreclr-81455f6fe9e078902f1fb331ae81d85c4d001c5f.tar.gz coreclr-81455f6fe9e078902f1fb331ae81d85c4d001c5f.tar.bz2 coreclr-81455f6fe9e078902f1fb331ae81d85c4d001c5f.zip |
Add Public API Marshal.IsTypeVisibleFromCom and Marshal.GetEndComSlot (#19507)
3 files changed, 29 insertions, 1 deletions
diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.cs index 74d1e6e649..e214f1e731 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.cs @@ -1459,6 +1459,12 @@ namespace System.Runtime.InteropServices [MethodImpl(MethodImplOptions.InternalCall)] private static extern object InternalCreateWrapperOfType(object o, Type t); + /// <summary> + /// check if the type is visible from COM. + /// </summary> + [MethodImplAttribute(MethodImplOptions.InternalCall)] + public static extern bool IsTypeVisibleFromCom(Type t); + [MethodImpl(MethodImplOptions.InternalCall)] public static extern int /* HRESULT */ QueryInterface(IntPtr /* IUnknown */ pUnk, ref Guid iid, out IntPtr ppv); @@ -1507,6 +1513,12 @@ namespace System.Runtime.InteropServices /// </summary> [MethodImpl(MethodImplOptions.InternalCall)] public static extern int GetStartComSlot(Type t); + + /// <summary> + /// <para>Returns the last valid COM slot that GetMethodInfoForSlot will work on. </para> + /// </summary> + [MethodImpl(MethodImplOptions.InternalCall)] + public static extern int GetEndComSlot(Type t); #endif // FEATURE_COMINTEROP /// <summary> diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/NonPortable.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/NonPortable.cs index c3403767e1..49047a82ce 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/NonPortable.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/NonPortable.cs @@ -143,6 +143,11 @@ namespace System.Runtime.InteropServices throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); } + public static int GetEndComSlot(Type t) + { + throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); + } + public static Type GetTypeFromCLSID(Guid clsid) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); @@ -168,6 +173,15 @@ namespace System.Runtime.InteropServices return false; } + public static bool IsTypeVisibleFromCom(Type t) + { + if (t == null) + { + throw new ArgumentNullException(nameof(t)); + } + return false; + } + public static int QueryInterface(IntPtr pUnk, ref Guid iid, out IntPtr ppv) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop); diff --git a/src/vm/ecalllist.h b/src/vm/ecalllist.h index 46ee7f8c5f..c147ae716e 100644 --- a/src/vm/ecalllist.h +++ b/src/vm/ecalllist.h @@ -872,13 +872,15 @@ FCFuncStart(gInteropMarshalFuncs) FCFuncElement("GetNativeVariantForObject", MarshalNative::GetNativeVariantForObject) FCFuncElement("GetObjectForNativeVariant", MarshalNative::GetObjectForNativeVariant) FCFuncElement("InternalFinalReleaseComObject", MarshalNative::FinalReleaseComObject) + FCFuncElement("IsTypeVisibleFromCom", MarshalNative::IsTypeVisibleFromCom) FCFuncElement("QueryInterface", MarshalNative::QueryInterface) FCFuncElement("CreateAggregatedObject", MarshalNative::CreateAggregatedObject) FCFuncElement("AreComObjectsAvailableForCleanup", MarshalNative::AreComObjectsAvailableForCleanup) FCFuncElement("InternalCreateWrapperOfType", MarshalNative::InternalCreateWrapperOfType) FCFuncElement("GetObjectsForNativeVariants", MarshalNative::GetObjectsForNativeVariants) FCFuncElement("GetStartComSlot", MarshalNative::GetStartComSlot) - + FCFuncElement("GetEndComSlot", MarshalNative::GetEndComSlot) + FCFuncElement("InitializeManagedWinRTFactoryObject", MarshalNative::InitializeManagedWinRTFactoryObject) FCFuncElement("GetNativeActivationFactory", MarshalNative::GetNativeActivationFactory) |