endif(CLR_CMAKE_PLATFORM_UNIX)
endif(FEATURE_EVENT_TRACE)
add_definitions(-DFEATURE_EXCEPTIONDISPATCHINFO)
-add_definitions(-DFEATURE_FRAMEWORK_INTERNAL)
# NetBSD doesn't implement this feature
if(NOT CLR_CMAKE_PLATFORM_UNIX_TARGET_ARM AND NOT CMAKE_SYSTEM_NAME STREQUAL NetBSD)
add_definitions(-DFEATURE_HIJACK)
add_definitions(-DFEATURE_STANDALONE_SN)
add_definitions(-DFEATURE_STRONGNAME_DELAY_SIGNING_ALLOWED)
add_definitions(-DFEATURE_STRONGNAME_MIGRATION)
-if(WIN32)
- add_definitions(-DFEATURE_STRONGNAME_TESTKEY_ALLOWED)
-endif(WIN32)
if (CLR_CMAKE_PLATFORM_UNIX OR CLR_CMAKE_PLATFORM_ARCH_ARM64)
add_definitions(-DFEATURE_STUBS_AS_IL)
endif(CLR_CMAKE_PLATFORM_UNIX OR CLR_CMAKE_PLATFORM_ARCH_ARM64)
<CDefines Condition="'$(FeatureXplatEventSource)' == 'true'">$(CDefines);FEATURE_EVENTSOURCE_XPLAT</CDefines>
<CDefines Condition="'$(FeatureExceptionDispatchInfo)' == 'true'">$(CDefines);FEATURE_EXCEPTIONDISPATCHINFO</CDefines>
<CDefines Condition="'$(FeatureExceptionNotifications)' == 'true'">$(CDefines);FEATURE_EXCEPTION_NOTIFICATIONS</CDefines>
- <CDefines Condition="'$(FeatureFrameworkInternal)' == 'true'">$(CDefines);FEATURE_FRAMEWORK_INTERNAL</CDefines>
<CDefines Condition="'$(FeatureFullNGen)' == 'true'">$(CDefines);FEATURE_FULL_NGEN</CDefines>
<CDefines Condition="'$(FeatureFusion)' == 'true'">$(CDefines);FEATURE_FUSION</CDefines>
<CDefines Condition="'$(FeatureHijack)' == 'true'">$(CDefines);FEATURE_HIJACK</CDefines>
<CDefines Condition="'$(FeatureStandaloneSn)' == 'true'">$(CDefines);FEATURE_STANDALONE_SN</CDefines>
<CDefines Condition="'$(FeatureStrongnameDelaySigningAllowed)' == 'true'">$(CDefines);FEATURE_STRONGNAME_DELAY_SIGNING_ALLOWED</CDefines>
<CDefines Condition="'$(FeatureStrongnameMigration)' == 'true'">$(CDefines);FEATURE_STRONGNAME_MIGRATION</CDefines>
- <CDefines Condition="'$(FeatureStrongnameTestkeyAllowed)' == 'true'">$(CDefines);FEATURE_STRONGNAME_TESTKEY_ALLOWED</CDefines>
<CDefines Condition="'$(FeatureSvrGc)' == 'true'">$(CDefines);FEATURE_SVR_GC</CDefines>
<CDefines Condition="'$(FeaturePerfMap)' == 'true'">$(CDefines);FEATURE_PERFMAP</CDefines>
<CDefines Condition="'$(FeatureSynchronizationcontextWait)' == 'true'">$(CDefines);FEATURE_SYNCHRONIZATIONCONTEXT_WAIT</CDefines>
<DefineConstants Condition="'$(FeatureEncodingNls)' == 'true'">$(DefineConstants);FEATURE_ENCODINGNLS</DefineConstants>
<DefineConstants Condition="'$(FeatureExceptionDispatchInfo)' == 'true'">$(DefineConstants);FEATURE_EXCEPTIONDISPATCHINFO</DefineConstants>
<DefineConstants Condition="'$(FeatureExceptionNotifications)' == 'true'">$(DefineConstants);FEATURE_EXCEPTION_NOTIFICATIONS</DefineConstants>
- <DefineConstants Condition="'$(FeatureFrameworkInternal)' == 'true'">$(DefineConstants);FEATURE_FRAMEWORK_INTERNAL</DefineConstants>
<DefineConstants Condition="'$(FeatureFusion)' == 'true'">$(DefineConstants);FEATURE_FUSION</DefineConstants>
<DefineConstants Condition="'$(FeatureHostAssemblyResolver)' == 'true'">$(DefineConstants);FEATURE_HOST_ASSEMBLY_RESOLVER</DefineConstants>
<DefineConstants Condition="'$(FeatureHostedBinder)' == 'true'">$(DefineConstants);FEATURE_HOSTED_BINDER</DefineConstants>
// Otherwise, by default, only platform assemblies can perform those operations.
APPDOMAIN_ENABLE_PINVOKE_AND_CLASSIC_COMINTEROP = 0x10,
-#if defined(FEATURE_WINDOWSPHONE) && defined(FEATURE_STRONGNAME_TESTKEY_ALLOWED)
- APPDOMAIN_SET_TEST_KEY = 0x20,
-#endif // defined(FEATURE_WINDOWSPHONE) && defined(FEATURE_STRONGNAME_TESTKEY_ALLOWED)
-
APPDOMAIN_ENABLE_PLATFORM_SPECIFIC_APPS = 0x40,
APPDOMAIN_ENABLE_ASSEMBLY_LOADFILE = 0x80,
throw new NotImplementedException();
}
-#if FEATURE_CORECLR
- internal virtual bool IsProfileAssembly
- {
- [System.Security.SecurityCritical]
- get
- {
- throw new NotImplementedException();
- }
- }
-#endif // FEATURE_CORECLR
-
public virtual IList<CustomAttributeData> GetCustomAttributesData()
{
throw new NotImplementedException();
{
ASSEMBLY_FLAGS flags = ASSEMBLY_FLAGS.ASSEMBLY_FLAGS_UNKNOWN;
-#if !FEATURE_CORECLR
- if (RuntimeAssembly.IsFrameworkAssembly(GetName()))
+#if FEATURE_CORECLR
+ flags |= ASSEMBLY_FLAGS.ASSEMBLY_FLAGS_FRAMEWORK | ASSEMBLY_FLAGS.ASSEMBLY_FLAGS_SAFE_REFLECTION;
#else
- if (IsProfileAssembly)
-#endif
+ if (RuntimeAssembly.IsFrameworkAssembly(GetName()))
{
flags |= ASSEMBLY_FLAGS.ASSEMBLY_FLAGS_FRAMEWORK | ASSEMBLY_FLAGS.ASSEMBLY_FLAGS_SAFE_REFLECTION;
{
flags = ASSEMBLY_FLAGS.ASSEMBLY_FLAGS_SAFE_REFLECTION;
}
+#endif
m_flags = flags | ASSEMBLY_FLAGS.ASSEMBLY_FLAGS_INITIALIZED;
}
return m_flags;
}
}
-#endif // FEATURE_APPX
+#endif // FEATURE_CORECLR
internal object SyncRoot
{
newGrant = granted; newDenied = denied;
}
-#if FEATURE_CORECLR
- [System.Security.SecurityCritical]
- [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
- [SuppressUnmanagedCodeSecurity]
- [return: MarshalAs(UnmanagedType.Bool)]
- internal static extern bool GetIsProfileAssembly(RuntimeAssembly assembly);
-
- // True if the assembly is a trusted platform assembly
- internal override bool IsProfileAssembly
- {
- [System.Security.SecurityCritical]
- get
- {
- return GetIsProfileAssembly(GetNativeHandle());
- }
- }
-#endif // FEATURE_CORECLR
-
[System.Security.SecurityCritical] // auto-generated
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
[SuppressUnmanagedCodeSecurity]
// AssemblyAttributes.cspp model for the other build types at a future point in time.
#if FEATURE_CORESYSTEM
-// System and System.Core depend on all kinds of things.
-[assembly: InternalsVisibleTo("System, PublicKey=" + _InternalsVisibleToKeys.SilverlightPlatformPublicKeyFull, AllInternalsVisible=false)]
-[assembly: InternalsVisibleTo("System.Core, PublicKey=" + _InternalsVisibleToKeys.SilverlightPlatformPublicKeyFull, AllInternalsVisible=false)]
-
// Depends on things like SuppressUnmanagedCodeAttribute and WindowsRuntimeImportAttribute
[assembly: InternalsVisibleTo("System.Runtime.WindowsRuntime, PublicKey=" + _InternalsVisibleToKeys.EcmaPublicKeyFull, AllInternalsVisible=false)]
// Depends on WindowsRuntimeImportAttribute
[assembly: InternalsVisibleTo("System.Runtime.WindowsRuntime.UI.Xaml, PublicKey=" + _InternalsVisibleToKeys.EcmaPublicKeyFull, AllInternalsVisible=false)]
-// Depends on things like FormattingServices and System.Reflection.Pointer
-// For mango appcompat also needs access to System.Version..ctor() in order to deserialize Version
-[assembly: InternalsVisibleTo("System.Runtime.Serialization, PublicKey=" + _InternalsVisibleToKeys.SilverlightPlatformPublicKeyFull, AllInternalsVisible=false)]
-
-// Depends on things like System.Number
-[assembly: InternalsVisibleTo("System.Numerics, PublicKey=" + _InternalsVisibleToKeys.SilverlightPublicKeyFull, AllInternalsVisible=false)]
-
-// Depends on things like internal constructor on TypeInfo as well as few other internal reflection members
-[assembly: InternalsVisibleTo("System.Reflection.Context, PublicKey=" + _InternalsVisibleToKeys.SilverlightPlatformPublicKeyFull, AllInternalsVisible=false)]
-
-// Depends on things like EncoderExptionFallback and EncoderFallback
-[assembly: InternalsVisibleTo("System.Xml, PublicKey=" + _InternalsVisibleToKeys.SilverlightPlatformPublicKeyFull, AllInternalsVisible=false)]
-
-// See ndp\fx\src\ReferenceAssemblies\WindowsPhone\v8.0\mscorlib\mscorlib.Private.cs for the exact set of internal API's
-// System.Windows, System.Windows.RuntimeHost, and System.Net use.
-[assembly: InternalsVisibleTo("System.Windows, PublicKey=" + _InternalsVisibleToKeys.SilverlightPlatformPublicKeyFull, AllInternalsVisible=false)]
-[assembly: InternalsVisibleTo("System.Windows.RuntimeHost, PublicKey=" + _InternalsVisibleToKeys.SilverlightPlatformPublicKeyFull, AllInternalsVisible=false)]
-[assembly: InternalsVisibleTo("System.Net, PublicKey=" + _InternalsVisibleToKeys.SilverlightPlatformPublicKeyFull, AllInternalsVisible=false)]
-
internal class _InternalsVisibleToKeys
{
// Token = b77a5c561934e089
internal const string EcmaPublicKeyFull = "00000000000000000400000000000000";
-
- // Token = b03f5f7f11d50a3a
- internal const string MicrosoftPublicKeyFull = "002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293";
-
- // Token = 7cec85d7bea7798e
- internal const string SilverlightPlatformPublicKeyFull= "00240000048000009400000006020000002400005253413100040000010001008D56C76F9E8649383049F383C44BE0EC204181822A6C31CF5EB7EF486944D032188EA1D3920763712CCB12D75FB77E9811149E6148E5D32FBAAB37611C1878DDC19E20EF135D0CB2CFF2BFEC3D115810C3D9069638FE4BE215DBF795861920E5AB6F7DB2E2CEEF136AC23D5DD2BF031700AEC232F6C6B1C785B4305C123B37AB";
-
- // Token = 31bf3856ad364e35 (also known as SharedLibPublicKey)
- internal const string SilverlightPublicKeyFull = "0024000004800000940000000602000000240000525341310004000001000100B5FC90E7027F67871E773A8FDE8938C81DD402BA65B9201D60593E96C492651E889CC13F1415EBB53FAC1131AE0BD333C5EE6021672D9718EA31A8AEBD0DA0072F25D87DBA6FC90FFD598ED4DA35E44C398C454307E8E33B8426143DAEC9F596836F97C8F74750E5975C64E2189F45DEF46B2A2B1247ADC3652BF5C308055DA9";
}
#endif // FEATURE_CORESYS
#include "thekey.h"
#include "ecmakey.h"
-#ifdef FEATURE_STRONGNAME_TESTKEY_ALLOWED
-#include "thetestkey.h"
-
-BYTE g_rbTestKeyBuffer[] = { TEST_KEY_HEADER TEST_KEY_BUFFER };
-#endif // FEATURE_STRONGNAME_TESTKEY_ALLOWED
-
//---------------------------------------------------------------------------------------
//
// Check to see if a public key blob is the ECMA public key blob
}
#endif //FEATURE_CORECLR
-#ifdef FEATURE_STRONGNAME_TESTKEY_ALLOWED
-
-//---------------------------------------------------------------------------------------
-//
-// Check to see if a public key blob is the Silverlight Platform public key blob
-//
-// See code:g_rbTestKeyBuffer#TestKeyStamping
-//
-// Arguments:
-// pbKey - public key blob to check
-// cbKey - size in bytes of pbKey
-//
-
-bool StrongNameIsTestKey(__in_ecount(cbKey) const BYTE *pbKey, DWORD cbKey)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- // The key should be the same size as the ECMA key
- if (cbKey != sizeof(g_rbTestKeyBuffer) - 2 * sizeof(GUID))
- {
- return false;
- }
-
- const PublicKeyBlob *pKeyBlob = reinterpret_cast<const PublicKeyBlob *>(pbKey);
- return StrongNameIsTestKey(*pKeyBlob);
-}
-
-//---------------------------------------------------------------------------------------
-//
-// Determine if the public key blob is the test public key stamped into the VM.
-//
-// See code:g_rbTestKeyBuffer#TestKeyStamping
-//
-// Arguments:
-// keyPublicKey - public key blob to check for emptyness
-//
-
-bool StrongNameIsTestKey(const PublicKeyBlob &keyPublicKey)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- // Find the blob in the VM by looking past the two header GUIDs in the buffer
- _ASSERTE(sizeof(g_rbTestKeyBuffer) > 2 * sizeof(GUID) + sizeof(PublicKeyBlob));
- const PublicKeyBlob *pbTestPublicKey = reinterpret_cast<const PublicKeyBlob *>(g_rbTestKeyBuffer + 2 * sizeof(GUID));
-
- DWORD cbTestPublicKey = StrongNameSizeOfPublicKey(*pbTestPublicKey);
- DWORD cbCheckPublicKey = StrongNameSizeOfPublicKey(keyPublicKey);
-
- // Check whether valid test key was stamped in
- if (cbTestPublicKey == 0)
- return false;
-
- // This is the test public key if it is the same size as the public key in the buffer, and is identical
- // to the test key as well.
- return cbTestPublicKey == cbCheckPublicKey &&
- memcmp(reinterpret_cast<const void *>(pbTestPublicKey), reinterpret_cast<const void *>(&keyPublicKey), cbTestPublicKey) == 0;
-}
-
-#endif // FEATURE_STRONGNAME_TESTKEY_ALLOWED
-
//---------------------------------------------------------------------------------------
//
// Verify that a public key blob looks like a reasonable public key
#define CALG_SHA_512 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA_512)
#endif //ALG_SID_SHA_256
-#ifdef FEATURE_STRONGNAME_TESTKEY_ALLOWED
-bool StrongNameIsTestKey(__in_ecount(cbKey) const BYTE *pbKey, DWORD cbKey);
-bool StrongNameIsTestKey(const PublicKeyBlob &keyPublicKey);
-#endif // FEATURE_STRONGNAME_TESTKEY_ALLOWED
-
// Determine the number of bytes in a public key
DWORD StrongNameSizeOfPublicKey(const PublicKeyBlob &keyPublicKey);
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-// This file allows customization of the test strongname key used in place of the real MS key
-
-#ifdef FEATURE_STRONGNAME_TESTKEY_ALLOWED
-
-//
-// #TestKeyStamping
-//
-// On CoreCLR, we have a requirement that only keys signed with the Microsoft public key can be considered
-// part of the platform and therefore contain critical code. This leads to an issue with testing the
-// product, since any tests which need to test platform only feautres would need to be signed by the
-// Microsoft public key, and for a variety of reasons it is not feasable to sign all of our test assemblies
-// with that key.
-//
-// Instead, we provide an extension where any assembly signed with the public key contained in the
-// g_rbTestKeyBuffer will also be considered part of the platform. The buffer is filled with a zero key,
-// which means by default non-Microsoft signatures will not be accepted. However, the slstampkey tool looks
-// for the two GUIDs in the beginning of the buffer, and can replace the key with a real one of the test
-// team's choosing. Once this modification is in place, test assemblies can be considered part of the
-// platform and can access critical APIs.
-//
-// Since this buffer is searched for in the VM using external tools, it's very important that it only appear
-// once in the final image of the runtime. If it appears multiple times, tools will be unable to determine
-// which test key buffer is the real buffer, and therefore tests which rely on containing platform code will
-// be unable to run on the build.
-//
-
-#define TEST_KEY_HEADER \
- /* Test key buffer header 1: { cd517db8-a1b1-44bf-aa64-bf66fefa3831 } */ \
- 0xb8, 0x7d, 0x51, 0xcd, 0xb1, 0xa1, 0xbf, 0x44, 0x64, 0xaa, 0xbf, 0x66, 0xfe, 0xfa, 0x38, 0x31, \
- \
- /* Test key buffer header 2: { 5f363032-eaaf-4103-b312-ab2c8e35cf58 } */ \
- 0x32, 0x30, 0x36, 0x5f, 0xaf, 0xea, 0x03, 0x41, 0x12, 0xb3, 0xab, 0x2c, 0x8e, 0x35, 0xcf, 0x58,
-
-
-#define TEST_KEY_VALUE \
- /* SigAlgId = */\
- 0x00, 0x24, 0x00, 0x00, \
- \
- /* HashAlgId = */\
- 0x04, 0x80, 0x00, 0x00, \
- \
- /* cbPublicKey = 0x94 */ \
- 0x94, 0x00, 0x00, 0x00, \
- \
- /* 1024 bit public key */ \
- 0x06, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x52, 0x53, 0x41, 0x31, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, \
- 0x0f, 0xc5, 0x99, 0x3e, 0x0f, 0x51, 0x1a, 0xd5, 0xe1, 0x6e, 0x8b, 0x22, 0x65, 0x53, 0x49, 0x3e, 0x09, 0x06, 0x7a, 0xfc, \
- 0x41, 0x03, 0x9f, 0x70, 0xda, 0xeb, 0x94, 0xa9, 0x68, 0xd6, 0x64, 0xf4, 0x0e, 0x69, 0xa4, 0x6b, 0x61, 0x7d, 0x15, 0xd3, \
- 0xd5, 0x32, 0x8b, 0xe7, 0xdb, 0xed, 0xd0, 0x59, 0xeb, 0x98, 0x49, 0x5a, 0x3b, 0x03, 0xcb, 0x4e, 0xa4, 0xba, 0x12, 0x74, \
- 0x44, 0x67, 0x1c, 0x3c, 0x84, 0xcb, 0xc1, 0xfd, 0xc3, 0x93, 0xd7, 0xe1, 0x0b, 0x5e, 0xe3, 0xf3, 0x1f, 0x5a, 0x29, 0xf0, \
- 0x05, 0xe5, 0xee, 0xd7, 0xe3, 0xc9, 0xc8, 0xaf, 0x74, 0xf4, 0x13, 0xf0, 0x00, 0x4f, 0x0c, 0x2c, 0xab, 0xb2, 0x2f, 0x9d, \
- 0xd4, 0xf7, 0x5a, 0x6f, 0x59, 0x97, 0x84, 0xe1, 0xba, 0xb7, 0x09, 0x85, 0xef, 0x81, 0x74, 0xca, 0x6c, 0x68, 0x42, 0x78, \
- 0xbe, 0x82, 0xce, 0x05, 0x5a, 0x03, 0xeb, 0xaf
-
- //
- // Test Public key blob
- //
-
- //
- // No prestamped test key - create an empty key buffer
- //
-#define TEST_KEY_BUFFER \
- /* SigAlgId */ \
- 0x00, 0x00, 0x00, 0x00, \
- \
- /* HashAlgId */ \
- 0x00, 0x00, 0x00, 0x00, \
- \
- /* cbPublicKey = 0x94 - this needs to match the size of the public key section below */ \
- 0x94, 0x00, 0x00, 0x00, \
- \
- /* 1024 bit public key - 0x94 bytes */ \
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-
-#endif // FEATURE_STRONGNAME_TESTKEY_ALLOWED
return (m_dwFlags & IGNORE_UNHANDLED_EXCEPTIONS);
}
-#if defined(FEATURE_CORECLR)
- void SetEnablePInvokeAndClassicComInterop()
- {
- LIMITED_METHOD_CONTRACT;
-
- m_dwFlags |= ENABLE_PINVOKE_AND_CLASSIC_COMINTEROP;
- }
-
- BOOL EnablePInvokeAndClassicComInterop()
- {
- LIMITED_METHOD_CONTRACT;
-
- return (m_dwFlags & ENABLE_PINVOKE_AND_CLASSIC_COMINTEROP);
- }
-
- void SetAllowPlatformSpecificAppAssemblies()
- {
- LIMITED_METHOD_CONTRACT;
-
- m_dwFlags |= ENABLE_SKIP_PLAT_CHECKS;
- }
-
- BOOL AllowPlatformSpecificAppAssemblies()
- {
- LIMITED_METHOD_CONTRACT;
- if(IsCompilationDomain())
- return TRUE;
-
- return (m_dwFlags & ENABLE_SKIP_PLAT_CHECKS);
- }
-
- void SetAllowLoadFile()
- {
- LIMITED_METHOD_CONTRACT;
-
- m_dwFlags |= ENABLE_ASSEMBLY_LOADFILE;
- }
-
- BOOL IsLoadFileAllowed()
- {
- LIMITED_METHOD_CONTRACT;
-
- return (m_dwFlags & ENABLE_ASSEMBLY_LOADFILE);
- }
-
- void DisableTransparencyEnforcement()
- {
- LIMITED_METHOD_CONTRACT;
-
- m_dwFlags |= DISABLE_TRANSPARENCY_ENFORCEMENT;
- }
-
- BOOL IsTransparencyEnforcementDisabled()
- {
- LIMITED_METHOD_CONTRACT;
-
- return (m_dwFlags & DISABLE_TRANSPARENCY_ENFORCEMENT);
- }
-#endif // defined(FEATURE_CORECLR)
-
void SetPassiveDomain()
{
LIMITED_METHOD_CONTRACT;
#ifndef DACCESS_COMPILE
-#ifdef FEATURE_FRAMEWORK_INTERNAL
-
-// static
-const LPCSTR FriendAssemblyDescriptor::AllInternalsVisibleProperty = "AllInternalsVisible";
-
-#endif // FEATURE_FRAMEWORK_INTERNAL
-
FriendAssemblyDescriptor::FriendAssemblyDescriptor()
-#ifdef FEATURE_FRAMEWORK_INTERNAL
- : m_crstFriendMembersCache(CrstFriendAccessCache)
-#endif // FEATURE_FRAMEWORK_INTERNAL
{
-#ifdef FEATURE_FRAMEWORK_INTERNAL
- LockOwner lockOwner = { &m_crstFriendMembersCache, IsOwnerOfCrst };
- m_htFriendMembers.Init(FriendMemberHashSize, &lockOwner);
-#endif // FEATURE_FRAMEWORK_INTERNAL
}
FriendAssemblyDescriptor::~FriendAssemblyDescriptor()
delete pFriendAssemblyName;
#endif // FEATURE_FUSION
}
-
-#if FEATURE_FRAMEWORK_INTERNAL
- ArrayList::Iterator itPartialAccessAssemblies = m_alPartialAccessFriendAssemblies.Iterate();
- while (itPartialAccessAssemblies.Next())
- {
- FriendAssemblyName_t *pFriendAssemblyName = static_cast<FriendAssemblyName_t *>(itPartialAccessAssemblies.GetElement());
-#ifdef FEATURE_FUSION
- pFriendAssemblyName->Release();
-#else // FEATURE_FUSION
- delete pFriendAssemblyName;
-#endif // FEATURE_FUSION
- }
-#endif // FEATURE_FRAMEWORK_INTERNAL
}
}
#endif // !defined(FEATURE_CORECLR)
-#ifdef FEATURE_FRAMEWORK_INTERNAL
- bool fAllInternalsVisible = true;
-
- // Framework internal is only available for framework assemblies
- if (pAssembly->IsProfileAssembly())
- {
- //
- // Find out if the friend assembly is allowed access to all internals, or only selected internals.
- // We default to true for compatibility with behavior of previous runtimes.
- //
-
- CaNamedArg allInternalsArg;
- allInternalsArg.InitBoolField(const_cast<LPCSTR>(AllInternalsVisibleProperty), true);
- hr = ParseKnownCaNamedArgs(cap, &allInternalsArg, 1);
- if (FAILED(hr) && hr != META_E_CA_UNKNOWN_ARGUMENT)
- {
- IfFailThrow(hr);
- }
-
- fAllInternalsVisible = !!allInternalsArg.val.u1;
- }
-
- pFriendAssemblies->AddFriendAssembly(pFriendAssemblyName, fAllInternalsVisible);
-
-#else // FEATURE_FRAMEWORK_INTERNAL
pFriendAssemblies->AddFriendAssembly(pFriendAssemblyName);
-#endif // FEATURE_FRAMEWORK_INTERNAL
pFriendAssemblyName.SuppressRelease();
}
// see if an assembly has already been added to the friend assembly list.
//
-#ifdef FEATURE_FRAMEWORK_INTERNAL
-void FriendAssemblyDescriptor::AddFriendAssembly(FriendAssemblyName_t *pFriendAssembly, bool fAllInternalsVisible)
-#else // FEATURE_FRAMEWORK_INTERNAL
void FriendAssemblyDescriptor::AddFriendAssembly(FriendAssemblyName_t *pFriendAssembly)
-#endif // FEATURE_FRAMEWORK_INTERNAL
{
CONTRACTL
{
}
CONTRACTL_END
-#ifdef FEATURE_FRAMEWORK_INTERNAL
- if (fAllInternalsVisible)
-#endif // FEATURE_FRAMEWORK_INTERNAL
- {
- m_alFullAccessFriendAssemblies.Append(pFriendAssembly);
- }
-#ifdef FEATURE_FRAMEWORK_INTERNAL
- else
- {
- m_alPartialAccessFriendAssemblies.Append(pFriendAssembly);
- }
-#endif // FEATURE_FRAMEWORK_INTERNAL
+ m_alFullAccessFriendAssemblies.Append(pFriendAssembly);
}
void FriendAssemblyDescriptor::AddSubjectAssembly(FriendAssemblyName_t *pFriendAssembly)
m_subjectAssemblies.Append(pFriendAssembly);
}
-#ifdef FEATURE_FRAMEWORK_INTERNAL
-
-//
-// Helpers to see if a member is internal, and therefore could be considered for friend access.
-//
-
-// static
-bool FriendAssemblyDescriptor::FriendAccessAppliesTo(FieldDesc *pFD)
-{
- LIMITED_METHOD_CONTRACT;
-
- DWORD dwFieldProtection = pFD->GetFieldProtection();
- return IsFdAssembly(dwFieldProtection) ||
- IsFdFamANDAssem(dwFieldProtection) ||
- IsFdFamORAssem(dwFieldProtection);
-}
-
-// static
-bool FriendAssemblyDescriptor::FriendAccessAppliesTo(MethodDesc *pMD)
-{
- LIMITED_METHOD_CONTRACT;
-
- DWORD dwMethodProtection = pMD->GetAttrs();
- return IsMdAssem(dwMethodProtection) ||
- IsMdFamANDAssem(dwMethodProtection) ||
- IsMdFamORAssem(dwMethodProtection);
-}
-
-// static
-bool FriendAssemblyDescriptor::FriendAccessAppliesTo(MethodTable *pMT)
-{
- LIMITED_METHOD_CONTRACT;
-
- DWORD dwTypeProtection = pMT->GetClass()->GetProtection();
- return IsTdNotPublic(dwTypeProtection) ||
- IsTdNestedAssembly(dwTypeProtection) ||
- IsTdNestedFamANDAssem(dwTypeProtection) ||
- IsTdNestedFamORAssem(dwTypeProtection);
-}
-
-//
-// Helper methods to get the metadata token for items that may have the FriendAccessAllowed attribute.
-//
-
-// static
-mdToken FriendAssemblyDescriptor::GetMetadataToken(FieldDesc *pFD)
-{
- WRAPPER_NO_CONTRACT;
- return pFD->GetMemberDef();
-}
-
-// static
-mdToken FriendAssemblyDescriptor::GetMetadataToken(MethodDesc *pMD)
-{
- WRAPPER_NO_CONTRACT;
- return pMD->GetMemberDef();
-}
-
-// static
-mdToken FriendAssemblyDescriptor::GetMetadataToken(MethodTable *pMT)
-{
- WRAPPER_NO_CONTRACT;
- return pMT->GetCl();
-}
-
-// static
-bool FriendAssemblyDescriptor::HasFriendAccessAttribute(IMDInternalImport *pMDImport, mdToken tkMember)
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- PRECONDITION(CheckPointer(pMDImport));
- }
- CONTRACTL_END;
-
- const BYTE *pbAttribute = NULL;
- ULONG cbAttribute = 0;
- HRESULT hr = pMDImport->GetCustomAttributeByName(tkMember,
- FRIEND_ACCESS_ALLOWED_ATTRIBUTE_TYPE,
- reinterpret_cast<const void **>(&pbAttribute),
- &cbAttribute);
- IfFailThrow(hr);
-
- return hr == S_OK;
-}
-
-#endif // FEATURE_FRAMEWORK_INTERNAL
-
// static
bool FriendAssemblyDescriptor::IsAssemblyOnList(PEAssembly *pAssembly, const ArrayList &alAssemblyNames)
{
}
CONTRACTL_END;
-#ifdef FEATURE_FRAMEWORK_INTERNAL
- if (IsAssemblyOnList(pAccessingAssembly, m_alPartialAccessFriendAssemblies))
- {
- return FriendAccessAppliesTo(pMember) && IsMemberVisibleToFriends(pMember);
- }
- else
-#endif // FEATURE_FRAMEWORK_INTERNAL
- if (IsAssemblyOnList(pAccessingAssembly, m_alFullAccessFriendAssemblies))
- {
- return true;
- }
-#if defined(FEATURE_STRONGNAME_TESTKEY_ALLOWED) && defined(FEATURE_FRAMEWORK_INTERNAL)
- else if (pMember->GetModule()->GetFile()->GetAssembly()->IsProfileAssembly()&&
- pAccessingAssembly->GetManifestFile() != NULL &&
- pAccessingAssembly->GetManifestFile()->IsProfileTestAssembly())
- {
- // Test hook - All platoform assemblies consider any test assembly which is part of the profile to implicitly
- // be on the friends list. This allows test access to the framework internal attributes, without
- // having to add test assemblies to the explicit friend assembly list.
- return FriendAccessAppliesTo(pMember) && IsMemberVisibleToFriends(pMember);
- }
-#endif // FEATURE_STRONGNAME_TESTKEY_ALLOWED && FEATURE_FRAMEWORK_INTERNAL
- else
- {
- return false;
- }
+ return IsAssemblyOnList(pAccessingAssembly, m_alFullAccessFriendAssemblies);
}
#ifndef FEATURE_CORECLR
}
CONTRACTL_END;
-#ifdef FEATURE_FRAMEWORK_INTERNAL
- if (IsAssemblyOnList(pAccessingAssembly, m_alPartialAccessFriendAssemblies))
- {
- return true;
- }
- else
-#endif // FEATURE_FRAMEWORK_INTERNAL
- if (IsAssemblyOnList(pAccessingAssembly, m_alFullAccessFriendAssemblies))
- {
- return true;
- }
- return false;
+ return IsAssemblyOnList(pAccessingAssembly, m_alFullAccessFriendAssemblies);
}
#endif // !FEATURE_CORECLR
}
private:
-#ifdef FEATURE_FRAMEWORK_INTERNAL
- static const LPCSTR AllInternalsVisibleProperty;
- static const DWORD FriendMemberHashSize = 31; // Number of buckets in the friend member hash table
-#endif // FEATURE_FRAMEWORK_INTERNAL
-
#ifdef FEATURE_FUSION
typedef IAssemblyName FriendAssemblyName_t;
typedef NonVMComHolder<IAssemblyName> FriendAssemblyNameHolder;
ArrayList m_alFullAccessFriendAssemblies; // Friend assemblies which have access to all internals
ArrayList m_subjectAssemblies; // Subject assemblies which we will not perform access checks against
-#ifdef FEATURE_FRAMEWORK_INTERNAL
- ArrayList m_alPartialAccessFriendAssemblies; // Friend assemblies which have access to only specific internals
- EEPtrHashTable m_htFriendMembers; // Cache of internal members checked for visibility to friend assemblies
- Crst m_crstFriendMembersCache; // Critical section guarding m_htFriendMembers
-#endif // FEATURE_FRAMEWORK_INTERNAL
-
FriendAssemblyDescriptor();
-#ifdef FEATURE_FRAMEWORK_INTERNAL
- void AddFriendAssembly(FriendAssemblyName_t *pFriendAssembly, bool fAllInternalsVisible);
-#else // FEATURE_FRAMEWORK_INTERNAL
void AddFriendAssembly(FriendAssemblyName_t *pFriendAssembly);
-#endif // FEATURE_FRAMEWORK_INTERNAL
void AddSubjectAssembly(FriendAssemblyName_t *pSubjectAssembly);
-#ifdef FEATURE_FRAMEWORK_INTERNAL
- static
- bool FriendAccessAppliesTo(FieldDesc *pFD);
-
- static
- bool FriendAccessAppliesTo(MethodDesc *pMD);
-
- static
- bool FriendAccessAppliesTo(MethodTable *pMT);
-
- static
- mdToken GetMetadataToken(FieldDesc *pFD);
-
- static
- mdToken GetMetadataToken(MethodDesc *pMD);
-
- static
- mdToken GetMetadataToken(MethodTable *pMT);
-
- static
- bool HasFriendAccessAttribute(IMDInternalImport *pMDImport);
-#endif // FEATURE_FRAMEWORK_INTERNAL
-
static
bool IsAssemblyOnList(Assembly *pAssembly, const ArrayList &alAssemblyNames)
{
static
bool IsAssemblyOnList(PEAssembly *pAssembly, const ArrayList &alAssemblyNames);
-
-#ifdef FEATURE_FRAMEWORK_INTERNAL
- bool HasFriendAccessAttribute(IMDInternalImport *pMDImport, mdToken tkMember);
-
- //---------------------------------------------------------------------------------------
- //
- // Checks to see if a specific member has the FriendAccessAllowed attribute
- //
- //
-
- template<class T>
- bool IsMemberVisibleToFriends(T *pMember)
- {
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- PRECONDITION(CheckPointer(pMember));
- PRECONDITION(FriendAccessAppliesTo(pMember));
- }
- CONTRACTL_END;
-
- CrstHolder lock(&m_crstFriendMembersCache);
-
- HashDatum hd;
- if (!m_htFriendMembers.GetValue(pMember, &hd))
- {
- bool fAllowsAccess = HasFriendAccessAttribute(pMember->GetMDImport(), GetMetadataToken(pMember));
- hd = reinterpret_cast<HashDatum>(fAllowsAccess);
-
- m_htFriendMembers.InsertValue(pMember, hd);
- }
-
- return static_cast<bool>(!!hd);
- }
-#endif // FEATURE_FRAMEWORK_INTERNAL
};
#endif // !DACCESS_COMPILE
return pAssembly;
}
-#ifdef FEATURE_CORECLR
-// static
-void QCALLTYPE AssemblyNative::LoadFromUnmanagedArray(CLR_BOOL fForIntrospection, BYTE* pAssemblyData, UINT64 uAssemblyLength, BYTE* pPDBData, UINT64 uPDBLength, QCall::StackCrawlMarkHandle stackMark, QCall::ObjectHandleOnStack retAssembly)
-{
- QCALL_CONTRACT;
-
- DomainAssembly * pDomainAssembly = NULL;
-
- BEGIN_QCALL;
- Assembly* pAssembly = NULL;
- GCX_COOP();
- pAssembly=LoadFromBuffer(fForIntrospection, pAssemblyData, uAssemblyLength, pPDBData, uPDBLength, stackMark, NULL, kCurrentAppDomain);
- pDomainAssembly = pAssembly->GetDomainAssembly();
- retAssembly.Set(pDomainAssembly->GetExposedAssemblyObject());
- END_QCALL;
-}
-#endif // FEATURE_CORECLR
-
-
-
-
-
FCIMPL6(Object*, AssemblyNative::LoadImage, U1Array* PEByteArrayUNSAFE,
U1Array* SymByteArrayUNSAFE, Object* securityUNSAFE,
StackCrawlMark* stackMark, CLR_BOOL fForIntrospection, SecurityContextSource securityContextSource)
HELPER_METHOD_FRAME_BEGIN_RET_PROTECT(gc);
-#ifdef FEATURE_CORECLR
- if(!GetAppDomain()->IsLoadFileAllowed())
- COMPlusThrow(kNotSupportedException);
-#endif
-
if(CorHost2::IsLoadFromBlocked())
COMPlusThrow(kFileLoadException, FUSION_E_LOADFROM_BLOCKED);
END_QCALL;
}
-#ifdef FEATURE_LEGACYNETCF
-BOOL QCALLTYPE AssemblyNative::GetIsProfileAssembly(QCall::AssemblyHandle pAssembly)
-{
- QCALL_CONTRACT;
-
- BOOL fIsProfile = FALSE;
-
- BEGIN_QCALL;
-
- fIsProfile = pAssembly->GetFile()->IsProfileAssembly();
-
- END_QCALL;
-
- return fIsProfile;
-}
-#endif // FEATURE_LEGACYNETCF
-
//
// QCalls to determine if everything introduced by the assembly is either security critical or safe critical
//
static FCDECL2(Object*, LoadFile, StringObject* pathUNSAFE,
Object* securityUNSAFE);
static FCDECL6(Object*, LoadImage, U1Array* PEByteArrayUNSAFE, U1Array* SymByteArrayUNSAFE, Object* securityUNSAFE, StackCrawlMark* stackMark, CLR_BOOL fForIntrospection, SecurityContextSource securityContextSource);
-#ifdef FEATURE_CORECLR
- static
- void QCALLTYPE LoadFromUnmanagedArray(CLR_BOOL fForIntrospection,
- BYTE* pAssembly,
- UINT64 uAssemblyLength,
- BYTE* pPDB,
- UINT64 uPDBLength,
- QCall::StackCrawlMarkHandle stackMark,
- QCall::ObjectHandleOnStack retAssembly);
-#endif
#ifdef FEATURE_HOSTED_BINDER
static FCDECL9(Object*, Load, AssemblyNameBaseObject* assemblyNameUNSAFE,
static
void QCALLTYPE GetImageRuntimeVersion(QCall::AssemblyHandle pAssembly, QCall::StringHandleOnStack retString);
-#ifdef FEATURE_LEGACYNETCF
- static
- BOOL QCALLTYPE GetIsProfileAssembly(QCall::AssemblyHandle pAssembly);
-#endif // FEATURE_LEGACYNETCF
-
static
INT64 QCALLTYPE GetHostContext(QCall::AssemblyHandle pAssembly);
if (visibilityCheck && Security::IsTransparencyEnforcementEnabled())
{
// In CoreCLR RMA means visibility checks always succeed if the target is user code.
- if ((m_accessCheckType == kRestrictedMemberAccess || m_accessCheckType == kRestrictedMemberAccessNoTransparency) &&
- !Security::IsMicrosoftPlatform(pTargetMT->GetAssembly()->GetSecurityDescriptor()))
+ if (m_accessCheckType == kRestrictedMemberAccess || m_accessCheckType == kRestrictedMemberAccessNoTransparency)
return TRUE;
// Accessing private types/members in platform code.
MethodDesc* pCallerMD = pContext->GetCallerMethod();
- // Platform critical code is exempted from all accessibility rules, regardless of the AccessCheckType.
+ // critical code is exempted from all accessibility rules, regardless of the AccessCheckType.
if (pCallerMD != NULL &&
- !Security::IsMethodTransparent(pCallerMD)
- && Security::IsMicrosoftPlatform(pCallerMD->GetAssembly()->GetSecurityDescriptor()))
+ !Security::IsMethodTransparent(pCallerMD))
{
return TRUE;
}
return TRUE;
}
-#if defined(FEATURE_CORECLR) && defined(CROSSGEN_COMPILE)
- CONSISTENCY_CHECK_MSGF(!pContext->GetCallerAssembly()->GetManifestFile()->IsProfileAssembly(),
- ("Accessibility check failed while compiling platform assembly. Are you missing FriendAccessAllowed attribute? Caller: %s %s %s Target: %s",
- pContext->GetCallerAssembly() ? pContext->GetCallerAssembly()->GetSimpleName() : "",
- pContext->GetCallerMT() ? pContext->GetCallerMT()->GetDebugClassName() : "",
- pContext->GetCallerMethod() ? pContext->GetCallerMethod()->GetName() : "",
- pTargetMT ? pTargetMT->GetDebugClassName() : ""));
-#endif
-
if (m_fThrowIfTargetIsInaccessible)
{
ThrowAccessException(pContext, pTargetMT);
#include "clrprivtypecachewinrt.h"
#endif
-#ifdef FEATURE_WINDOWSPHONE
-#include "thetestkey.h"
-#endif
-
GVAL_IMPL_INIT(DWORD, g_fHostConfig, 0);
#ifdef FEATURE_IMPLICIT_TLS
#ifdef FEATURE_CORECLR
if (!m_fStarted)
return HOST_E_INVALIDOPERATION;
-
-#if defined(FEATURE_WINDOWSPHONE) && defined(FEATURE_STRONGNAME_TESTKEY_ALLOWED)
- if((APPDOMAIN_SET_TEST_KEY & dwFlags) && (m_dwStartupFlags & STARTUP_SINGLE_APPDOMAIN))
- {
- const BYTE testKey[] = { TEST_KEY_VALUE };
- memcpy_s(g_rbTestKeyBuffer + sizeof(GUID)*2, sizeof(testKey), testKey, sizeof(testKey));
- }
-#endif // defined(FEATURE_WINDOWSPHONE) && defined(FEATURE_STRONGNAME_TESTKEY_ALLOWED)
-
#endif // FEATURE_CORECLR
if(wszFriendlyName == NULL)
{
pDomain->SetIgnoreUnhandledExceptions();
}
-
- // Enable interop for all assemblies if the host has asked us to.
- if (dwFlags & APPDOMAIN_ENABLE_PINVOKE_AND_CLASSIC_COMINTEROP)
- {
- pDomain->SetEnablePInvokeAndClassicComInterop();
- }
-
- if (dwFlags & APPDOMAIN_ENABLE_PLATFORM_SPECIFIC_APPS)
- {
- pDomain->SetAllowPlatformSpecificAppAssemblies();
- }
-
- if (dwFlags & APPDOMAIN_ENABLE_ASSEMBLY_LOADFILE)
- {
- pDomain->SetAllowLoadFile();
- }
-
- if (dwFlags & APPDOMAIN_DISABLE_TRANSPARENCY_ENFORCEMENT)
- {
- pDomain->DisableTransparencyEnforcement();
- }
#endif // FEATURE_CORECLR
- if (dwFlags & APPDOMAIN_SECURITY_FORBID_CROSSAD_REVERSE_PINVOKE)
+ if (dwFlags & APPDOMAIN_SECURITY_FORBID_CROSSAD_REVERSE_PINVOKE)
pDomain->SetReversePInvokeCannotEnter();
if (dwFlags & APPDOMAIN_FORCE_TRIVIAL_WAIT_OPERATIONS)
// On the phone, we only allow platform assemblies to define pinvokes
// unless the host has asked us otherwise.
//
-#ifdef FEATURE_WINDOWSPHONE
- if (!GetAppDomain()->EnablePInvokeAndClassicComInterop())
- {
- if (!pMD->GetModule()->GetFile()->GetAssembly()->IsProfileAssembly())
- COMPlusThrow(kNotSupportedException, W("NotSupported_UserDllImport"));
- }
-#endif //FEATURE_WINDOWS_PHONE
-
if (pMD->IsClassConstructorTriggeredAtLinkTime())
{
}
CONTRACTL_END;
+#ifdef FEATURE_CORECLR
+ return TRUE;
+#else
+
//
// System libraries are a special case, the security info's always OK.
//
return TRUE;
#endif
-#if defined(FEATURE_CORECLR)
- // Lets first check whether the assembly is going to receive full trust
- BOOL fAssemblyIsFullyTrusted = this->GetAppDomain()->IsImageFullyTrusted(pNativeImage);
-
- // Check if the assembly was ngen as platform
- Module * pNativeModule = pNativeImage->GetLoadedLayout()->GetPersistedModuleImage();
- BOOL fImageAndDependenciesAreFullTrust = pNativeModule->m_pModuleSecurityDescriptor->IsMicrosoftPlatform();
-
- // return true only if image was ngen at the same trust level as the current trust level.
- // images ngen'd as fulltrust can only be loaded in fulltrust and
- // non-trusted transparent assembly ngen image can only be loaded in partial trust
- // ( only tranparent assemblies can be ngen'd as partial trust.....if it has critical code ngen will error out)
- return (fAssemblyIsFullyTrusted == fImageAndDependenciesAreFullTrust);
-
-#else // FEATURE_CORECLR
ETWOnStartup (SecurityCatchCall_V1, SecurityCatchCallEnd_V1);
#ifdef CROSSGEN_COMPILE
FCFuncElement("GetSignature", SignatureNative::GetSignature)
FCFuncElement("GetCustomModifiers", SignatureNative::GetCustomModifiers)
FCFuncElement("CompareSig", SignatureNative::CompareSig)
-#if FEATURE_LEGACYNETCF
- FCFuncElement("CompareSigForAppCompat", SignatureNative::CompareSigForAppCompat)
-#endif
FCFuncEnd()
FCFuncStart(gRuntimeMethodHandle)
FCFuncElement("IsConstructor", RuntimeMethodHandle::IsConstructor)
QCFuncElement("Destroy", RuntimeMethodHandle::Destroy)
FCFuncElement("GetResolver", RuntimeMethodHandle::GetResolver)
- QCFuncElement("GetCallerType", RuntimeMethodHandle::GetCallerType)
FCFuncElement("GetLoaderAllocator", RuntimeMethodHandle::GetLoaderAllocator)
FCFuncElement("GetSpecialSecurityFlags", ReflectionInvocation::GetSpecialSecurityFlags)
#ifndef FEATURE_CORECLR
+ QCFuncElement("GetCallerType", RuntimeMethodHandle::GetCallerType)
FCFuncElement("PerformSecurityCheck", ReflectionInvocation::PerformSecurityCheck)
#endif // FEATURE_CORECLR
FCFuncEnd()
QCFuncElement("SetMethodIL", COMDynamicWrite::SetMethodIL)
QCFuncElement("TermCreateClass", COMDynamicWrite::TermCreateClass)
QCFuncElement("DefineField", COMDynamicWrite::DefineField)
- QCFuncElement("SetPInvokeData", COMDynamicWrite::SetPInvokeData)
QCFuncElement("DefineProperty", COMDynamicWrite::DefineProperty)
QCFuncElement("DefineEvent", COMDynamicWrite::DefineEvent)
QCFuncElement("DefineMethodSemantics", COMDynamicWrite::DefineMethodSemantics)
QCFuncElement("SetClassLayout", COMDynamicWrite::SetClassLayout)
QCFuncElement("SetParamInfo", COMDynamicWrite::SetParamInfo)
#ifndef FEATURE_CORECLR
+ QCFuncElement("SetPInvokeData", COMDynamicWrite::SetPInvokeData)
QCFuncElement("SetFieldMarshal", COMDynamicWrite::SetFieldMarshal)
#endif // FEATURE_CORECLR
QCFuncElement("SetConstantValue", COMDynamicWrite::SetConstantValue)
#endif // FEATURE_CAS_POLICY
FCFuncStart(gCompatibilitySwitchFuncs)
- FCFuncElement("IsEnabledInternalCall", CompatibilitySwitch::IsEnabled)
FCFuncElement("GetValueInternalCall", CompatibilitySwitch::GetValue)
#ifndef FEATURE_CORECLR
+ FCFuncElement("IsEnabledInternalCall", CompatibilitySwitch::IsEnabled)
FCFuncElement("GetAppContextOverridesInternalCall", CompatibilitySwitch::GetAppContextOverrides)
#endif
FCFuncEnd()
#ifndef FEATURE_CORECLR
FCFuncElement("GetSecurityDescriptor", AppDomainNative::GetSecurityDescriptor)
FCFuncElement("nIsDefaultAppDomainForEvidence", AppDomainNative::IsDefaultAppDomainForEvidence)
-#endif
-#if defined(FEATURE_CORESYSTEM) || !defined(FEATURE_CORECLR)
FCFuncElement("nGetAssemblies", AppDomainNative::GetAssemblies)
#endif
#ifdef FEATURE_CAS_POLICY
#if FEATURE_COMINTEROP
FCFuncElement("nSetDisableInterfaceCache", AppDomainNative::SetDisableInterfaceCache)
#endif // FEATURE_COMINTEROP
+#ifndef FEATURE_CORECLR
FCFuncElement("_nExecuteAssembly", AppDomainNative::ExecuteAssembly)
+#endif
#ifdef FEATURE_VERSIONING
FCFuncElement("nCreateContext", AppDomainNative::CreateContext)
#endif // FEATURE_VERSIONING
FCFuncElement("IsNewPortableAssembly", AssemblyNative::IsNewPortableAssembly)
#endif
FCFuncElement("nLoadImage", AssemblyNative::LoadImage)
-#ifdef FEATURE_CORECLR
- QCFuncElement("nLoadFromUnmanagedArray", AssemblyNative::LoadFromUnmanagedArray)
-#endif
- FCFuncElement("nLoadFile", AssemblyNative::LoadFile)
#ifndef FEATURE_CORECLR
+ FCFuncElement("nLoadFile", AssemblyNative::LoadFile)
QCFuncElement("LoadModule", AssemblyNative::LoadModule)
#endif // FEATURE_CORECLR
QCFuncElement("GetType", AssemblyNative::GetType)
QCFuncElement("GetExportedTypes", AssemblyNative::GetExportedTypes)
FCFuncElement("GetManifestResourceNames", AssemblyNative::GetManifestResourceNames)
QCFuncElement("GetEntryPoint", AssemblyNative::GetEntryPoint)
-#ifdef FEATURE_LEGACYNETCF
- QCFuncElement("GetIsProfileAssembly", AssemblyNative::GetIsProfileAssembly)
-#endif // FEATURE_LEGACYNETCF
QCFuncElement("IsAllSecurityTransparent", AssemblyNative::IsAllSecurityTransparent)
QCFuncElement("IsAllSecurityCritical", AssemblyNative::IsAllSecurityCritical)
#ifndef FEATURE_CORECLR
#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER)
FCFuncStart(gAssemblyNameFuncs)
-#ifndef FEATURE_CORECLR
- FCFuncElement("nGetFileInformation", AssemblyNameNative::GetFileInformation)
-#endif // FEATURE_CORECLR
+ FCFuncElement("nInit", AssemblyNameNative::Init)
FCFuncElement("nToString", AssemblyNameNative::ToString)
FCFuncElement("nGetPublicKeyToken", AssemblyNameNative::GetPublicKeyToken)
#ifndef FEATURE_CORECLR
FCFuncElement("EscapeCodeBase", AssemblyNameNative::EscapeCodeBase)
-#endif // !FEATURE_CORECLR
- FCFuncElement("nInit", AssemblyNameNative::Init)
FCFuncElement("ReferenceMatchesDefinitionInternal", AssemblyNameNative::ReferenceMatchesDefinition)
+ FCFuncElement("nGetFileInformation", AssemblyNameNative::GetFileInformation)
+#endif // !FEATURE_CORECLR
FCFuncEnd()
FCFuncStart(gLoaderAllocatorFuncs)
FCFuncEnd()
FCFuncStart(gThreadPoolFuncs)
- FCFuncElement("PostQueuedCompletionStatus", ThreadPoolNative::CorPostQueuedCompletionStatus)
#ifndef FEATURE_CORECLR
- FCFuncElement("GetAvailableThreadsNative", ThreadPoolNative::CorGetAvailableThreads)
+ FCFuncElement("PostQueuedCompletionStatus", ThreadPoolNative::CorPostQueuedCompletionStatus)
+ FCFuncElement("GetAvailableThreadsNative", ThreadPoolNative::CorGetAvailableThreads)
#endif // FEATURE_CORECLR
FCFuncElement("SetMinThreadsNative", ThreadPoolNative::CorSetMinThreads)
FCFuncElement("GetMinThreadsNative", ThreadPoolNative::CorGetMinThreads)
}
else
{
-#ifdef FEATURE_WINDOWSPHONE
- //
- // On the phone, anyone can activate WinRT objects, but only platform code can do legacy COM interop.
- // (Hosts can override this.)
- //
- if (!pClassMT->GetModule()->GetFile()->GetAssembly()->IsProfileAssembly() &&
- !GetAppDomain()->EnablePInvokeAndClassicComInterop())
- {
- COMPlusThrow(kNotSupportedException, W("NotSupported_UserCOM"));
- }
-#endif //FEATURE_WINDOWSPHONE
-
GUID guid;
pClassMT->GetGuid(&guid, TRUE);
#ifdef FEATURE_CORECLR
// Transparent methods that contains unverifiable code is not allowed.
MethodDesc *pMethod = GetMethod(methHnd_);
-
-#if defined(FEATURE_CORECLR_COVERAGE_BUILD) && defined(FEATURE_STRONGNAME_DELAY_SIGNING_ALLOWED)
- // For code coverage builds we have an issue where the inserted IL is not verifiable.
- // This means that transparent methods in platform assemblies will throw verification exceptions.
- // Temporary fix is to allow transparent methods in platform assemblies to be unverifiable only on coverage builds.
- // Paranoia: allow this only on non ret builds - all builds except the RET type will have
- // FEATURE_STRONGNAME_DELAY_SIGNING_ALLOWED defined. So we can use that to figure out if this is a RET build
- // type that someone is trying to relax that constraint on and not allow that.
- if (!pMethod->GetModule()->GetFile()->GetAssembly()->IsProfileAssembly())
- {
- // Only throw if pMethod is not in any platform assembly.
- SecurityTransparent::ThrowMethodAccessException(pMethod);
- }
-#else // defined(FEATURE_CORECLR_COVERAGE_BUILD) && defined(FEATURE_STRONGNAME_DELAY_SIGNING_ALLOWED)
-
SecurityTransparent::ThrowMethodAccessException(pMethod);
-#endif // defined(FEATURE_CORECLR_COVERAGE_BUILD) && defined(FEATURE_STRONGNAME_DELAY_SIGNING_ALLOWED)
-
#else // FEATURE_CORECLR
//
// inject a full-demand for unmanaged code permission at runtime
goto exit;
}
-#ifdef FEATURE_CORECLR
- //Skip verification of all methods in profile assemblies. We will ensure that they are all verifiable.
- if (pMethod->GetModule()->GetFile()->GetAssembly()->IsProfileAssembly())
- {
- result = INSTVER_GENERIC_PASSED_VERIFICATION;
- goto exit;
- }
-#endif
-
result = pMethod->IsVerifiable() ? INSTVER_GENERIC_PASSED_VERIFICATION
: INSTVER_GENERIC_FAILED_VERIFICATION;
return IsILOnly();
}
-
-#ifdef FEATURE_CORECLR
-void PEFile::ValidateImagePlatformNeutrality()
-{
- STANDARD_VM_CONTRACT;
-
- //--------------------------------------------------------------------------------
- // There are no useful applications of the "/platform" switch for CoreCLR.
- // CoreCLR will do the conservative thing and by default only accept appbase assemblies
- // compiled with "/platform:anycpu" (or no "/platform" switch at all.)
- // However, with hosting flags it is possible to suppress this check and allow
- // platform specific assemblies. This was primarily added to support C++/CLI
- // generated assemblies build with /CLR:PURE flags. This was a need for the CoreSystem
- // server work.
- //
- // We do allow Platform assemblies to have platform specific code (because they
- // in fact do have such code.
- //--------------------------------------------------------------------------------
- if (!(GetAssembly()->IsProfileAssembly()) && !GetAppDomain()->AllowPlatformSpecificAppAssemblies())
- {
-
- DWORD machine, kind;
- BOOL fMachineOk,fPlatformFlagsOk;
-
-#ifdef FEATURE_TREAT_NI_AS_MSIL_DURING_DIAGNOSTICS
- if (ShouldTreatNIAsMSIL() && GetILimage()->HasNativeHeader())
- {
- GetILimage()->GetNativeILPEKindAndMachine(&kind, &machine);
- }
- else
-#endif // FEATURE_TREAT_NI_AS_MSIL_DURING_DIAGNOSTICS
- {
- //The following function gets the kind and machine given by the IL image.
- //In the case of NGened images- It gets the original kind and machine of the IL image
- //from the copy maintained by NI
- GetPEKindAndMachine(&kind, &machine);
- }
-
- fMachineOk = (machine == IMAGE_FILE_MACHINE_I386);
- fPlatformFlagsOk = ((kind & (peILonly | pe32Plus | pe32BitRequired)) == peILonly);
-
- if (!(fMachineOk &&
- fPlatformFlagsOk))
- {
- // This exception matches what the desktop OS hook throws - unfortunate that this is so undescriptive.
- COMPlusThrowHR(COR_E_BADIMAGEFORMAT);
- }
- }
-}
-#endif
-
#ifdef FEATURE_MIXEDMODE
#ifndef CROSSGEN_COMPILE
// See if we've already loaded it.
if (CheckLoaded(allowNativeSkip))
{
-#ifdef FEATURE_CORECLR
- if (!IsResource() && !IsDynamic())
- ValidateImagePlatformNeutrality();
-#endif //FEATURE_CORECLR
-
#ifdef FEATURE_MIXEDMODE
// Prevent loading C++/CLI images into multiple runtimes in the same process. Note that if ILOnly images
// stop being LoadLibrary'ed, the check for pure 2.0 C++/CLI images will need to be done somewhere else.
RETURN;
}
-#ifdef FEATURE_CORECLR
- ValidateImagePlatformNeutrality();
-#endif //FEATURE_CORECLR
-
#if !defined(_WIN64)
if (!HasNativeImage() && (!GetILimage()->Has32BitNTHeaders()) && !IsIntrospectionOnly())
{
// from the old Silverlight binder, people took advantage of it and we cannot easily get rid of it now. See DevDiv #710462.
//
BOOL bProfileAssembly = IsSourceGAC() && (IsSystem() || m_bIsOnTpaList);
- if(!AppX::IsAppXProcess())
- {
- bProfileAssembly |= IsSourceGAC() && IsSilverlightPlatformStrongNameSignature();
- }
m_fProfileAssembly = bProfileAssembly ? 1 : -1;
return bProfileAssembly;
}
-
-BOOL PEAssembly::IsSilverlightPlatformStrongNameSignature()
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- MODE_ANY;
- }
- CONTRACTL_END;
-
- if (IsDynamic())
- return FALSE;
-
- DWORD cbPublicKey;
- const BYTE *pbPublicKey = static_cast<const BYTE *>(GetPublicKey(&cbPublicKey));
- if (pbPublicKey == nullptr)
- {
- return false;
- }
-
- if (StrongNameIsSilverlightPlatformKey(pbPublicKey, cbPublicKey))
- return true;
-
-#ifdef FEATURE_STRONGNAME_TESTKEY_ALLOWED
- if (StrongNameIsTestKey(pbPublicKey, cbPublicKey))
- return true;
-#endif
-
- return false;
-}
-
-#ifdef FEATURE_STRONGNAME_TESTKEY_ALLOWED
-BOOL PEAssembly::IsProfileTestAssembly()
-{
- WRAPPER_NO_CONTRACT;
-
- return IsSourceGAC() && IsTestKeySignature();
-}
-
-BOOL PEAssembly::IsTestKeySignature()
-{
- WRAPPER_NO_CONTRACT;
-
- if (IsDynamic())
- return FALSE;
-
- DWORD cbPublicKey;
- const BYTE *pbPublicKey = static_cast<const BYTE *>(GetPublicKey(&cbPublicKey));
- if (pbPublicKey == nullptr)
- {
- return false;
- }
-
- return StrongNameIsTestKey(pbPublicKey, cbPublicKey);
-}
-#endif // FEATURE_STRONGNAME_TESTKEY_ALLOWED
-
#endif // FEATURE_CORECLR
// ------------------------------------------------------------
BOOL IsSourceGAC();
#ifdef FEATURE_CORECLR
BOOL IsProfileAssembly();
- BOOL IsSilverlightPlatformStrongNameSignature();
- BOOL IsProfileTestAssembly();
- BOOL IsTestKeySignature();
#endif // FEATURE_CORECLR
ULONG HashIdentity();
LIMITED_METHOD_CONTRACT;
#ifdef FEATURE_CORECLR
- if (GetAppDomain()->IsTransparencyEnforcementDisabled())
- return FALSE;
-#endif
+ // No transparency enforcement in .NET Core
+ return FALSE;
+#else
#ifdef _DEBUG
if (g_pConfig->DisableTransparencyEnforcement())
#endif
return TRUE;
+#endif // FEATURE_CORECLR
}
//---------------------------------------------------------------------------------------
inline SString GetConditionalAptcaAccessExceptionContext(Assembly *pTargetAssembly);
#endif // FEATURE_APTCA
-#ifdef FEATURE_CORECLR
- inline BOOL IsMicrosoftPlatform(IAssemblySecurityDescriptor *pSecDesc);
-#endif // FEATURE_CORECLR
-
inline bool SecurityCalloutQuickCheck(MethodDesc *pCallerMD);
inline bool CanShareAssembly(DomainAssembly *pAssembly);
}
CONTRACTL_END;
+#ifdef FEATURE_CORECLR
+ // Always skip verification on CoreCLR
+ return TRUE;
+#else
+
// Special case the System.Object..ctor:
// System.Object..ctor is not verifiable according to current verifier rules (that require to call the base
// class ctor). But since we want System.Object..ctor() to be marked transparent, it cannot be unverifiable
BOOL fCanSkipVerification = Security::CanSkipVerification(pMD->GetAssembly()->GetDomainAssembly());
if (fCanSkipVerification)
{
-#ifdef FEATURE_CORECLR
- //For Profile assemblies, do not verify any code. All Transparent methods are guaranteed to be
- //verifiable (verified by tests). Therefore, skip all verification on platform assemblies.
- if(pMD->GetAssembly()->GetDomainAssembly()->GetFile()->IsProfileAssembly())
- return TRUE;
-#endif
// check for transparency
if (SecurityTransparent::IsMethodTransparent(pMD))
{
-#ifndef FEATURE_CORECLR
ModuleSecurityDescriptor *pModuleSecDesc = ModuleSecurityDescriptor::GetModuleSecurityDescriptor(pMD->GetAssembly());
if (!pModuleSecDesc->CanTransparentCodeSkipVerification())
-#endif // !FEATURE_CORECLR
{
return FALSE;
}
}
}
-#if defined(_DEBUG) && defined(FEATURE_CORECLR)
- else
- {
- //Profile assemblies must have skip verification.
- _ASSERTE(!pMD->GetAssembly()->GetDomainAssembly()->GetFile()->IsProfileAssembly());
- }
-#endif //_DEBUG && FEATURE_CORECLR
return fCanSkipVerification;
+#endif // !FEATURE_CORECLR
}
#endif //!DACCESS_COMPILE
#endif // FEATURE_APTCA
-#ifdef FEATURE_CORECLR
-#ifndef DACCESS_COMPILE
-
-inline BOOL Security::IsMicrosoftPlatform(IAssemblySecurityDescriptor *pSecDesc)
-{
- WRAPPER_NO_CONTRACT;
- return static_cast<AssemblySecurityDescriptor*>(pSecDesc)->IsMicrosoftPlatform();
-}
-#endif // DACCESS_COMPILE
-#endif // FEATURE_CORECLR
-
-
inline bool Security::SecurityCalloutQuickCheck(MethodDesc *pCallerMD)
{
WRAPPER_NO_CONTRACT;
} CONTRACTL_END;
#ifdef FEATURE_CORECLR
-
- if (NingenEnabled())
- {
- int dwSpecialFlags;
- BOOL platformAssembly = FALSE;
-
- if (IsSystem())
- {
- dwSpecialFlags = 0xFFFFFFFF;
- platformAssembly = TRUE;
- }
- else
- {
- // Decide if this is a platform assembly
- if (m_pAssem->GetFile()->IsProfileAssembly())
- platformAssembly = TRUE;
-
- // Decide trust level
- if (platformAssembly)
- {
- dwSpecialFlags = 0xFFFFFFFF;
- }
- else
- {
- dwSpecialFlags = m_pAppDomain->GetSecurityDescriptor()->GetSpecialFlags();
- }
- }
-
- SetGrantedPermissionSet(NULL, NULL, dwSpecialFlags);
- if (platformAssembly)
- SetMicrosoftPlatform();
-
- return;
- }
-
-#ifndef CROSSGEN_COMPILE
- int dwSpecialFlags;
- BOOL platformAssembly = FALSE;
- BOOL trustedAssembly = FALSE;
-
- struct _gc {
- OBJECTREF granted; // Policy based Granted Permission
- } gc;
- ZeroMemory(&gc, sizeof(gc));
- GCPROTECT_BEGIN(gc);
-
- if (IsSystem())
- {
- // mscorlib is always FT, but we can't create permissionsets yet. So grantset for mscorlib will be NULL: we should never look at it though.
- dwSpecialFlags = 0xFFFFFFFF;
- platformAssembly = TRUE;
- }
- else
- {
- // Decide if this is a platform assembly
- if (m_pAssem->GetFile()->IsProfileAssembly())
- platformAssembly = TRUE;
-
- // Decide trust level
- if (platformAssembly || trustedAssembly)
- {
- Security::GetPermissionInstance(&gc.granted, SECURITY_FULL_TRUST);
- dwSpecialFlags = 0xFFFFFFFF;
- }
- else
- {
- // get grant from AppDomain grant set.
- gc.granted = m_pAppDomain->GetSecurityDescriptor()->GetGrantedPermissionSet(NULL);
- dwSpecialFlags = m_pAppDomain->GetSecurityDescriptor()->GetSpecialFlags();
- }
-
- }
- SetGrantedPermissionSet(gc.granted, NULL, dwSpecialFlags);
- if (platformAssembly)
- SetMicrosoftPlatform();
-
- // Only fully trusted assemblies are allowed to be loaded when
- // the AppDomain is in the initialization phase.
- if (m_pAppDomain->GetSecurityDescriptor()->IsInitializationInProgress() && !IsFullyTrusted())
- COMPlusThrow(kApplicationException, W("Policy_CannotLoadSemiTrustAssembliesDuringInit"));
-
- GCPROTECT_END();
-#endif // CROSSGEN_COMPILE
-
+ SetGrantedPermissionSet(NULL, NULL, 0xFFFFFFFF);
#else
if (CanSkipPolicyResolution() || NingenEnabled()) {
SetGrantedPermissionSet(NULL, NULL, 0xFFFFFFFF);
m_fFullyTrusted = pSecDesc->IsFullyTrusted();
m_fCanCallUnmanagedCode = pSecDesc->CanCallUnmanagedCode();
m_fCanAssert = pSecDesc->CanAssert();
-#ifdef FEATURE_CORECLR
- m_fMicrosoftPlatform = static_cast<AssemblySecurityDescriptor*>(pSecDesc)->IsMicrosoftPlatform();
-#endif // FEATURE_CORECLR
m_fResolved = TRUE;
}
virtual void CheckAllowAssemblyLoad();
-#ifdef FEATURE_CORECLR
- inline BOOL IsMicrosoftPlatform();
-#endif // FEATURE_CORECLR
-
private:
BOOL CanSkipPolicyResolution();
OBJECTREF UpgradePEFileEvidenceToAssemblyEvidence(const OBJECTREF& objPEFileEvidence);
inline BOOL IsConditionalAptca();
#endif // FEATURE_APTCA
-#ifdef FEATURE_CORECLR
- inline void SetMicrosoftPlatform();
-#endif // FEAUTRE_CORECLR
#endif // #ifndef DACCESS_COMPILE
};
virtual BOOL IsSystem();
virtual Assembly* GetAssembly();
- inline BOOL IsMicrosoftPlatform();
BOOL IsFullyTrusted();
BOOL CanCallUnmanagedCode() const;
BOOL CanAssert();
#endif // FEATURE_CAS_POLICY
-#ifdef FEATURE_CORECLR
-
-inline BOOL AssemblySecurityDescriptor::IsMicrosoftPlatform()
-{
- LIMITED_METHOD_CONTRACT;
- return m_fMicrosoftPlatform;
-}
-
-inline void AssemblySecurityDescriptor::SetMicrosoftPlatform()
-{
- LIMITED_METHOD_CONTRACT;
- m_fMicrosoftPlatform = TRUE;
-}
-
-#endif // FEATURE_CORECLR
-
#ifdef FEATURE_APTCA
inline BOOL AssemblySecurityDescriptor::IsConditionalAptca()
#endif // !DACCESS_COMPILE
-inline BOOL SharedSecurityDescriptor::IsMicrosoftPlatform()
-{
- LIMITED_METHOD_CONTRACT;
- return m_fMicrosoftPlatform;
-}
-
inline AssemblyLoadSecurity::AssemblyLoadSecurity() :
m_pEvidence(NULL),
m_pAdditionalEvidence(NULL),
}
#endif // _DEBUG
-#ifdef FEATURE_CORECLR
- if (pAssembly->IsSystem() || (pAssembly->GetManifestFile()->HasOpenedILimage() && GetAppDomain()->IsImageFullyTrusted(pAssembly->GetManifestFile()->GetOpenedILimage())))
- {
- // Set the flag if the assembly is microsoft platform. This gets saved in Ngen Image
- // to determinne if the NI was genrated as full-trust. If NI is generated as full-trust
- // the codegen is generated different as compared to non-trusted.
- _ASSERTE(!(moduleFlags & ModuleSecurityDescriptorFlags_IsMicrosoftPlatform));
- moduleFlags |= ModuleSecurityDescriptorFlags_IsMicrosoftPlatform;
- }
-#endif
-
// Mark the module as having its security state computed
moduleFlags |= ModuleSecurityDescriptorFlags_IsComputed;
InterlockedCompareExchange(reinterpret_cast<LONG *>(&m_flags),
ModuleSecurityDescriptorFlags_IsOpportunisticallyCritical = 0x0020, // Ensure that the assembly follows all transparency rules by making all methods critical or safe critical as needed
ModuleSecurityDescriptorFlags_SkipFullTrustVerification = 0x0040, // Fully trusted transparent code does not require verification
ModuleSecurityDescriptorFlags_TransparentDueToPartialTrust = 0x0080, // Whether we made the assembly all transparent because it was partially-trusted
- ModuleSecurityDescriptorFlags_IsMicrosoftPlatform = 0x0100, // Whether we made the assembly microsoft platform. Stored in ngen image to determine if the ngen
- // was generated as microsoft platform assembly (full trust) or not.
};
inline ModuleSecurityDescriptorFlags operator|(ModuleSecurityDescriptorFlags lhs,
inline ModuleSecurityDescriptorFlags GetRawFlags();
#endif // DACCESS_COMPILE
- // Is Microsoft Platform
- inline BOOL IsMicrosoftPlatform();
-
// Is every method and type in the assembly transparent
inline BOOL IsAllTransparent();
}
#endif // DACCESS_COMPILE
-inline BOOL ModuleSecurityDescriptor::IsMicrosoftPlatform()
-{
- WRAPPER_NO_CONTRACT;
- VerifyDataComputed();
- return !!(m_flags & ModuleSecurityDescriptorFlags_IsMicrosoftPlatform);
-}
-
inline BOOL ModuleSecurityDescriptor::IsAllTransparent()
{
WRAPPER_NO_CONTRACT;
CorInfoCanSkipVerificationResult canSkipVerif = hasSkipVerificationPermisson ? CORINFO_VERIFICATION_CAN_SKIP : CORINFO_VERIFICATION_CANNOT_SKIP;
-#ifdef FEATURE_CORECLR
- //For Profile assemblies, do not verify any code. All Transparent methods are guaranteed to be
- //verifiable (verified by tests). Therefore, skip all verification on platform assemblies.
-
- //All profile assemblies have skip verification.
- _ASSERTE(!(pDomainAssembly->GetFile()->IsProfileAssembly() && !hasSkipVerificationPermisson));
-
-#ifdef FEATURE_CORESYSTEM
- //
- // On Phone, at runtime, enable verification for user code that will run as transparent:
- // - All Mango applications
- // - Apollo applications with transparent code
- //
- if (hasSkipVerificationPermisson && !pDomainAssembly->GetFile()->IsProfileAssembly())
- {
- if (SecurityTransparent::IsMethodTransparent(pMD))
- {
- canSkipVerif = CORINFO_VERIFICATION_CANNOT_SKIP;
- }
- }
-#endif // FEATURE_CORESYSTEM
-
-#else //FEATURE_CORECLR
+#ifndef FEATURE_CORECLR
// also check to see if the method is marked transparent
if (hasSkipVerificationPermisson)
{
}
else
{
-#if defined(FEATURE_CORECLR_COVERAGE_BUILD) && defined(FEATURE_STRONGNAME_DELAY_SIGNING_ALLOWED)
- // For code coverage builds we have an issue where the inserted types/methods are not annotated.
- // In patricular, there may be p/invokes from transparent code. Allow that on cov builds for platform assemblies.
- // Paranoia: allow this only on non shp builds - all builds except the SHP type will have
- // FEATURE_STRONGNAME_DELAY_SIGNING_ALLOWED defined. So we can use that to figure out if this is a SHP build
- // type that someone is trying to relax that constraint on and not allow that.
- if (!pCalleeMD->GetModule()->GetFile()->GetAssembly()->IsProfileAssembly())
-#endif // defined(FEATURE_CORECLR_COVERAGE_BUILD) && defined(FEATURE_STRONGNAME_DELAY_SIGNING_ALLOWED)
- {
- ::ThrowMethodAccessException(pCallerMD, pCalleeMD, FALSE, IDS_E_TRANSPARENT_CALL_NATIVE);
- }
+ ::ThrowMethodAccessException(pCallerMD, pCalleeMD, FALSE, IDS_E_TRANSPARENT_CALL_NATIVE);
}
}