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 | #ifndef __CLR_PRIV_BINDER_CORECLR_H__ |
7 | #define __CLR_PRIV_BINDER_CORECLR_H__ |
8 | |
9 | #include "coreclrbindercommon.h" |
10 | #include "applicationcontext.hpp" |
11 | |
12 | namespace BINDER_SPACE |
13 | { |
14 | class AssemblyIdentityUTF8; |
15 | }; |
16 | |
17 | class CLRPrivBinderCoreCLR : public IUnknownCommon<ICLRPrivBinder> |
18 | { |
19 | public: |
20 | |
21 | //========================================================================= |
22 | // ICLRPrivBinder functions |
23 | //------------------------------------------------------------------------- |
24 | STDMETHOD(BindAssemblyByName)( |
25 | /* [in] */ IAssemblyName *pIAssemblyName, |
26 | /* [retval][out] */ ICLRPrivAssembly **ppAssembly); |
27 | |
28 | STDMETHOD(GetBinderID)( |
29 | /* [retval][out] */ UINT_PTR *pBinderId); |
30 | |
31 | STDMETHOD(GetLoaderAllocator)( |
32 | /* [retval][out] */ LPVOID *pLoaderAllocator); |
33 | |
34 | public: |
35 | |
36 | HRESULT SetupBindingPaths(SString &sTrustedPlatformAssemblies, |
37 | SString &sPlatformResourceRoots, |
38 | SString &sAppPaths, |
39 | SString &sAppNiPaths); |
40 | |
41 | inline BINDER_SPACE::ApplicationContext *GetAppContext() |
42 | { |
43 | return &m_appContext; |
44 | } |
45 | |
46 | HRESULT Bind(SString &assemblyDisplayName, |
47 | LPCWSTR wszCodeBase, |
48 | PEAssembly *pParentAssembly, |
49 | BOOL fNgenExplicitBind, |
50 | BOOL fExplicitBindToNativeImage, |
51 | ICLRPrivAssembly **ppAssembly); |
52 | |
53 | #ifndef CROSSGEN_COMPILE |
54 | HRESULT PreBindByteArray(PEImage *pPEImage, BOOL fInspectionOnly); |
55 | #endif // CROSSGEN_COMPILE |
56 | |
57 | #if !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) |
58 | HRESULT BindUsingPEImage( /* in */ PEImage *pPEImage, |
59 | /* in */ BOOL fIsNativeImage, |
60 | /* [retval][out] */ ICLRPrivAssembly **ppAssembly); |
61 | #endif // !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) |
62 | |
63 | HRESULT BindAssemblyByNameWorker( |
64 | BINDER_SPACE::AssemblyName *pAssemblyName, |
65 | BINDER_SPACE::Assembly **ppCoreCLRFoundAssembly, |
66 | bool excludeAppPaths); |
67 | |
68 | INT_PTR GetManagedAssemblyLoadContext() |
69 | { |
70 | return m_ptrManagedAssemblyLoadContext; |
71 | } |
72 | |
73 | void SetManagedAssemblyLoadContext(INT_PTR ptrManagedTPABinderInstance) |
74 | { |
75 | m_ptrManagedAssemblyLoadContext = ptrManagedTPABinderInstance; |
76 | } |
77 | |
78 | //========================================================================= |
79 | // Internal implementation details |
80 | //------------------------------------------------------------------------- |
81 | private: |
82 | BINDER_SPACE::ApplicationContext m_appContext; |
83 | |
84 | INT_PTR m_ptrManagedAssemblyLoadContext; |
85 | }; |
86 | |
87 | #endif // __CLR_PRIV_BINDER_CORECLR_H__ |
88 | |