blob: f9a5215e3187620754b1259958103359a4c0e6f7 (
plain)
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
111
112
113
114
115
116
117
118
119
120
121
|
// 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.
//
#ifndef PEIMAGEVIEW_INL_
#define PEIMAGEVIEW_INL_
#include "util.hpp"
#include "peimage.h"
inline const SString &PEImageLayout::GetPath()
{
LIMITED_METHOD_CONTRACT;
return m_pOwner?m_pOwner->GetPath():SString::Empty();
}
inline void PEImageLayout::AddRef()
{
CONTRACT_VOID
{
PRECONDITION(m_refCount>0 && m_refCount < COUNT_T_MAX);
NOTHROW;
GC_NOTRIGGER;
}
CONTRACT_END;
FastInterlockIncrement(&m_refCount);
RETURN;
}
inline ULONG PEImageLayout::Release()
{
CONTRACTL
{
DESTRUCTOR_CHECK;
NOTHROW;
MODE_ANY;
FORBID_FAULT;
}
CONTRACTL_END;
#ifdef DACCESS_COMPILE
// when DAC accesses layouts via PEImage it does not addref
if (m_pOwner)
return m_refCount;
#endif
ULONG result=FastInterlockDecrement(&m_refCount);
if (result == 0 )
{
delete this;
}
return result;
}
inline PEImageLayout::~PEImageLayout()
{
CONTRACTL
{
DESTRUCTOR_CHECK;
NOTHROW;
GC_TRIGGERS;
MODE_ANY;
}
CONTRACTL_END;
}
inline PEImageLayout::PEImageLayout()
: m_refCount(1)
, m_pOwner(NULL)
{
LIMITED_METHOD_CONTRACT;
}
inline void PEImageLayout::Startup()
{
CONTRACT_VOID
{
THROWS;
GC_NOTRIGGER;
MODE_ANY;
POSTCONDITION(CheckStartup());
INJECT_FAULT(COMPlusThrowOM(););
}
CONTRACT_END;
if (CheckStartup())
RETURN;
RETURN;
}
inline CHECK PEImageLayout::CheckStartup()
{
WRAPPER_NO_CONTRACT;
CHECK_OK;
}
inline BOOL PEImageLayout::CompareBase(UPTR base, UPTR mapping)
{
CONTRACTL
{
PRECONDITION(CheckPointer((PEImageLayout *)mapping));
PRECONDITION(CheckPointer((PEImageLayout *)(base<<1),NULL_OK));
SO_TOLERANT;
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
if (base==NULL) //we were searching for 'Any'
return TRUE;
return ((PEImageLayout*)mapping)->GetBase()==((PEImageLayout*)(base<<1))->GetBase();
}
#endif //PEIMAGEVIEW_INL_
|