Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2017-10-18 03:39:13 +0300
committerGitHub <noreply@github.com>2017-10-18 03:39:13 +0300
commit53f2da1da47159b7b4dd39de53e0887ab9a013e8 (patch)
tree1008c137f87955ed7c5b482219b850455a5ec48e /src/System.Private.Interop
parent1fca2dfcbc764702cc6a100d2edabc205069b8e5 (diff)
parent22d3a015a8240a03d4a5237968ea7997647ecaa5 (diff)
Merge pull request #4747 from dotnet/nmirror
Merge nmirror to master
Diffstat (limited to 'src/System.Private.Interop')
-rw-r--r--src/System.Private.Interop/src/Interop/Interop.PlatformNotSupported.cs5
-rw-r--r--src/System.Private.Interop/src/Shared/McgComHelpers.cs12
-rw-r--r--src/System.Private.Interop/src/Shared/McgIntrinsics.cs80
-rw-r--r--src/System.Private.Interop/src/Shared/McgMarshal.cs28
-rw-r--r--src/System.Private.Interop/src/Shared/McgTypeHelpers.cs6
-rw-r--r--src/System.Private.Interop/src/Shared/RCWWalker.cs12
-rw-r--r--src/System.Private.Interop/src/Shared/StandardInterfaces.cs18
-rw-r--r--src/System.Private.Interop/src/Shared/__ComObject.cs4
-rw-r--r--src/System.Private.Interop/src/System/Runtime/InteropServices/ComWeakReferenceHelpers.cs2
-rw-r--r--src/System.Private.Interop/src/System/Runtime/InteropServices/Marshal.cs2
-rw-r--r--src/System.Private.Interop/src/System/Runtime/InteropServices/MarshalImpl.cs7
-rw-r--r--src/System.Private.Interop/src/WinRT/ExceptionHelpers.cs6
12 files changed, 90 insertions, 92 deletions
diff --git a/src/System.Private.Interop/src/Interop/Interop.PlatformNotSupported.cs b/src/System.Private.Interop/src/Interop/Interop.PlatformNotSupported.cs
index d3af3c1c2..265194093 100644
--- a/src/System.Private.Interop/src/Interop/Interop.PlatformNotSupported.cs
+++ b/src/System.Private.Interop/src/Interop/Interop.PlatformNotSupported.cs
@@ -11,8 +11,7 @@ using System.Runtime.InteropServices;
// are from McgMarshal , refactoring WinRT marshal API is TODO
namespace System.Runtime.InteropServices
{
-#if CORECLR
-
+#if !ENABLE_MIN_WINRT
public static partial class McgMarshal
{
@@ -60,6 +59,6 @@ namespace System.Runtime.InteropServices
throw new PlatformNotSupportedException("StringToHStringForField");
}
}
-#endif
+#endif // !ENABLE_MIN_WINRT
}
diff --git a/src/System.Private.Interop/src/Shared/McgComHelpers.cs b/src/System.Private.Interop/src/Shared/McgComHelpers.cs
index e3f49a8bf..e4073a196 100644
--- a/src/System.Private.Interop/src/Shared/McgComHelpers.cs
+++ b/src/System.Private.Interop/src/Shared/McgComHelpers.cs
@@ -92,7 +92,7 @@ namespace System.Runtime.InteropServices
Interop.COM.__IStream* pStreamNativePtr = (Interop.COM.__IStream*)(void*)pStream;
UInt64 newPosition;
- int hr = CalliIntrinsics.StdCall<int>(
+ int hr = CalliIntrinsics.StdCall__int(
pStreamNativePtr->vtbl->pfnSeek,
pStreamNativePtr,
0UL,
@@ -109,7 +109,7 @@ namespace System.Runtime.InteropServices
Interop.COM.__IStream* pStreamNativePtr = (Interop.COM.__IStream*)(void*)pStream;
UInt64 newPosition;
- int hr = CalliIntrinsics.StdCall<int>(
+ int hr = CalliIntrinsics.StdCall__int(
pStreamNativePtr->vtbl->pfnSetSize,
pStreamNativePtr,
lSize,
@@ -230,14 +230,6 @@ namespace System.Runtime.InteropServices
}
/// <summary>
- /// Return true if the object is a RCW. False otherwise
- /// </summary>
- internal static bool IsComObject(object obj)
- {
- return (obj is __ComObject);
- }
-
- /// <summary>
/// Unwrap if this is a managed wrapper
/// Typically used in data binding
/// For example, you don't want to data bind against a KeyValuePairImpl<K, V> - you want the real
diff --git a/src/System.Private.Interop/src/Shared/McgIntrinsics.cs b/src/System.Private.Interop/src/Shared/McgIntrinsics.cs
index 1f962b018..8334feeb9 100644
--- a/src/System.Private.Interop/src/Shared/McgIntrinsics.cs
+++ b/src/System.Private.Interop/src/Shared/McgIntrinsics.cs
@@ -186,10 +186,10 @@ namespace System.Runtime.InteropServices
void * arg7)
{
// This method is implemented elsewhere in the toolchain
- return 0;
+ return default(int);
}
- internal static T StdCall<T>(
+ internal static int StdCall__int(
System.IntPtr pfn,
void* pComThis,
ulong arg0,
@@ -197,9 +197,9 @@ namespace System.Runtime.InteropServices
void* arg2)
{
// This method is implemented elsewhere in the toolchain
- return default(T);
+ return 0;
}
- internal static T StdCall<T>(
+ internal static int StdCall__int(
System.IntPtr pfn,
void* pComThis,
IntPtr arg0,
@@ -209,50 +209,44 @@ namespace System.Runtime.InteropServices
IntPtr arg4)
{
// This method is implemented elsewhere in the toolchain
- return default(T);
+ return 0;
}
- internal static T StdCall<T>(
+ internal static int StdCall__int(
System.IntPtr pfn,
uint arg0)
{
// This method is implemented elsewhere in the toolchain
- return default(T);
+ return default(int);
}
- internal static T StdCall<T>(
+ internal static int StdCall__int(
System.IntPtr pfn,
void* arg0)
{
// This method is implemented elsewhere in the toolchain
- return default(T);
- }
- internal static T StdCall<T>(
- System.IntPtr pfn,
- void* arg0,
- void* arg1)
- {
- // This method is implemented elsewhere in the toolchain
- return default(T);
+ return default(int);
}
- internal static T StdCall<T>(
+
+ internal static int StdCall__int(
System.IntPtr pfn,
void* arg0,
uint arg1,
void* arg2)
{
// This method is implemented elsewhere in the toolchain
- return default(T);
+ return default(int);
}
- internal static T StdCall<T>(
+ internal static int StdCall__int(
System.IntPtr pfn,
void* arg0,
void* arg1,
void* arg2)
{
// This method is implemented elsewhere in the toolchain
- return default(T);
+ return default(int);
}
- internal static T StdCall<T>(
+
+ internal static int StdCall__int(
System.IntPtr pfn,
void* arg0,
uint arg1,
@@ -260,18 +254,19 @@ namespace System.Runtime.InteropServices
void* arg3)
{
// This method is implemented elsewhere in the toolchain
- return default(T);
+ return default(int);
}
- internal static T StdCall<T>(
+ internal static int StdCall__int(
System.IntPtr pfn,
int hr,
void* errorMsg,
System.IntPtr pUnk)
{
// This method is implemented elsewhere in the toolchain
- return default(T);
+ return default(int);
}
- internal static T StdCall<T>(
+
+ internal static int StdCall__int(
System.IntPtr pfn,
System.IntPtr pComThis,
out System.IntPtr arg1,
@@ -284,18 +279,19 @@ namespace System.Runtime.InteropServices
arg3 = default(IntPtr);
arg4 = default(IntPtr);
arg2 = 0;
- return default(T);
+ return default(int);
}
- internal static T StdCall<T>(
+ internal static int StdCall__int(
System.IntPtr pfn,
System.IntPtr pComThis,
out System.IntPtr arg)
{
// This method is implemented elsewhere in the toolchain
arg = default(IntPtr);
- return default(T);
+ return default(int);
}
- internal static T StdCall<T>(
+
+ internal static int StdCall__int(
System.IntPtr pfn,
System.IntPtr pComThis,
System.Guid arg1,
@@ -303,10 +299,10 @@ namespace System.Runtime.InteropServices
{
// This method is implemented elsewhere in the toolchain
arg2 = default(IntPtr);
- return default(T);
+ return default(int);
}
- internal static T StdCall<T>(
+ internal static int StdCall__int(
IntPtr pfn,
void* pComThis,
IntPtr piid,
@@ -317,10 +313,10 @@ namespace System.Runtime.InteropServices
IntPtr pclsid)
{
// This method is implemented elsewhere in the toolchain
- return default(T);
+ return default(int);
}
- internal static T StdCall<T>(
+ internal static int StdCall__int(
IntPtr pfn,
void* pComThis,
IntPtr pStm,
@@ -331,10 +327,10 @@ namespace System.Runtime.InteropServices
int mshlflags)
{
// This method is implemented elsewhere in the toolchain
- return default(T);
+ return default(int);
}
- internal static T StdCall<T>(
+ internal static int StdCall__int(
IntPtr pfn,
void* pComThis,
IntPtr pStm,
@@ -342,25 +338,25 @@ namespace System.Runtime.InteropServices
IntPtr ppvObj)
{
// This method is implemented elsewhere in the toolchain
- return default(T);
+ return default(int);
}
- internal static T StdCall<T>(
+ internal static int StdCall__int(
IntPtr pfn,
void* pComThis,
IntPtr pStm)
{
// This method is implemented elsewhere in the toolchain
- return default(T);
+ return default(int);
}
- internal static T StdCall<T>(
+ internal static int StdCall__int(
IntPtr pfn,
void* pComThis,
int dwReserved)
{
// This method is implemented elsewhere in the toolchain
- return default(T);
+ return default(int);
}
private const MethodImplOptions InternalCall = (MethodImplOptions)0x1000;
@@ -611,7 +607,7 @@ namespace System.Runtime.InteropServices
IntPtr puArgErr);
// IStream
- internal delegate int AddrOfIStreamClone(IntPtr pComThis, out IntPtr ppstm);
+ internal delegate int AddrOfIStreamClone(IntPtr pComThis, IntPtr ppstm);
internal delegate int AddrOfIStreamCopyTo(IntPtr pComThis, IntPtr pstm, long cb, IntPtr pcbRead, IntPtr pcbWritten);
internal delegate int AddrOfIStreamLockRegion(IntPtr pComThis, long libOffset, long cb, int dwLockType);
internal delegate int AddrOfIStreamRead(IntPtr pComThis, IntPtr pv, int cb, IntPtr pcbRead);
diff --git a/src/System.Private.Interop/src/Shared/McgMarshal.cs b/src/System.Private.Interop/src/Shared/McgMarshal.cs
index 3e02dd9c7..29fba4115 100644
--- a/src/System.Private.Interop/src/Shared/McgMarshal.cs
+++ b/src/System.Private.Interop/src/Shared/McgMarshal.cs
@@ -77,15 +77,26 @@ namespace System.Runtime.InteropServices
#endif
}
- public static bool IsCOMObject(Type type)
+ /// <summary>
+ /// Return true if the type is __COM or derived from __COM. False otherwise
+ /// </summary>
+ public static bool IsComObject(Type type)
{
#if RHTESTCL
return false;
#else
- return type.GetTypeInfo().IsSubclassOf(typeof(__ComObject));
+ return type == typeof(__ComObject) || type.GetTypeInfo().IsSubclassOf(typeof(__ComObject));
#endif
}
+ /// <summary>
+ /// Return true if the object is a RCW. False otherwise
+ /// </summary>
+ internal static bool IsComObject(object obj)
+ {
+ return (obj is __ComObject);
+ }
+
public static T FastCast<T>(object value) where T : class
{
// We have an assert here, to verify that a "real" cast would have succeeded.
@@ -355,7 +366,7 @@ namespace System.Runtime.InteropServices
}
#endif
-#if ENABLE_WINRT
+#if ENABLE_MIN_WINRT
[MethodImplAttribute(MethodImplOptions.NoInlining)]
public static unsafe HSTRING StringToHString(string sourceString)
@@ -396,11 +407,11 @@ namespace System.Runtime.InteropServices
return hr;
}
}
-#endif //ENABLE_WINRT
+#endif //ENABLE_MIN_WINRT
#endregion
-#region COM marshalling
+ #region COM marshalling
/// <summary>
/// Explicit AddRef for RCWs
@@ -920,10 +931,9 @@ namespace System.Runtime.InteropServices
{
return CoCreateInstanceEx(clsid, string.Empty);
}
+ #endregion
-#endregion
-
-#region Testing
+ #region Testing
/// <summary>
/// Internal-only method to allow testing of apartment teardown code
@@ -1062,7 +1072,7 @@ namespace System.Runtime.InteropServices
IntPtr pResult = default(IntPtr);
- int hr = CalliIntrinsics.StdCall<int>(
+ int hr = CalliIntrinsics.StdCall__int(
pIActivationFactoryInternal->pVtable->pfnActivateInstance,
pIActivationFactoryInternal,
&pResult
diff --git a/src/System.Private.Interop/src/Shared/McgTypeHelpers.cs b/src/System.Private.Interop/src/Shared/McgTypeHelpers.cs
index 4f11ab5f1..ba8ee2b63 100644
--- a/src/System.Private.Interop/src/Shared/McgTypeHelpers.cs
+++ b/src/System.Private.Interop/src/Shared/McgTypeHelpers.cs
@@ -835,10 +835,12 @@ namespace System.Runtime.InteropServices
internal static bool IsComClass(this RuntimeTypeHandle handle)
{
+ //From Interop point, Delegates aren't treated as Class
#if CORECLR
- return InteropExtensions.IsClass(handle);
+ return InteropExtensions.IsClass(handle) &&
+ !InteropExtensions.AreTypesAssignable(handle, typeof(Delegate).TypeHandle);
#else
- return !InteropExtensions.IsInterface(handle) &&
+ return !InteropExtensions.IsInterface(handle) &&
!handle.IsValueType() &&
!InteropExtensions.AreTypesAssignable(handle, typeof(Delegate).TypeHandle);
#endif
diff --git a/src/System.Private.Interop/src/Shared/RCWWalker.cs b/src/System.Private.Interop/src/Shared/RCWWalker.cs
index 9f1507b3e..b6a6d75d8 100644
--- a/src/System.Private.Interop/src/Shared/RCWWalker.cs
+++ b/src/System.Private.Interop/src/Shared/RCWWalker.cs
@@ -571,7 +571,7 @@ namespace System.Runtime.InteropServices
private static unsafe void Initialize(__com_IJupiterObject* pJupiterObject)
{
IntPtr pGCManager;
- int hr = CalliIntrinsics.StdCall<int>(pJupiterObject->pVtable->pfnGetJupiterGCManager, pJupiterObject, &pGCManager);
+ int hr = CalliIntrinsics.StdCall__int(pJupiterObject->pVtable->pfnGetJupiterGCManager, pJupiterObject, &pGCManager);
if (hr >= 0)
{
// disable warning for ref volatile
@@ -599,7 +599,7 @@ namespace System.Runtime.InteropServices
// AddRef on IGCManager
//
__com_IUnknown* pGCManagerUnk = (__com_IUnknown*)pGCManager;
- CalliIntrinsics.StdCall<int>(pGCManagerUnk->pVtable->pfnAddRef, pGCManager);
+ CalliIntrinsics.StdCall__int(pGCManagerUnk->pVtable->pfnAddRef, pGCManager);
s_clrServices.pVtable = __vtable_ICLRServices.GetVtable();
@@ -609,7 +609,7 @@ namespace System.Runtime.InteropServices
// Tell Jupiter that we are ready for tracking life time of objects and provide Jupiter with
// our life time realted services through ICLRServices
//
- CalliIntrinsics.StdCall<int>(
+ CalliIntrinsics.StdCall__int(
pGCManager->pVTable->pfnSetCLRServices,
pGCManager,
pCLRServices
@@ -656,7 +656,7 @@ namespace System.Runtime.InteropServices
// Notify Jupiter that we've created a new RCW for this Jupiter object
// To avoid surprises, we should notify them before we fire the first AfterAddRef
//
- CalliIntrinsics.StdCall<int>(pJupiterObject->pVtable->pfnConnect, pJupiterObject);
+ CalliIntrinsics.StdCall__int(pJupiterObject->pVtable->pfnConnect, pJupiterObject);
//
// Tell Jupiter that we've done AddRef for IJupiterObject* and IUnknown*
@@ -687,7 +687,7 @@ namespace System.Runtime.InteropServices
// We should do this *after* we made a AddRef because we should never
// be in a state where report refs > actual refs
//
- CalliIntrinsics.StdCall<int>(pJupiterObject->pVtable->pfnAfterAddRef, pJupiterObject);
+ CalliIntrinsics.StdCall__int(pJupiterObject->pVtable->pfnAfterAddRef, pJupiterObject);
}
/// <summary>
@@ -706,7 +706,7 @@ namespace System.Runtime.InteropServices
__com_IJupiterObject* pJupiterObject = comObject.GetIJupiterObject_NoAddRef();
- CalliIntrinsics.StdCall<int>(pJupiterObject->pVtable->pfnBeforeRelease, pJupiterObject);
+ CalliIntrinsics.StdCall__int(pJupiterObject->pVtable->pfnBeforeRelease, pJupiterObject);
}
/// <summary>
diff --git a/src/System.Private.Interop/src/Shared/StandardInterfaces.cs b/src/System.Private.Interop/src/Shared/StandardInterfaces.cs
index b480e37d3..24c04ecce 100644
--- a/src/System.Private.Interop/src/Shared/StandardInterfaces.cs
+++ b/src/System.Private.Interop/src/Shared/StandardInterfaces.cs
@@ -1579,7 +1579,7 @@ namespace System.Runtime.InteropServices
static unsafe int GetIMarshal(void **ppIMarshal)
{
-#if ENABLE_WINRT
+#if ENABLE_MIN_WINRT
void *pUnk = null;
int hr = ExternalInterop.CoCreateFreeThreadedMarshaler(null, (void **)&pUnk);
if (hr < 0) return hr;
@@ -1612,7 +1612,7 @@ namespace System.Runtime.InteropServices
int hr = GetIMarshal((void **)&pIMarshal);
if (hr < 0) return hr;
- return CalliIntrinsics.StdCall<int>(
+ return CalliIntrinsics.StdCall__int(
(*pIMarshal)->pfnGetUnmarshalClass,
pIMarshal,
piid,
@@ -1645,7 +1645,7 @@ namespace System.Runtime.InteropServices
int hr = GetIMarshal((void**)&pIMarshal); ;
if (hr < 0) return hr;
- return CalliIntrinsics.StdCall<int>(
+ return CalliIntrinsics.StdCall__int(
(*pIMarshal)->pfnGetMarshalSizeMax,
pIMarshal,
piid,
@@ -1678,7 +1678,7 @@ namespace System.Runtime.InteropServices
int hr = GetIMarshal((void**)&pIMarshal);
if (hr < 0) return hr;
- return CalliIntrinsics.StdCall<int>(
+ return CalliIntrinsics.StdCall__int(
(*pIMarshal)->pfnMarshalInterface,
pIMarshal,
pStm,
@@ -1708,7 +1708,7 @@ namespace System.Runtime.InteropServices
int hr = GetIMarshal((void**)&pIMarshal);
if (hr < 0) return hr;
- return CalliIntrinsics.StdCall<int>(
+ return CalliIntrinsics.StdCall__int(
(*pIMarshal)->pfnUnmarshalInterface,
pIMarshal,
pStm,
@@ -1733,7 +1733,7 @@ namespace System.Runtime.InteropServices
int hr = GetIMarshal((void**)&pIMarshal);
if (hr < 0) return hr;
- return CalliIntrinsics.StdCall<int>(
+ return CalliIntrinsics.StdCall__int(
(*pIMarshal)->pfnReleaseMarshalData,
pIMarshal,
pStm);
@@ -1756,7 +1756,7 @@ namespace System.Runtime.InteropServices
int hr = GetIMarshal((void**)&pIMarshal);
if (hr < 0) return hr;
- return CalliIntrinsics.StdCall<int>(
+ return CalliIntrinsics.StdCall__int(
(*pIMarshal)->pfnDisconnectObject,
pIMarshal,
dwReserved);
@@ -1801,7 +1801,7 @@ namespace System.Runtime.InteropServices
/// <returns>The IStream*</returns>
internal static unsafe IntPtr CreateMemStm(ulong lSize)
{
-#if ENABLE_WINRT
+#if ENABLE_MIN_WINRT
__com_IStream* pIStream = (__com_IStream*)PInvokeMarshal.CoTaskMemAlloc(new UIntPtr((uint)sizeof(__com_IStream)));
pIStream->pVtable = (__vtable_IStream*)__vtable_IStream.GetVtable();
pIStream->m_cbCurrent = 0;
@@ -2077,7 +2077,7 @@ namespace System.Runtime.InteropServices
#region Rest of IStream overrides that are not implemented
[NativeCallable]
- internal static int Clone(System.IntPtr pComThis, out IntPtr ppstm)
+ internal static int Clone(System.IntPtr pComThis, IntPtr ppstm)
{
ppstm = default(IntPtr);
return Interop.COM.E_NOTIMPL;
diff --git a/src/System.Private.Interop/src/Shared/__ComObject.cs b/src/System.Private.Interop/src/Shared/__ComObject.cs
index 9a0706f0c..dbfcfa75b 100644
--- a/src/System.Private.Interop/src/Shared/__ComObject.cs
+++ b/src/System.Private.Interop/src/Shared/__ComObject.cs
@@ -3066,7 +3066,7 @@ namespace System.Runtime.InteropServices
(Interop.COM.__IContextCallback*)(void*)pContextCallback;
fixed (Guid* unsafe_iid = &Interop.COM.IID_IEnterActivityWithNoLock)
{
- int hr = CalliIntrinsics.StdCall<int>(
+ int hr = CalliIntrinsics.StdCall__int(
pContextCallbackNativePtr->vtbl->pfnContextCallback,
pContextCallbackNativePtr, // Don't forget 'this pointer
AddrOfIntrinsics.AddrOf<AddrOfIntrinsics.AddrOfTarget1>(EnterContextCallbackProc),
@@ -3607,7 +3607,7 @@ namespace System.Runtime.InteropServices
try
{
- int hr = CalliIntrinsics.StdCall<int>(
+ int hr = CalliIntrinsics.StdCall__int(
pIStringable->pVtable->pfnToString,
pIStringable,
&unsafe_hstring
diff --git a/src/System.Private.Interop/src/System/Runtime/InteropServices/ComWeakReferenceHelpers.cs b/src/System.Private.Interop/src/System/Runtime/InteropServices/ComWeakReferenceHelpers.cs
index a97198082..a3910b67c 100644
--- a/src/System.Private.Interop/src/System/Runtime/InteropServices/ComWeakReferenceHelpers.cs
+++ b/src/System.Private.Interop/src/System/Runtime/InteropServices/ComWeakReferenceHelpers.cs
@@ -134,7 +134,7 @@ namespace System.Runtime.InteropServices
{
// Now that we have the IWeakReferenceSource , we need to call the GetWeakReference method to get the corresponding IWeakReference
__com_IWeakReferenceSource* pComWeakRefSource = (__com_IWeakReferenceSource*)pWeakRefSource;
- int result = CalliIntrinsics.StdCall<int>(
+ int result = CalliIntrinsics.StdCall__int(
pComWeakRefSource->pVtable->pfnGetWeakReference,
pWeakRefSource,
out pWeakRef);
diff --git a/src/System.Private.Interop/src/System/Runtime/InteropServices/Marshal.cs b/src/System.Private.Interop/src/System/Runtime/InteropServices/Marshal.cs
index d2b0efb5c..19534b27a 100644
--- a/src/System.Private.Interop/src/System/Runtime/InteropServices/Marshal.cs
+++ b/src/System.Private.Interop/src/System/Runtime/InteropServices/Marshal.cs
@@ -797,7 +797,7 @@ namespace System.Runtime.InteropServices
if (o == null)
throw new ArgumentNullException(nameof(o), SR.Arg_InvalidHandle);
- return McgComHelpers.IsComObject(o);
+ return McgMarshal.IsComObject(o);
}
public static unsafe IntPtr StringToCoTaskMemUni(String s)
diff --git a/src/System.Private.Interop/src/System/Runtime/InteropServices/MarshalImpl.cs b/src/System.Private.Interop/src/System/Runtime/InteropServices/MarshalImpl.cs
index 973b305a7..20f08a919 100644
--- a/src/System.Private.Interop/src/System/Runtime/InteropServices/MarshalImpl.cs
+++ b/src/System.Private.Interop/src/System/Runtime/InteropServices/MarshalImpl.cs
@@ -38,18 +38,18 @@ namespace System.Runtime.InteropServices
{
if (o == null)
throw new ArgumentNullException(nameof(o));
- return McgMarshal.IsCOMObject(o.GetType());
+ return McgMarshal.IsComObject(o);
}
public static int ReleaseComObject(object o)
{
if (o == null)
throw new ArgumentNullException(nameof(o));
- return McgMarshal.Release(o as __ComObject);
+ return McgMarshal.Release(o as __ComObject);
}
public static int FinalReleaseComObject(object o)
{
- return McgMarshal.FinalReleaseComObject(o);
+ return McgMarshal.FinalReleaseComObject(o);
}
public static int QueryInterface(IntPtr pUnk, ref Guid iid, out IntPtr ppv)
@@ -72,6 +72,5 @@ namespace System.Runtime.InteropServices
{
return McgMarshal.ComRelease(pUnk);
}
-
}
}
diff --git a/src/System.Private.Interop/src/WinRT/ExceptionHelpers.cs b/src/System.Private.Interop/src/WinRT/ExceptionHelpers.cs
index 511f489a2..c023d5c06 100644
--- a/src/System.Private.Interop/src/WinRT/ExceptionHelpers.cs
+++ b/src/System.Private.Interop/src/WinRT/ExceptionHelpers.cs
@@ -32,7 +32,7 @@ namespace System.Runtime.InteropServices
{
// Get the errorDetails associated with the restrictedErrorInfo.
__com_IRestrictedErrorInfo* pComRestrictedErrorInfo = (__com_IRestrictedErrorInfo*)pRestrictedErrorInfo;
- result = CalliIntrinsics.StdCall<int>(
+ result = CalliIntrinsics.StdCall__int(
pComRestrictedErrorInfo->pVtable->pfnGetErrorDetails,
pRestrictedErrorInfo,
out pErrDes,
@@ -75,7 +75,7 @@ namespace System.Runtime.InteropServices
try
{
__com_IRestrictedErrorInfo* pComRestrictedErrorInfo = (__com_IRestrictedErrorInfo*)pRestrictedErrorInfo;
- int result = CalliIntrinsics.StdCall<int>(pComRestrictedErrorInfo->pVtable->pfnGetReference, pRestrictedErrorInfo, out pReference);
+ int result = CalliIntrinsics.StdCall__int(pComRestrictedErrorInfo->pVtable->pfnGetReference, pRestrictedErrorInfo, out pReference);
if (result >= 0)
{
errReference = Interop.COM.ConvertBSTRToString(pReference);
@@ -795,7 +795,7 @@ namespace System.Runtime.InteropServices
// We have an LanguageExceptionErrorInfo.
IntPtr pUnk;
__com_ILanguageExceptionErrorInfo* pComLanguageExceptionErrorInfo = (__com_ILanguageExceptionErrorInfo*)pLanguageExceptionErrorInfo;
- int result = CalliIntrinsics.StdCall<int>(pComLanguageExceptionErrorInfo->pVtable->pfnGetLanguageException, pLanguageExceptionErrorInfo, out pUnk);
+ int result = CalliIntrinsics.StdCall__int(pComLanguageExceptionErrorInfo->pVtable->pfnGetLanguageException, pLanguageExceptionErrorInfo, out pUnk);
McgMarshal.ComSafeRelease(pLanguageExceptionErrorInfo);
if (result >= 0 && pUnk != IntPtr.Zero)