From 2dd8fa65e8173a73f3acccf490c699a07deebd60 Mon Sep 17 00:00:00 2001 From: Steve MacLean Date: Sat, 22 Dec 2018 01:28:33 -0500 Subject: [PATCH] Remove dead ICLRPrivBinder methods (dotnet/coreclr#21637) * Remove dead FindAssemblyBySpec All paths returned E_FAIL * Remove dead BinderFlags * Remove dead VerifyBind Commit migrated from https://github.com/dotnet/coreclr/commit/0a1374f4f7c2141bf6d8ad74a68dd329afdbee78 --- src/coreclr/src/binder/assembly.cpp | 22 ------ .../binder/clrprivbinderassemblyloadcontext.cpp | 27 ------- src/coreclr/src/binder/clrprivbindercoreclr.cpp | 27 ------- src/coreclr/src/binder/inc/assembly.hpp | 13 ---- .../binder/inc/clrprivbinderassemblyloadcontext.h | 14 ---- src/coreclr/src/binder/inc/clrprivbindercoreclr.h | 14 ---- src/coreclr/src/inc/clrprivbinderutil.h | 39 ---------- src/coreclr/src/inc/clrprivbinding.idl | 39 ---------- src/coreclr/src/pal/prebuilt/inc/clrprivbinding.h | 73 ------------------- src/coreclr/src/vm/appdomain.cpp | 30 +------- src/coreclr/src/vm/assemblyspec.cpp | 12 --- src/coreclr/src/vm/ceeload.cpp | 30 ++------ src/coreclr/src/vm/clrprivbinderutil.cpp | 58 --------------- src/coreclr/src/vm/clrprivbinderwinrt.cpp | 36 --------- src/coreclr/src/vm/clrprivbinderwinrt.h | 85 ---------------------- src/coreclr/src/vm/pefile.h | 13 ---- 16 files changed, 7 insertions(+), 525 deletions(-) diff --git a/src/coreclr/src/binder/assembly.cpp b/src/coreclr/src/binder/assembly.cpp index 8faa00a..7f7ab26 100644 --- a/src/coreclr/src/binder/assembly.cpp +++ b/src/coreclr/src/binder/assembly.cpp @@ -299,33 +299,11 @@ Exit: return (m_pBinder == NULL) ? E_FAIL : m_pBinder->BindAssemblyByName(pIAssemblyName, ppAssembly); } - HRESULT Assembly::FindAssemblyBySpec( - LPVOID pvAppDomain, - LPVOID pvAssemblySpec, - HRESULT * pResult, - ICLRPrivAssembly ** ppAssembly) - { - return (m_pBinder == NULL) ? E_FAIL : m_pBinder->FindAssemblyBySpec(pvAppDomain, pvAssemblySpec, pResult, ppAssembly); - } - - HRESULT Assembly::VerifyBind ( - IAssemblyName * pIAssemblyName, - ICLRPrivAssembly *pAssembly, - ICLRPrivAssemblyInfo *pAssemblyInfo) - { - return (m_pBinder == NULL) ? E_FAIL : m_pBinder->VerifyBind(pIAssemblyName, pAssembly, pAssemblyInfo); - } - HRESULT Assembly::GetBinderID(UINT_PTR *pBinderId) { return (m_pBinder == NULL) ? E_FAIL : m_pBinder->GetBinderID(pBinderId); } - HRESULT Assembly::GetBinderFlags(DWORD *pBinderFlags) - { - return (m_pBinder == NULL) ? E_FAIL : m_pBinder->GetBinderFlags(pBinderFlags); - } - HRESULT Assembly::GetLoaderAllocator(LPVOID* pLoaderAllocator) { return (m_pBinder == NULL) ? E_FAIL : m_pBinder->GetLoaderAllocator(pLoaderAllocator); diff --git a/src/coreclr/src/binder/clrprivbinderassemblyloadcontext.cpp b/src/coreclr/src/binder/clrprivbinderassemblyloadcontext.cpp index e981314..5c6ea42 100644 --- a/src/coreclr/src/binder/clrprivbinderassemblyloadcontext.cpp +++ b/src/coreclr/src/binder/clrprivbinderassemblyloadcontext.cpp @@ -169,21 +169,6 @@ Exit:; return hr; } -HRESULT CLRPrivBinderAssemblyLoadContext::VerifyBind(IAssemblyName *AssemblyName, - ICLRPrivAssembly *pAssembly, - ICLRPrivAssemblyInfo *pAssemblyInfo) -{ - return E_FAIL; -} - -HRESULT CLRPrivBinderAssemblyLoadContext::GetBinderFlags(DWORD *pBinderFlags) -{ - if (pBinderFlags == NULL) - return E_INVALIDARG; - *pBinderFlags = BINDER_NONE; - return S_OK; -} - HRESULT CLRPrivBinderAssemblyLoadContext::GetBinderID( UINT_PTR *pBinderId) { @@ -191,18 +176,6 @@ HRESULT CLRPrivBinderAssemblyLoadContext::GetBinderID( return S_OK; } -HRESULT CLRPrivBinderAssemblyLoadContext::FindAssemblyBySpec( - LPVOID pvAppDomain, - LPVOID pvAssemblySpec, - HRESULT *pResult, - ICLRPrivAssembly **ppAssembly) -{ - // We are not using a cache at this level - // However, assemblies bound by the CoreCLR binder is already cached in the - // AppDomain and will be resolved from there if required - return E_FAIL; -} - HRESULT CLRPrivBinderAssemblyLoadContext::GetLoaderAllocator(LPVOID* pLoaderAllocator) { _ASSERTE(pLoaderAllocator != NULL); diff --git a/src/coreclr/src/binder/clrprivbindercoreclr.cpp b/src/coreclr/src/binder/clrprivbindercoreclr.cpp index eaa0607..eb7abe2 100644 --- a/src/coreclr/src/binder/clrprivbindercoreclr.cpp +++ b/src/coreclr/src/binder/clrprivbindercoreclr.cpp @@ -181,21 +181,6 @@ Exit:; } #endif // !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) -HRESULT CLRPrivBinderCoreCLR::VerifyBind(IAssemblyName *AssemblyName, - ICLRPrivAssembly *pAssembly, - ICLRPrivAssemblyInfo *pAssemblyInfo) -{ - return E_FAIL; -} - -HRESULT CLRPrivBinderCoreCLR::GetBinderFlags(DWORD *pBinderFlags) -{ - if (pBinderFlags == NULL) - return E_INVALIDARG; - *pBinderFlags = BINDER_NONE; - return S_OK; -} - HRESULT CLRPrivBinderCoreCLR::GetBinderID( UINT_PTR *pBinderId) { @@ -203,18 +188,6 @@ HRESULT CLRPrivBinderCoreCLR::GetBinderID( return S_OK; } -HRESULT CLRPrivBinderCoreCLR::FindAssemblyBySpec( - LPVOID pvAppDomain, - LPVOID pvAssemblySpec, - HRESULT *pResult, - ICLRPrivAssembly **ppAssembly) -{ - // We are not using a cache at this level - // However, assemblies bound by the CoreCLR binder is already cached in the - // AppDomain and will be resolved from there if required - return E_FAIL; -} - HRESULT CLRPrivBinderCoreCLR::SetupBindingPaths(SString &sTrustedPlatformAssemblies, SString &sPlatformResourceRoots, SString &sAppPaths, diff --git a/src/coreclr/src/binder/inc/assembly.hpp b/src/coreclr/src/binder/inc/assembly.hpp index 7071e2e..6729f8d 100644 --- a/src/coreclr/src/binder/inc/assembly.hpp +++ b/src/coreclr/src/binder/inc/assembly.hpp @@ -85,21 +85,8 @@ namespace BINDER_SPACE DWORD *pdwImageType, ICLRPrivResource ** ppIResource); - STDMETHOD(VerifyBind)( - IAssemblyName * pIAssemblyName, - ICLRPrivAssembly *pAssembly, - ICLRPrivAssemblyInfo *pAssemblyInfo); - STDMETHOD(GetBinderID)(UINT_PTR *pBinderId); - STDMETHOD(FindAssemblyBySpec)( - LPVOID pvAppDomain, - LPVOID pvAssemblySpec, - HRESULT * pResult, - ICLRPrivAssembly ** ppAssembly); - - STDMETHOD(GetBinderFlags)(DWORD *pBinderFlags); - STDMETHOD(GetLoaderAllocator)(LPVOID* pLoaderAllocator); // -------------------------------------------------------------------- diff --git a/src/coreclr/src/binder/inc/clrprivbinderassemblyloadcontext.h b/src/coreclr/src/binder/inc/clrprivbinderassemblyloadcontext.h index 9f3159f..f838557 100644 --- a/src/coreclr/src/binder/inc/clrprivbinderassemblyloadcontext.h +++ b/src/coreclr/src/binder/inc/clrprivbinderassemblyloadcontext.h @@ -35,23 +35,9 @@ public: /* [in] */ IAssemblyName *pIAssemblyName, /* [retval][out] */ ICLRPrivAssembly **ppAssembly); - STDMETHOD(VerifyBind)( - /* [in] */ IAssemblyName *pIAssemblyName, - /* [in] */ ICLRPrivAssembly *pAssembly, - /* [in] */ ICLRPrivAssemblyInfo *pAssemblyInfo); - - STDMETHOD(GetBinderFlags)( - /* [retval][out] */ DWORD *pBinderFlags); - STDMETHOD(GetBinderID)( /* [retval][out] */ UINT_PTR *pBinderId); - STDMETHOD(FindAssemblyBySpec)( - /* [in] */ LPVOID pvAppDomain, - /* [in] */ LPVOID pvAssemblySpec, - /* [out] */ HRESULT *pResult, - /* [out] */ ICLRPrivAssembly **ppAssembly); - STDMETHOD(GetLoaderAllocator)( /* [retval][out] */ LPVOID *pLoaderAllocator); diff --git a/src/coreclr/src/binder/inc/clrprivbindercoreclr.h b/src/coreclr/src/binder/inc/clrprivbindercoreclr.h index e8e26a0..178ee18 100644 --- a/src/coreclr/src/binder/inc/clrprivbindercoreclr.h +++ b/src/coreclr/src/binder/inc/clrprivbindercoreclr.h @@ -25,23 +25,9 @@ public: /* [in] */ IAssemblyName *pIAssemblyName, /* [retval][out] */ ICLRPrivAssembly **ppAssembly); - STDMETHOD(VerifyBind)( - /* [in] */ IAssemblyName *pIAssemblyName, - /* [in] */ ICLRPrivAssembly *pAssembly, - /* [in] */ ICLRPrivAssemblyInfo *pAssemblyInfo); - - STDMETHOD(GetBinderFlags)( - /* [retval][out] */ DWORD *pBinderFlags); - STDMETHOD(GetBinderID)( /* [retval][out] */ UINT_PTR *pBinderId); - STDMETHOD(FindAssemblyBySpec)( - /* [in] */ LPVOID pvAppDomain, - /* [in] */ LPVOID pvAssemblySpec, - /* [out] */ HRESULT *pResult, - /* [out] */ ICLRPrivAssembly **ppAssembly); - STDMETHOD(GetLoaderAllocator)( /* [retval][out] */ LPVOID *pLoaderAllocator); diff --git a/src/coreclr/src/inc/clrprivbinderutil.h b/src/coreclr/src/inc/clrprivbinderutil.h index fe922ee..023f72c 100644 --- a/src/coreclr/src/inc/clrprivbinderutil.h +++ b/src/coreclr/src/inc/clrprivbinderutil.h @@ -117,26 +117,6 @@ namespace CLRPrivBinderUtil //----------------------------------------------------------------------------------------------------------------- // Forwards to wrapped binder. - STDMETHOD(VerifyBind)( - IAssemblyName *pAssemblyName, - ICLRPrivAssembly *pAssembly, - ICLRPrivAssemblyInfo *pAssemblyInfo) - { - WRAPPER_NO_CONTRACT; - return _pWrapped->VerifyBind(pAssemblyName, pAssembly, pAssemblyInfo); - } - - //--------------------------------------------------------------------------------------------- - // Forwards to wrapped binder. - STDMETHOD(GetBinderFlags)( - DWORD *pBinderFlags) - { - WRAPPER_NO_CONTRACT; - return _pWrapped->GetBinderFlags(pBinderFlags); - } - - //----------------------------------------------------------------------------------------------------------------- - // Forwards to wrapped binder. STDMETHOD(GetBinderID)( UINT_PTR *pBinderId) { @@ -146,15 +126,6 @@ namespace CLRPrivBinderUtil //----------------------------------------------------------------------------------------------------------------- // Forwards to wrapped binder. - STDMETHOD(FindAssemblyBySpec)( - LPVOID pvAppDomain, - LPVOID pvAssemblySpec, - HRESULT * pResult, - ICLRPrivAssembly ** ppAssembly) - { STATIC_CONTRACT_WRAPPER; return _pWrapped->FindAssemblyBySpec(pvAppDomain, pvAssemblySpec, pResult, ppAssembly); } - - //----------------------------------------------------------------------------------------------------------------- - // Forwards to wrapped binder. STDMETHOD(GetLoaderAllocator)( LPVOID * pLoaderAllocator) { @@ -451,16 +422,6 @@ namespace CLRPrivBinderUtil CLRPrivBinderUtil::PublicKeyToken KeyToken; }; - //================================================================================================================= - HRESULT VerifyBind( - IAssemblyName *pRefAssemblyName, - ICLRPrivAssemblyInfo *pDefAssemblyInfo); - - //================================================================================================================= - HRESULT VerifyBind( - CLRPrivBinderUtil::AssemblyIdentity const & refIdentity, - CLRPrivBinderUtil::AssemblyIdentity const & defIdentity); - //================================================================================================= template struct CLRPrivResourceBase : diff --git a/src/coreclr/src/inc/clrprivbinding.idl b/src/coreclr/src/inc/clrprivbinding.idl index 284bc96..c30ed62 100644 --- a/src/coreclr/src/inc/clrprivbinding.idl +++ b/src/coreclr/src/inc/clrprivbinding.idl @@ -51,21 +51,6 @@ interface ICLRPrivBinder : IUnknown [out, retval] ICLRPrivAssembly ** ppAssembly); /********************************************************************************** - ** VerifyBind - **********************************************************************************/ - HRESULT VerifyBind( - [in] IAssemblyName * AssemblyName, - [in] ICLRPrivAssembly * pAssembly, - [in] ICLRPrivAssemblyInfo * pAssemblyInfo); - - /********************************************************************************** - ** GetBinderFlags - ** pBinderFlags, pointer to binder flags. - **********************************************************************************/ - HRESULT GetBinderFlags( - [out, retval] DWORD *pBinderFlags); - - /********************************************************************************** ** GetBinderID ** pBinderId, pointer to binder id. The binder id has the following properties ** It is a pointer that does not change over the lifetime of a binder object @@ -76,23 +61,6 @@ interface ICLRPrivBinder : IUnknown [out, retval] UINT_PTR *pBinderId); /********************************************************************************** - ** FindAssemblyBySpec -- if it has been previously bound, guarantees that the same - ** result will be returned; if previous result was successful, the bound - ** ICLRPrivAssembly will be returned, and if previous result was not successful - ** the same failure HRESULT will be assigned to *pResult. Returns failure HR if - ** identity has not been requested previously. - ** - ** pvAssemblySpec - the AssemblySpec identity to bind. - ** pResult - the result of the previous bind request. - ** ppAssembly - when successful, contains the corresponding assembly object. - **********************************************************************************/ - HRESULT FindAssemblyBySpec( - [in] LPVOID pvAppDomain, - [in] LPVOID pvAssemblySpec, - [out] HRESULT * pResult, - [out] ICLRPrivAssembly ** ppAssembly); - - /********************************************************************************** ** GetLoaderAllocator ** Get LoaderAllocator for binders that contain it. For other binders, return ** E_FAIL @@ -103,13 +71,6 @@ interface ICLRPrivBinder : IUnknown [out, retval] LPVOID * pLoaderAllocator); }; -enum CLR_PRIV_BINDER_FLAGS -{ - BINDER_NONE = 0x0, - BINDER_DESIGNER_BINDING_CONTEXT = 0x1, - BINDER_FINDASSEMBLYBYSPEC_REQUIRES_EXACT_MATCH = 0x2, -}; - /************************************************************************************** ** ASSEMBLY_IMAGE_TYPES - The set of assembly image formats. **************************************************************************************/ diff --git a/src/coreclr/src/pal/prebuilt/inc/clrprivbinding.h b/src/coreclr/src/pal/prebuilt/inc/clrprivbinding.h index 04ef10c..ceb11fe 100644 --- a/src/coreclr/src/pal/prebuilt/inc/clrprivbinding.h +++ b/src/coreclr/src/pal/prebuilt/inc/clrprivbinding.h @@ -155,23 +155,9 @@ EXTERN_C const IID IID_ICLRPrivBinder; /* [in] */ IAssemblyName *pAssemblyName, /* [retval][out] */ ICLRPrivAssembly **ppAssembly) = 0; - virtual HRESULT STDMETHODCALLTYPE VerifyBind( - /* [in] */ IAssemblyName *AssemblyName, - /* [in] */ ICLRPrivAssembly *pAssembly, - /* [in] */ ICLRPrivAssemblyInfo *pAssemblyInfo) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBinderFlags( - /* [retval][out] */ DWORD *pBinderFlags) = 0; - virtual HRESULT STDMETHODCALLTYPE GetBinderID( /* [retval][out] */ UINT_PTR *pBinderId) = 0; - virtual HRESULT STDMETHODCALLTYPE FindAssemblyBySpec( - /* [in] */ LPVOID pvAppDomain, - /* [in] */ LPVOID pvAssemblySpec, - /* [out] */ HRESULT *pResult, - /* [out] */ ICLRPrivAssembly **ppAssembly) = 0; - virtual HRESULT STDMETHODCALLTYPE GetLoaderAllocator( /* [retval][out] */ LPVOID* pLoaderAllocator) = 0; }; @@ -200,27 +186,10 @@ EXTERN_C const IID IID_ICLRPrivBinder; /* [in] */ IAssemblyName *pAssemblyName, /* [retval][out] */ ICLRPrivAssembly **ppAssembly); - HRESULT ( STDMETHODCALLTYPE *VerifyBind )( - ICLRPrivBinder * This, - /* [in] */ IAssemblyName *AssemblyName, - /* [in] */ ICLRPrivAssembly *pAssembly, - /* [in] */ ICLRPrivAssemblyInfo *pAssemblyInfo); - - HRESULT ( STDMETHODCALLTYPE *GetBinderFlags )( - ICLRPrivBinder * This, - /* [retval][out] */ DWORD *pBinderFlags); - HRESULT ( STDMETHODCALLTYPE *GetBinderID )( ICLRPrivBinder * This, /* [retval][out] */ UINT_PTR *pBinderId); - HRESULT ( STDMETHODCALLTYPE *FindAssemblyBySpec )( - ICLRPrivBinder * This, - /* [in] */ LPVOID pvAppDomain, - /* [in] */ LPVOID pvAssemblySpec, - /* [out] */ HRESULT *pResult, - /* [out] */ ICLRPrivAssembly **ppAssembly); - HRESULT(STDMETHODCALLTYPE *GetLoaderAllocator)( ICLRPrivBinder * This, /* [retval][out] */ LPVOID *pLoaderAllocator) = 0; @@ -251,18 +220,9 @@ EXTERN_C const IID IID_ICLRPrivBinder; #define ICLRPrivBinder_BindAssemblyByName(This,pAssemblyName,ppAssembly) \ ( (This)->lpVtbl -> BindAssemblyByName(This,pAssemblyName,ppAssembly) ) -#define ICLRPrivBinder_VerifyBind(This,AssemblyName,pAssembly,pAssemblyInfo) \ - ( (This)->lpVtbl -> VerifyBind(This,AssemblyName,pAssembly,pAssemblyInfo) ) - -#define ICLRPrivBinder_GetBinderFlags(This,pBinderFlags) \ - ( (This)->lpVtbl -> GetBinderFlags(This,pBinderFlags) ) - #define ICLRPrivBinder_GetBinderID(This,pBinderId) \ ( (This)->lpVtbl -> GetBinderID(This,pBinderId) ) -#define ICLRPrivBinder_FindAssemblyBySpec(This,pvAppDomain,pvAssemblySpec,pResult,ppAssembly) \ - ( (This)->lpVtbl -> FindAssemblyBySpec(This,pvAppDomain,pvAssemblySpec,pResult,ppAssembly) ) - #endif /* COBJMACROS */ @@ -278,13 +238,6 @@ EXTERN_C const IID IID_ICLRPrivBinder; /* [local] */ -enum CLR_PRIV_BINDER_FLAGS - { - BINDER_NONE = 0, - BINDER_DESIGNER_BINDING_CONTEXT = 0x1, - BINDER_FINDASSEMBLYBYSPEC_REQUIRES_EXACT_MATCH = 0x2 - } ; - enum ASSEMBLY_IMAGE_TYPES { ASSEMBLY_IMAGE_TYPE_IL = 0x1, @@ -349,27 +302,10 @@ EXTERN_C const IID IID_ICLRPrivAssembly; /* [in] */ IAssemblyName *pAssemblyName, /* [retval][out] */ ICLRPrivAssembly **ppAssembly); - HRESULT ( STDMETHODCALLTYPE *VerifyBind )( - ICLRPrivAssembly * This, - /* [in] */ IAssemblyName *AssemblyName, - /* [in] */ ICLRPrivAssembly *pAssembly, - /* [in] */ ICLRPrivAssemblyInfo *pAssemblyInfo); - - HRESULT ( STDMETHODCALLTYPE *GetBinderFlags )( - ICLRPrivAssembly * This, - /* [retval][out] */ DWORD *pBinderFlags); - HRESULT ( STDMETHODCALLTYPE *GetBinderID )( ICLRPrivAssembly * This, /* [retval][out] */ UINT_PTR *pBinderId); - HRESULT ( STDMETHODCALLTYPE *FindAssemblyBySpec )( - ICLRPrivAssembly * This, - /* [in] */ LPVOID pvAppDomain, - /* [in] */ LPVOID pvAssemblySpec, - /* [out] */ HRESULT *pResult, - /* [out] */ ICLRPrivAssembly **ppAssembly); - HRESULT ( STDMETHODCALLTYPE *IsShareable )( ICLRPrivAssembly * This, /* [retval][out] */ BOOL *pbIsShareable); @@ -410,18 +346,9 @@ EXTERN_C const IID IID_ICLRPrivAssembly; #define ICLRPrivAssembly_BindAssemblyByName(This,pAssemblyName,ppAssembly) \ ( (This)->lpVtbl -> BindAssemblyByName(This,pAssemblyName,ppAssembly) ) -#define ICLRPrivAssembly_VerifyBind(This,AssemblyName,pAssembly,pAssemblyInfo) \ - ( (This)->lpVtbl -> VerifyBind(This,AssemblyName,pAssembly,pAssemblyInfo) ) - -#define ICLRPrivAssembly_GetBinderFlags(This,pBinderFlags) \ - ( (This)->lpVtbl -> GetBinderFlags(This,pBinderFlags) ) - #define ICLRPrivAssembly_GetBinderID(This,pBinderId) \ ( (This)->lpVtbl -> GetBinderID(This,pBinderId) ) -#define ICLRPrivAssembly_FindAssemblyBySpec(This,pvAppDomain,pvAssemblySpec,pResult,ppAssembly) \ - ( (This)->lpVtbl -> FindAssemblyBySpec(This,pvAppDomain,pvAssemblySpec,pResult,ppAssembly) ) - #define ICLRPrivAssembly_IsShareable(This,pbIsShareable) \ ( (This)->lpVtbl -> IsShareable(This,pbIsShareable) ) diff --git a/src/coreclr/src/vm/appdomain.cpp b/src/coreclr/src/vm/appdomain.cpp index 3e850f1..fe0c694 100644 --- a/src/coreclr/src/vm/appdomain.cpp +++ b/src/coreclr/src/vm/appdomain.cpp @@ -5960,28 +5960,6 @@ private: }; //----------------------------------------------------------------------------------------------------------------- -static HRESULT VerifyBindHelper( - ICLRPrivAssembly *pPrivAssembly, - IAssemblyName *pAssemblyName, - PEAssembly *pPEAssembly) -{ - STATIC_CONTRACT_THROWS; - STATIC_CONTRACT_GC_TRIGGERS; - - HRESULT hr = S_OK; - // Create an ICLRPrivAssemblyInfo to call to ICLRPrivAssembly::VerifyBind - NewHolder pPrivAssemblyInfoImpl = new PEAssemblyAsPrivAssemblyInfo(pPEAssembly); - ReleaseHolder pPrivAssemblyInfo; - IfFailRet(pPrivAssemblyInfoImpl->QueryInterface(__uuidof(ICLRPrivAssemblyInfo), (LPVOID *)&pPrivAssemblyInfo)); - pPrivAssemblyInfoImpl.SuppressRelease(); - - // Call VerifyBind to give the host a chance to reject the bind based on assembly image contents. - IfFailRet(pPrivAssembly->VerifyBind(pAssemblyName, pPrivAssembly, pPrivAssemblyInfo)); - - return hr; -} - -//----------------------------------------------------------------------------------------------------------------- HRESULT AppDomain::BindAssemblySpecForHostedBinder( AssemblySpec * pSpec, IAssemblyName * pAssemblyName, @@ -6041,8 +6019,8 @@ AppDomain::BindHostedPrivAssembly( } if (*ppAssembly != nullptr) - { // Already exists: ask the binder to verify and return the assembly. - return VerifyBindHelper(pPrivAssembly, pAssemblyName, *ppAssembly); + { // Already exists: return the assembly. + return S_OK; } // Get the IL PEFile. @@ -6080,10 +6058,6 @@ AppDomain::BindHostedPrivAssembly( // Create a PEAssembly using the IL and NI images. PEAssemblyHolder pPEAssembly = PEAssembly::Open(pParentAssembly, pPEImageIL, pPEImageNI, pPrivAssembly); - - // Ask the binder to verify. - IfFailRet(VerifyBindHelper(pPrivAssembly, pAssemblyName, pPEAssembly)); - // The result. *ppAssembly = pPEAssembly.Extract(); diff --git a/src/coreclr/src/vm/assemblyspec.cpp b/src/coreclr/src/vm/assemblyspec.cpp index 861b3f5..136589f 100644 --- a/src/coreclr/src/vm/assemblyspec.cpp +++ b/src/coreclr/src/vm/assemblyspec.cpp @@ -920,18 +920,6 @@ DomainAssembly *AssemblySpec::LoadDomainAssembly(FileLoadLevel targetLevel, pBinder = GetBindingContextFromParentAssembly(pDomain); } - - if (pBinder != nullptr) - { - ReleaseHolder pPrivAssembly; - HRESULT hrCachedResult; - if (SUCCEEDED(pBinder->FindAssemblyBySpec(GetAppDomain(), this, &hrCachedResult, &pPrivAssembly)) && - SUCCEEDED(hrCachedResult)) - { - pAssembly = pDomain->FindAssembly(pPrivAssembly); - } - } - if ((pAssembly == nullptr) && CanUseWithBindingCache()) { pAssembly = pDomain->FindCachedAssembly(this); diff --git a/src/coreclr/src/vm/ceeload.cpp b/src/coreclr/src/vm/ceeload.cpp index 1582359..4582cdd 100644 --- a/src/coreclr/src/vm/ceeload.cpp +++ b/src/coreclr/src/vm/ceeload.cpp @@ -4922,21 +4922,11 @@ Assembly * Module::GetAssemblyIfLoadedFromNativeAssemblyRefWithRefDefMismatch(md } else { - DWORD binderFlags = 0; - ICLRPrivAssembly * pPrivBinder = pAssemblyCandidate->GetManifestFile()->GetHostAssembly(); - HRESULT hrBinderFlagCheck = pPrivBinder->GetBinderFlags(&binderFlags); - if (SUCCEEDED(hrBinderFlagCheck) && (binderFlags & BINDER_FINDASSEMBLYBYSPEC_REQUIRES_EXACT_MATCH)) - { - pAssembly = pAssemblyCandidate; - } - else - { - // This should only happen in the generic instantiation case when multiple threads are racing and - // the assembly found is one which we will determine is the wrong assembly. - // - // We can't assert that (as its possible under stress); however it shouldn't happen in the stack walk or GC case, so we assert in those cases. - _ASSERTE("Non-AssemblySpecBindingCache based assembly found with extended search" && !(IsStackWalkerThread() || IsGCThread()) && IsGenericInstantiationLookupCompareThread()); - } + // This should only happen in the generic instantiation case when multiple threads are racing and + // the assembly found is one which we will determine is the wrong assembly. + // + // We can't assert that (as its possible under stress); however it shouldn't happen in the stack walk or GC case, so we assert in those cases. + _ASSERTE("Non-AssemblySpecBindingCache based assembly found with extended search" && !(IsStackWalkerThread() || IsGCThread()) && IsGenericInstantiationLookupCompareThread()); } } } @@ -5113,16 +5103,6 @@ Module::GetAssemblyIfLoaded( BOOL eligibleForAdditionalChecks = TRUE; if (szWinRtNamespace != NULL) eligibleForAdditionalChecks = FALSE; // WinRT binds do not support this scan - else if (this->GetAssembly()->GetManifestFile()->IsDesignerBindingContext()) - { - eligibleForAdditionalChecks = FALSE; - // assemblies loaded into leaf designer binding contexts cannot be ngen images, or be depended on by ngen assemblies that bind to different versions of assemblies. - // However, in the shared designer binding context assemblies can be loaded with ngen images, and therefore can depend on assemblies in a designer binding context. (the shared context) - // A more correct version of this check would probably allow assemblies loaded into the shared designer binding context to be eligibleForAdditionalChecks; however - // there are problems. In particular, the logic below which scans through all native images is not strictly correct for scenarios involving a shared assembly context - // as the shared assembly context may have different binding rules as compared to the root context. At this time, we prefer to not fix this scenario until - // there is customer need for a fix. - } AssemblySpec specSearchAssemblyRef; diff --git a/src/coreclr/src/vm/clrprivbinderutil.cpp b/src/coreclr/src/vm/clrprivbinderutil.cpp index 0eccf50..38e1a90 100644 --- a/src/coreclr/src/vm/clrprivbinderutil.cpp +++ b/src/coreclr/src/vm/clrprivbinderutil.cpp @@ -39,64 +39,6 @@ LPWSTR CopyStringThrowing( namespace CLRPrivBinderUtil { - - //----------------------------------------------------------------------------------------------------------------- - HRESULT VerifyBind( - IAssemblyName *pRefAssemblyName, - ICLRPrivAssemblyInfo *pDefAssemblyInfo) - { - STANDARD_BIND_CONTRACT; - - HRESULT hr = S_OK; - VALIDATE_PTR_RET(pRefAssemblyName); - VALIDATE_PTR_RET(pDefAssemblyInfo); - - AssemblyIdentity refIdentity; - IfFailRet(refIdentity.Initialize(pRefAssemblyName)); - - AssemblyIdentity defIdentity; - IfFailRet(defIdentity.Initialize(pDefAssemblyInfo)); - - return VerifyBind(refIdentity, defIdentity); - } - - //----------------------------------------------------------------------------------------------------------------- - HRESULT VerifyBind( - CLRPrivBinderUtil::AssemblyIdentity const & refIdentity, - CLRPrivBinderUtil::AssemblyIdentity const & defIdentity) - { - LIMITED_METHOD_CONTRACT; - - // - // Compare versions. Success conditions are the same as those in Silverlight: - // 1. Reference identity has no version. - // 2. Both identities have versions, and ref.version <= def.version. - // - // Since the default value of AssemblyVersion is 0.0.0.0, then if the - // ref has no value set then the comparison will use 0.0.0.0, which will - // always compare as true to the version contained in the def. - // - - if (defIdentity.Version < refIdentity.Version) - { // Bound assembly has a lower version number than the reference. - return CLR_E_BIND_ASSEMBLY_VERSION_TOO_LOW; - } - - // - // Compare public key tokens. Success conditions are: - // 1. Reference identity has no PKT. - // 2. Both identities have identical PKT values. - // - - if (refIdentity.KeyToken.GetSize() != 0 && // Ref without PKT always passes. - refIdentity.KeyToken != defIdentity.KeyToken) // Otherwise Def must have matching PKT. - { - return CLR_E_BIND_ASSEMBLY_PUBLIC_KEY_MISMATCH; - } - - return S_OK; - } - //--------------------------------------------------------------------------------------------- CLRPrivResourcePathImpl::CLRPrivResourcePathImpl(LPCWSTR wzPath) : m_wzPath(CopyStringThrowing(wzPath)) diff --git a/src/coreclr/src/vm/clrprivbinderwinrt.cpp b/src/coreclr/src/vm/clrprivbinderwinrt.cpp index 23bf652..085af57 100644 --- a/src/coreclr/src/vm/clrprivbinderwinrt.cpp +++ b/src/coreclr/src/vm/clrprivbinderwinrt.cpp @@ -1132,31 +1132,6 @@ HRESULT CLRPrivAssemblyWinRT::GetImageResource( } //===================================================================================================================== -// Implements interface method code:ICLRPrivBinder::VerifyBind. -// -HRESULT CLRPrivBinderWinRT::VerifyBind( - IAssemblyName * pAssemblyName, - ICLRPrivAssembly * pAssembly, - ICLRPrivAssemblyInfo * pAssemblyInfo) -{ - STANDARD_BIND_CONTRACT; - HRESULT hr = S_OK; - - VALIDATE_ARG_RET(pAssemblyInfo != nullptr); - - UINT_PTR binderID; - IfFailRet(pAssembly->GetBinderID(&binderID)); - if (binderID != reinterpret_cast(this)) - { - return pAssembly->VerifyBind(pAssemblyName, pAssembly, pAssemblyInfo); - } - - // Since WinRT types are bound by type name and not assembly name, assembly-level version validation - // does not make sense here. Just return S_OK. - return S_OK; -} - -//===================================================================================================================== // Implements interface method code:ICLRPrivBinder::GetBinderID. // HRESULT CLRPrivBinderWinRT::GetBinderID( @@ -1168,17 +1143,6 @@ HRESULT CLRPrivBinderWinRT::GetBinderID( return S_OK; } -//===================================================================================================================== -HRESULT CLRPrivBinderWinRT::FindWinRTAssemblyBySpec( - LPVOID pvAppDomain, - LPVOID pvAssemblySpec, - HRESULT * pResult, - ICLRPrivAssembly ** ppAssembly) -{ - STATIC_CONTRACT_WRAPPER; - return E_FAIL; -} - //===================================================================================================================== HRESULT CLRPrivAssemblyWinRT::GetIBindResult( diff --git a/src/coreclr/src/vm/clrprivbinderwinrt.h b/src/coreclr/src/vm/clrprivbinderwinrt.h index 3515874c..e9cc1df 100644 --- a/src/coreclr/src/vm/clrprivbinderwinrt.h +++ b/src/coreclr/src/vm/clrprivbinderwinrt.h @@ -122,72 +122,16 @@ public: IAssemblyName * pAssemblyName, ICLRPrivAssembly ** ppAssembly); - // Implements interface method code:ICLRPrivBinder::VerifyBind. - STDMETHOD(VerifyBind)( - IAssemblyName * pAssemblyName, - ICLRPrivAssembly * pAssembly, - ICLRPrivAssemblyInfo * pAssemblyInfo); - - // Implements interface method code:ICLRPrivBinder::GetBinderFlags - STDMETHOD(GetBinderFlags)( - DWORD *pBinderFlags) - { - STATIC_CONTRACT_WRAPPER; - - if (pBinderFlags == NULL) - return E_INVALIDARG; - - HRESULT hr = S_OK; - - if (m_pParentBinder != NULL) - hr = m_pParentBinder->GetBinderFlags(pBinderFlags); - else - *pBinderFlags = BINDER_NONE; - - return hr; - } - // Implements interface method code:ICLRPrivBinder::GetBinderID. STDMETHOD(GetBinderID)( UINT_PTR * pBinderId); - STDMETHOD(FindAssemblyBySpec)( - LPVOID pvAppDomain, - LPVOID pvAssemblySpec, - HRESULT * pResult, - ICLRPrivAssembly ** ppAssembly) - { - LIMITED_METHOD_CONTRACT; - -#ifndef DACCESS_COMPILE - // CLRPrivBinderWinRT instances only have parent binders in Metro processes (not in classic). - _ASSERTE((AppX::IsAppXProcess()) == (m_pParentBinder != nullptr)); -#endif - - if (m_pParentBinder != NULL) - { - return m_pParentBinder->FindAssemblyBySpec(pvAppDomain, pvAssemblySpec, pResult, ppAssembly); - } - else - { - // Note: should never get here if caller is Module::GetAssemblyIfLoaded, but can - // be called from AssemblySpec::LoadDomainAssembly.. - return FindWinRTAssemblyBySpec(pvAppDomain, pvAssemblySpec, pResult, ppAssembly); - } - } - STDMETHOD(GetLoaderAllocator)( LPVOID * pLoaderAllocator) { return E_FAIL; } - HRESULT FindWinRTAssemblyBySpec( - LPVOID pvAppDomain, - LPVOID pvAssemblySpec, - HRESULT * pResult, - ICLRPrivAssembly ** ppAssembly); - //============================================================================================= // Class methods @@ -348,24 +292,6 @@ public: return m_pBinder->BindAssemblyByName(pAssemblyName, ppAssembly); } - // Implements interface method code:ICLRPrivBinder::VerifyBind. - STDMETHOD(VerifyBind)( - IAssemblyName * pAssemblyName, - ICLRPrivAssembly * pAssembly, - ICLRPrivAssemblyInfo * pAssemblyInfo) - { - STATIC_CONTRACT_WRAPPER; - return m_pBinder->VerifyBind(pAssemblyName, pAssembly, pAssemblyInfo); - } - - // Implements interface method code:ICLRPrivBinder::GetBinderFlags - STDMETHOD(GetBinderFlags)( - DWORD *pBinderFlags) - { - STATIC_CONTRACT_WRAPPER; - return m_pBinder->GetBinderFlags(pBinderFlags); - } - // Implements interface method code:ICLRPrivBinder::GetBinderID. STDMETHOD(GetBinderID)( UINT_PTR * pBinderId) @@ -374,17 +300,6 @@ public: return m_pBinder->GetBinderID(pBinderId); } - // Implements code:ICLRPrivBinder::FindAssemblyBySpec - STDMETHOD(FindAssemblyBySpec)( - LPVOID pvAppDomain, - LPVOID pvAssemblySpec, - HRESULT * pResult, - ICLRPrivAssembly ** ppAssembly) - { - STATIC_CONTRACT_WRAPPER; - return m_pBinder->FindAssemblyBySpec(pvAppDomain, pvAssemblySpec, pResult, ppAssembly); - } - STDMETHOD(GetLoaderAllocator)( LPVOID * pLoaderAllocator) { diff --git a/src/coreclr/src/vm/pefile.h b/src/coreclr/src/vm/pefile.h index 72b1e3a..c92ebaa 100644 --- a/src/coreclr/src/vm/pefile.h +++ b/src/coreclr/src/vm/pefile.h @@ -550,19 +550,6 @@ public: return HasOpenedILimage() && GetOpenedILimage()->HasLoadedLayout(); } - BOOL IsDesignerBindingContext() - { - LIMITED_METHOD_CONTRACT; - - DWORD binderFlags = BINDER_NONE; - - HRESULT hr = E_FAIL; - if (HasHostAssembly()) - hr = GetHostAssembly()->GetBinderFlags(&binderFlags); - - return hr == S_OK ? binderFlags & BINDER_DESIGNER_BINDING_CONTEXT : FALSE; - } - LPCWSTR GetPathForErrorMessages(); static PEFile* Dummy(); -- 2.7.4