1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
//
//
#ifndef __SECURITYDESCRIPTOR_INL__
#define __SECURITYDESCRIPTOR_INL__
// Inline Functions to support lazy handles - read/write to handle that may not have been created yet
// SecurityDescriptor and ApplicationSecurityDescriptor currently use these
inline OBJECTREF ObjectFromLazyHandle(LOADERHANDLE handle, LoaderAllocator *pLoaderAllocator)
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
SO_TOLERANT;
MODE_COOPERATIVE;
}
CONTRACTL_END;
if (handle != NULL)
{
return pLoaderAllocator->GetHandleValue(handle);
}
else
{
return NULL;
}
}
#ifndef DACCESS_COMPILE
inline SecurityDescriptor::SecurityDescriptor(AppDomain *pAppDomain,
DomainAssembly *pAssembly,
PEFile* pPEFile,
LoaderAllocator *pLoaderAllocator) :
#ifdef FEATURE_CAS_POLICY
m_hAdditionalEvidence(NULL),
#endif // FEATURE_CAS_POLICY
m_pAssem(pAssembly),
m_pPEFile(pPEFile),
m_pAppDomain(pAppDomain),
m_fSDResolved(FALSE),
#ifdef FEATURE_CAS_POLICY
m_fEvidenceComputed(FALSE),
#endif // FEATURE_CAS_POLICY
m_dwSpecialFlags(0),
m_pLoaderAllocator(pLoaderAllocator)
#ifndef CROSSGEN_COMPILE
, m_hGrantedPermissionSet(NULL),
m_hGrantDeniedPermissionSet(NULL)
#endif // CROSSGEN_COMPILE
{
LIMITED_METHOD_CONTRACT;
}
#endif // !DACCESS_COMPILE
#ifdef FEATURE_CAS_POLICY
inline void SecurityDescriptor::SetEvidenceComputed()
{
LIMITED_METHOD_CONTRACT;
m_fEvidenceComputed = TRUE;
}
#endif // FEATURE_CAS_POLICY
// Checks for one of the special security flags such as FullTrust or UnmanagedCode
FORCEINLINE BOOL SecurityDescriptor::CheckSpecialFlag (DWORD flags) const
{
LIMITED_METHOD_CONTRACT;
SUPPORTS_DAC;
return (m_dwSpecialFlags & flags);
}
inline PEFile *SecurityDescriptor::GetPEFile() const
{
LIMITED_METHOD_CONTRACT;
return m_pPEFile;
}
#ifndef DACCESS_COMPILE
template<typename IT>
inline SecurityDescriptorBase<IT>::SecurityDescriptorBase(AppDomain *pAppDomain,
DomainAssembly *pAssembly,
PEFile* pPEFile,
LoaderAllocator *pLoaderAllocator) :
SecurityDescriptor(pAppDomain, pAssembly, pPEFile, pLoaderAllocator)
{
}
#endif // !DACCESS_COMPILE
#ifndef FEATURE_CORECLR
#ifndef DACCESS_COMPILE
inline PEFileSecurityDescriptor::PEFileSecurityDescriptor(AppDomain* pDomain, PEFile *pPEFile) :
SecurityDescriptorBase<IPEFileSecurityDescriptor>(pDomain, NULL,pPEFile, pDomain->GetLoaderAllocator())
{
LIMITED_METHOD_CONTRACT
}
#endif // !DACCESS_COMPILE
#endif // !FEATURE_CORECLR
#endif // #define __SECURITYDESCRIPTOR_INL__
|