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);")
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);
}
#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)
gc.retVal = pMT->Allocate();
}
}
- else
- {
- }
{
ArgIteratorForMethodInvoke argit(&gc.pSig);
- if (argit.IsActivationNeeded() || fForceActivationForRemoting)
+ if (argit.IsActivationNeeded())
pMeth->EnsureActive();
CONSISTENCY_CHECK(pMeth->CheckActivated());
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;
}
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
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));
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 (
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 (
}
CONTRACTL_END;
- ULONG cbRef;
HRESULT hr = S_OK;
SimpleComCallWrapper *pSimpleWrap = SimpleComCallWrapper::GetWrapperFromIP(pMarsh);
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 (