1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4// ============================================================
5//
6// CoreBindResult.inl
7//
8
9//
10// Implements the CoreBindResult class
11// ============================================================
12
13#ifndef __CORE_BIND_RESULT_INL__
14#define __CORE_BIND_RESULT_INL__
15
16#include "clrprivbinderutil.h"
17
18inline BOOL CoreBindResult::Found()
19{
20 LIMITED_METHOD_CONTRACT;
21 return (m_pAssembly!=NULL);
22};
23
24inline BOOL CoreBindResult::IsMscorlib()
25{
26 CONTRACTL
27 {
28 THROWS;
29 MODE_ANY;
30 PRECONDITION(Found());
31 }
32 CONTRACTL_END;
33
34 BINDER_SPACE::Assembly* pAssembly = BINDER_SPACE::GetAssemblyFromPrivAssemblyFast(m_pAssembly);
35#ifndef CROSSGEN_COMPILE
36 return pAssembly->GetAssemblyName()->IsMscorlib();
37#else
38 return (pAssembly->GetPath()).EndsWithCaseInsensitive(SString(CoreLibName_IL_W), PEImage::GetFileSystemLocale());
39#endif
40}
41
42inline void CoreBindResult::GetBindAssembly(ICLRPrivAssembly** ppAssembly)
43{
44 CONTRACTL
45 {
46 NOTHROW;
47 MODE_ANY;
48 PRECONDITION(Found());
49 }
50 CONTRACTL_END;
51
52 m_pAssembly->AddRef();
53 *ppAssembly = m_pAssembly;
54}
55
56
57inline PEImage* CoreBindResult::GetPEImage()
58{
59 WRAPPER_NO_CONTRACT;
60 return m_pAssembly?BINDER_SPACE::GetAssemblyFromPrivAssemblyFast(m_pAssembly)->GetNativeOrILPEImage():NULL;
61};
62
63inline void CoreBindResult::Init(ICLRPrivAssembly* pAssembly)
64{
65 WRAPPER_NO_CONTRACT;
66 m_pAssembly=pAssembly;
67 if(pAssembly)
68 pAssembly->AddRef();
69 m_hrBindResult = S_OK;
70}
71
72inline void CoreBindResult::Reset()
73{
74 WRAPPER_NO_CONTRACT;
75 m_pAssembly=NULL;
76 m_hrBindResult = S_OK;
77}
78#ifdef FEATURE_PREJIT
79inline BOOL CoreBindResult::HasNativeImage()
80{
81 LIMITED_METHOD_CONTRACT;
82 BINDER_SPACE::Assembly* pAssembly = BINDER_SPACE::GetAssemblyFromPrivAssemblyFast(m_pAssembly);
83 return pAssembly->GetNativePEImage() != NULL;
84}
85inline PEImage* CoreBindResult::GetNativeImage()
86{
87 WRAPPER_NO_CONTRACT;
88 _ASSERTE(HasNativeImage());
89 BINDER_SPACE::Assembly* pAssembly = BINDER_SPACE::GetAssemblyFromPrivAssemblyFast(m_pAssembly);
90 return pAssembly->GetNativePEImage();
91}
92
93inline PEImage* CoreBindResult::GetILImage()
94{
95 WRAPPER_NO_CONTRACT;
96 return m_pAssembly?BINDER_SPACE::GetAssemblyFromPrivAssemblyFast(m_pAssembly)->GetPEImage():NULL;
97};
98#endif
99
100inline void CoreBindResult::SetHRBindResult(HRESULT hrBindResult)
101{
102 WRAPPER_NO_CONTRACT;
103 m_hrBindResult = hrBindResult;
104}
105
106inline HRESULT CoreBindResult::GetHRBindResult()
107{
108 WRAPPER_NO_CONTRACT;
109 return m_hrBindResult;
110}
111
112#endif // __CORE_BIND_RESULT_INL__
113
114