diff options
Diffstat (limited to 'src/vm/invokeutil.cpp')
-rw-r--r-- | src/vm/invokeutil.cpp | 142 |
1 files changed, 0 insertions, 142 deletions
diff --git a/src/vm/invokeutil.cpp b/src/vm/invokeutil.cpp index 42e5a86249..1c7173a12b 100644 --- a/src/vm/invokeutil.cpp +++ b/src/vm/invokeutil.cpp @@ -18,9 +18,6 @@ #include "method.hpp" #include "threads.h" #include "excep.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "security.h" #include "field.h" #include "customattribute.h" @@ -940,13 +937,6 @@ void InvokeUtil::ValidateObjectTarget(FieldDesc *pField, TypeHandle enclosingTyp // Give a second chance to thunking classes to do the // correct cast if (ty.IsNull()) { -#ifdef FEATURE_REMOTING - BOOL fCastOK = FALSE; - if ((*target)->IsTransparentProxy()) { - fCastOK = CRemotingServices::CheckCast(*target, enclosingType); - } - if(!fCastOK) -#endif { COMPlusThrow(kArgumentException,W("Arg_ObjObj")); } @@ -1151,37 +1141,6 @@ void InvokeUtil::SetValidField(CorElementType fldType, { _ASSERTE(!fldTH.IsTypeDesc()); MethodTable *pMT = fldTH.AsMethodTable(); -#ifdef FEATURE_REMOTING - if((*target) != NULL && (*target)->IsTransparentProxy()) { - OBJECTREF val = *valueObj; - GCPROTECT_BEGIN(val) - - void* valueData; - if (Nullable::IsNullableType(fldTH)) { - // Special case for Nullable<T>, we need a true nullable that is gc protected. The easiest - // way to make one is to allocate an object on the heap - OBJECTREF trueNullable = fldTH.AsMethodTable()->Allocate(); - BOOL typesChecked; - typesChecked = Nullable::UnBox(trueNullable->GetData(), val, fldTH.AsMethodTable()); - _ASSERTE(typesChecked); - val = trueNullable; - valueData = val->GetData(); - } - else if (val == NULL) { - // Null is the universal null object. (Is this a good idea?) - int size = pMT->GetNumInstanceFieldBytes(); - valueData = _alloca(size); - memset(valueData, 0, size); - } - else - valueData = val->GetData(); - - OBJECTREF unwrapped = CRemotingServices::GetObjectFromProxy(*target); - CRemotingServices::FieldAccessor(pField, unwrapped, valueData, FALSE); - GCPROTECT_END(); - } - else -#endif { void* pFieldData; if (pField->IsStatic()) @@ -1336,14 +1295,6 @@ OBJECTREF InvokeUtil::GetFieldValue(FieldDesc* pField, TypeHandle fieldType, OBJ if (pField->IsStatic()) p = pField->GetCurrentStaticAddress(); else { -#ifdef FEATURE_REMOTING - OBJECTREF o = *target; - if(o->IsTransparentProxy()) { - OBJECTREF unwrapped = CRemotingServices::GetObjectFromProxy(o); - CRemotingServices::FieldAccessor(pField, unwrapped, (void*)obj->GetData(), TRUE); - } - else -#endif p = (*((BYTE**)target)) + pField->GetOffset() + sizeof(Object); } GCPROTECT_END(); @@ -1551,14 +1502,6 @@ void InvokeUtil::CanAccessClass(RefSecContext* pCtx, InvokeUtil::CheckAccessClass(pCtx, pClass, checkAccessForImplicitValueTypeCtor); -#ifndef FEATURE_CORECLR - // Reflection invocation should turn critical method access into a full demand of full trust - // for level 2 assemblies. - if (InvokeUtil::IsCriticalWithConversionToFullDemand(pClass)) - { - Security::SpecialDemand(SSWT_LATEBOUND_LINKDEMAND, SECURITY_FULL_TRUST); - } -#endif //FEATURE_CORECLR } #ifndef DACCESS_COMPILE @@ -1579,30 +1522,12 @@ void InvokeUtil::CanAccessMethod(MethodDesc* pMeth, } CONTRACTL_END; -#ifndef FEATURE_CORECLR - // Security checks are expensive as they involve stack walking. Avoid them if we can. - // In immersive we don't allow private reflection to framework code. So we need to perform - // the access check even if all the domains on the stack are fully trusted. - if (Security::AllDomainsOnStackFullyTrusted() && !AppX::IsAppXProcess() && !pParentMT->GetAssembly()->IsDisabledPrivateReflection()) - return; -#endif // FEATURE_CORECLR InvokeUtil::CheckAccessMethod(pSCtx, pParentMT, pInstanceMT, pMeth); -#ifndef FEATURE_CORECLR - // Reflection invocation should turn critical method access into a full demand of full trust - // for level 2 assemblies. - if (fCriticalToFullDemand && InvokeUtil::IsCriticalWithConversionToFullDemand(pMeth, pParentMT)) - { - Security::SpecialDemand(SSWT_LATEBOUND_LINKDEMAND, SECURITY_FULL_TRUST); - - // No need to do any more checks if a full trust full demand has succeeded. - return; - } -#endif //FEATURE_CORECLR if (pMeth->RequiresLinktimeCheck()) { @@ -1610,25 +1535,6 @@ void InvokeUtil::CanAccessMethod(MethodDesc* pMeth, // stack walks in order to close security holes in poorly written // reflection users. -#ifdef FEATURE_APTCA - if (Security::IsUntrustedCallerCheckNeeded(pMeth)) - { - if (pSCtx->GetCallerMT()) - { - // Check for untrusted caller - // It is possible that wrappers like VBHelper libraries that are - // fully trusted, make calls to public methods that do not have - // safe for Untrusted caller custom attribute set. - // Like all other link demand that gets transformed to a full stack - // walk for reflection, calls to public methods also gets - // converted to full stack walk - - Security::DoUntrustedCallerChecks( - pSCtx->GetCallerMT()->GetAssembly(), pMeth, - TRUE); - } - } -#endif // FEATURE_APTCA struct _gc { @@ -1667,7 +1573,6 @@ void InvokeUtil::CanAccessMethod(MethodDesc* pMeth, GCPROTECT_END(); -#ifdef FEATURE_CORECLR if (pMeth->IsNDirect() || (pMeth->IsComPlusCall() && !pMeth->IsInterface())) { @@ -1683,27 +1588,6 @@ void InvokeUtil::CanAccessMethod(MethodDesc* pMeth, } } -#else // FEATURE_CORECLR - // We perform automatic linktime checks for UnmanagedCode in three cases: - // o P/Invoke calls. - // o Calls through an interface that have a suppress runtime check - // attribute on them (these are almost certainly interop calls). - // o Interop calls made through method impls. - if (pMeth->IsNDirect() || - (pMeth->IsInterface() && - (pMeth->GetMDImport()->GetCustomAttributeByName(pParentMT->GetCl(), - COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI, - NULL, - NULL) == S_OK || - pMeth->GetMDImport()->GetCustomAttributeByName(pMeth->GetMemberDef(), - COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI, - NULL, - NULL) == S_OK) ) || - (pMeth->IsComPlusCall() && !pMeth->IsInterface())) - { - Security::SpecialDemand(SSWT_LATEBOUND_LINKDEMAND, SECURITY_UNMANAGED_CODE); - } -#endif // FEATURE_CORECLR } // @todo: @@ -1731,9 +1615,6 @@ void InvokeUtil::CanAccessMethod(MethodDesc* pMeth, } } -#ifndef FEATURE_CORECLR - Security::SpecialDemand(SSWT_LATEBOUND_LINKDEMAND, SECURITY_SKIP_VER); -#endif // !FEATURE_CORECLR } } #endif // #ifndef DACCESS_COMPILE @@ -1753,14 +1634,6 @@ void InvokeUtil::CanAccessField(RefSecContext* pCtx, InvokeUtil::CheckAccessField(pCtx, pTargetMT, pInstanceMT, pTargetField); -#ifndef FEATURE_CORECLR - // Reflection invocation should turn critical method access into a full demand of full trust - // for level 2 assemblies. - if (InvokeUtil::IsCriticalWithConversionToFullDemand(pTargetField, pInstanceMT)) - { - Security::SpecialDemand(SSWT_LATEBOUND_LINKDEMAND, SECURITY_FULL_TRUST); - } -#endif //FEATURE_CORECLR } // @@ -2009,7 +1882,6 @@ AccessCheckOptions::AccessCheckType InvokeUtil::GetInvocationAccessCheckType(BOO AppDomain * pAppDomain = GetAppDomain(); -#ifdef FEATURE_CORECLR if (pAppDomain->GetSecurityDescriptor()->IsFullyTrusted()) // Ignore transparency so that reflection invocation is consistenct with LCG. @@ -2018,14 +1890,6 @@ AccessCheckOptions::AccessCheckType InvokeUtil::GetInvocationAccessCheckType(BOO return AccessCheckOptions::kMemberAccess; -#else // !FEATURE_CORECLR - return - AppX::IsAppXProcess() ? - (Security::AllDomainsOnStackFullyTrusted() ? - AccessCheckOptions::kUserCodeOnlyRestrictedMemberAccessNoTransparency : - AccessCheckOptions::kUserCodeOnlyRestrictedMemberAccess) : - AccessCheckOptions::kRestrictedMemberAccess; -#endif //FEATURE_CORECLR } #endif // CROSSGEN_COMPILE @@ -2064,12 +1928,6 @@ bool InvokeUtil::IsDangerousMethod(MethodDesc *pMD) { // All methods on these types are considered dangerous static const BinderClassID dangerousTypes[] = { -#ifdef FEATURE_METHOD_RENTAL - CLASS__METHOD_RENTAL, -#endif // FEATURE_METHOD_RENTAL -#ifdef FEATURE_ISOSTORE - CLASS__ISS_STORE_FILE, -#endif CLASS__TYPE_HANDLE, CLASS__METHOD_HANDLE, CLASS__FIELD_HANDLE, |