Delete CLSID_ComCallUnmarshal and related code (#426)
authorJan Kotas <jkotas@microsoft.com>
Mon, 2 Dec 2019 16:12:29 +0000 (08:12 -0800)
committerGitHub <noreply@github.com>
Mon, 2 Dec 2019 16:12:29 +0000 (08:12 -0800)
Not used in CoreCLR

src/coreclr/src/inc/MSCOREE.IDL
src/coreclr/src/pal/prebuilt/inc/mscoree.h
src/coreclr/src/vm/reflectioninvocation.cpp
src/coreclr/src/vm/runtimehandles.h
src/coreclr/src/vm/stdinterfaces.cpp
src/coreclr/src/vm/stdinterfaces.h

index 5323a7c..b19544f 100644 (file)
@@ -29,9 +29,6 @@ interface IHostControl;
 cpp_quote("struct ICLRControl;")
 interface ICLRControl;
 
-// CLSID ComCallUnmarshal2
-cpp_quote("EXTERN_GUID(CLSID_ComCallUnmarshalV4, 0x45fb4600,0xe6e8,0x4928,0xb2,0x5e,0x50,0x47,0x6f,0xf7,0x94,0x25);")
-
 // IID ICLRRuntimeHost: uuid(90F1A06C-7712-4762-86B5-7A5EBA6BDB02)
 cpp_quote("EXTERN_GUID(IID_ICLRRuntimeHost, 0x90F1A06C, 0x7712, 0x4762, 0x86, 0xB5, 0x7A, 0x5E, 0xBA, 0x6B, 0xDB, 0x02);")
 
index ab7bbb0..79b436b 100644 (file)
@@ -79,7 +79,6 @@ struct IHostControl;
 
 struct ICLRControl;
 
-EXTERN_GUID(CLSID_ComCallUnmarshalV4, 0x45fb4600,0xe6e8,0x4928,0xb2,0x5e,0x50,0x47,0x6f,0xf7,0x94,0x25);
 EXTERN_GUID(IID_ICLRRuntimeHost, 0x90F1A06C, 0x7712, 0x4762, 0x86, 0xB5, 0x7A, 0x5E, 0xBA, 0x6B, 0xDB, 0x02);
 EXTERN_GUID(IID_ICLRRuntimeHost2, 0x712AB73F, 0x2C22, 0x4807, 0xAD, 0x7E, 0xF5, 0x01, 0xD7, 0xb7, 0x2C, 0x2D);
 EXTERN_GUID(IID_ICLRRuntimeHost4, 0x64F6D366, 0xD7C2, 0x4F1F, 0xB4, 0xB2, 0xE8, 0x16, 0x0C, 0xAC, 0x43, 0xAF);
index 4b91d14..f220e76 100644 (file)
@@ -994,9 +994,6 @@ FCIMPL5(Object*, RuntimeMethodHandle::InvokeMethod,
     }
 #endif
 
-    // Skip the activation optimization for remoting because of remoting proxy is not always activated.
-    // It would be nice to clean this up and get remoting to always activate methodtable behind the proxy.
-    BOOL fForceActivationForRemoting = FALSE;
     BOOL fCtorOfVariableSizedObject = FALSE;
 
     if (fConstructor)
@@ -1020,14 +1017,11 @@ FCIMPL5(Object*, RuntimeMethodHandle::InvokeMethod,
                 gc.retVal = pMT->Allocate();
         }
     }
-    else
-    {
-    }
 
     {
     ArgIteratorForMethodInvoke argit(&gc.pSig);
 
-    if (argit.IsActivationNeeded() || fForceActivationForRemoting)
+    if (argit.IsActivationNeeded())
         pMeth->EnsureActive();
     CONSISTENCY_CHECK(pMeth->CheckActivated());
 
@@ -1322,11 +1316,7 @@ FCIMPL5(Object*, RuntimeMethodHandle::InvokeMethod,
     if (fConstructor)
     {
         // We have a special case for Strings...The object is returned...
-        if (ownerType == TypeHandle(g_pStringClass)
-#ifdef FEATURE_UTF8STRING
-            || ownerType == TypeHandle(g_pUtf8StringClass)
-#endif // FEATURE_UTF8STRING
-            ) {
+        if (fCtorOfVariableSizedObject) {
             PVOID pReturnValue = &callDescrData.returnValue;
             gc.retVal = *(OBJECTREF *)pReturnValue;
         }
index 6d08aad..10dd4fd 100644 (file)
@@ -448,7 +448,6 @@ public:
         ReflectClassBaseObject *pDeclaringType);
     static FCDECL3(Object *, GetCustomModifiers, SignatureNative* pSig, INT32 parameter, CLR_BOOL fRequired);
     static FCDECL2(FC_BOOL_RET, CompareSig, SignatureNative* pLhs, SignatureNative* pRhs);
-    static FCDECL4(FC_BOOL_RET, CompareSigForAppCompat, SignatureNative* pLhs, ReflectClassBaseObject * pTypeLhs, SignatureNative* pRhs, ReflectClassBaseObject * pTypeRhs);
 
 
     BOOL HasThis() { LIMITED_METHOD_CONTRACT; return (m_managedCallingConvention & CALLCONV_HasThis); }
index e39a8ad..7ca4975 100644 (file)
@@ -102,37 +102,6 @@ const IID IID_ICustomPropertyProvider = {0x7C925755,0x3E48,0x42B4,{0x86, 0x77, 0
 
 const IID IID_IStringable = {0x96369f54,0x8eb6,0x48f0, {0xab,0xce,0xc1,0xb2,0x11,0xe6,0x27,0xc3}};
 
-// For free-threaded marshaling, we must not be spoofed by out-of-process or cross-runtime marshal data.
-// Only unmarshal data that comes from our own runtime.
-BYTE         g_UnmarshalSecret[sizeof(GUID)];
-bool         g_fInitedUnmarshalSecret = false;
-
-
-static HRESULT InitUnmarshalSecret()
-{
-    CONTRACTL
-    {
-        NOTHROW;
-        GC_NOTRIGGER;
-        MODE_PREEMPTIVE;
-    }
-    CONTRACTL_END;
-
-    HRESULT hr = S_OK;
-
-    if (!g_fInitedUnmarshalSecret)
-    {
-        ComCall::LockHolder lh;
-
-        if (!g_fInitedUnmarshalSecret)
-        {
-            hr = ::CoCreateGuid((GUID *) g_UnmarshalSecret);
-            if (SUCCEEDED(hr))
-                g_fInitedUnmarshalSecret = true;
-        }
-    }
-    return hr;
-}
 
 //------------------------------------------------------------------------------------------
 //      IUnknown methods for CLR objects
@@ -2441,10 +2410,7 @@ HRESULT GetSpecialMarshaler(IMarshal* pMarsh, SimpleComCallWrapper* pSimpleWrap,
 
     HRESULT hr = S_OK;
 
-
-    // In case of APPX process we always use the standard marshaller.
-    // In Non-APPX process use standard marshalling for everything except in-proc servers.
-    // In case of CoreCLR, we always use the standard marshaller as well.
+    // In case of CoreCLR, we always use the standard marshaller.
 
     SafeComHolderPreemp<IUnknown> pMarshalerObj = NULL;
     IfFailRet(CoCreateFreeThreadedMarshaler(NULL, &pMarshalerObj));
@@ -2496,16 +2462,7 @@ HRESULT __stdcall Marshal_GetUnmarshalClass (
     if (FAILED(hr))
         return hr;
 
-    if (pMsh != NULL)
-    {
-        hr = pMsh->GetUnmarshalClass (riid, pv, dwDestContext, pvDestContext, mshlflags, pclsid);
-        return hr;
-    }
-
-    // Use a statically allocated singleton class to do all unmarshalling.
-    *pclsid = CLSID_ComCallUnmarshalV4;
-
-    return S_OK;
+    return pMsh->GetUnmarshalClass (riid, pv, dwDestContext, pvDestContext, mshlflags, pclsid);
 }
 
 HRESULT __stdcall Marshal_GetMarshalSizeMax (
@@ -2534,15 +2491,7 @@ HRESULT __stdcall Marshal_GetMarshalSizeMax (
     if (FAILED(hr))
         return hr;
 
-    if (pMsh != NULL)
-    {
-        HRESULT hr = pMsh->GetMarshalSizeMax (riid, pv, dwDestContext, pvDestContext, mshlflags, pSize);
-        return hr;
-    }
-
-    *pSize = sizeof (IUnknown *) + sizeof (ULONG) + sizeof(GUID);
-
-    return S_OK;
+    return pMsh->GetMarshalSizeMax (riid, pv, dwDestContext, pvDestContext, mshlflags, pSize);
 }
 
 HRESULT __stdcall Marshal_MarshalInterface (
@@ -2563,7 +2512,6 @@ HRESULT __stdcall Marshal_MarshalInterface (
     }
     CONTRACTL_END;
 
-    ULONG cbRef;
     HRESULT hr = S_OK;
 
     SimpleComCallWrapper *pSimpleWrap = SimpleComCallWrapper::GetWrapperFromIP(pMarsh);
@@ -2584,38 +2532,7 @@ HRESULT __stdcall Marshal_MarshalInterface (
     if (FAILED(hr))
         return hr;
 
-    if (pMsh != NULL)
-    {
-        hr = pMsh->MarshalInterface (pStm, riid, pv, dwDestContext, pvDestContext, mshlflags);
-        return hr;
-    }
-
-    // Write the raw IP into the marshalling stream.
-    hr = pStm->Write (&pv, sizeof (pv), 0);
-    if (FAILED (hr))
-        return hr;
-
-    // Followed by the marshalling flags (we need these on the remote end to
-    // manage refcounting the IP).
-    hr = pStm->Write (&mshlflags, sizeof (mshlflags), 0);
-    if (FAILED (hr))
-        return hr;
-
-    // Followed by the secret, which confirms that the pointer above can be trusted
-    // because it originated from our runtime.
-    hr = InitUnmarshalSecret();
-    if (FAILED(hr))
-        return hr;
-
-    hr = pStm->Write(g_UnmarshalSecret, sizeof(g_UnmarshalSecret), 0);
-    if (FAILED(hr))
-        return hr;
-
-    // We have now created an additional reference to the object.
-    cbRef = SafeAddRefPreemp((IUnknown *)pv);
-    LogInteropAddRef((IUnknown *)pv, cbRef, "MarshalInterface");
-
-    return S_OK;
+    return pMsh->MarshalInterface (pStm, riid, pv, dwDestContext, pvDestContext, mshlflags);
 }
 
 HRESULT __stdcall Marshal_UnmarshalInterface (
index de2f5f4..9ff3289 100644 (file)
@@ -56,11 +56,6 @@ typedef HRESULT (__stdcall* PCOMFN)(void);
 #define S_USEIUNKNOWN   (HRESULT)2
 #define S_USEIDISPATCH  (HRESULT)3
 
-// For free-threaded marshaling, we must not be spoofed by out-of-process or cross-runtime marshal data.
-// Only unmarshal data that comes from our own runtime.
-extern BYTE         g_UnmarshalSecret[sizeof(GUID)];
-extern bool         g_fInitedUnmarshalSecret;
-
 // make sure to keep the following enum and the g_stdVtables array in sync
 enum Enum_StdInterfaces
 {